MCPcopy Create free account
hub / github.com/ReadyTalk/avian / invokeNative

Function invokeNative

src/interpret.cpp:618–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618unsigned invokeNative(Thread* t, GcMethod* method)
619{
620 PROTECT(t, method);
621
622 resolveNative(t, method);
623
624 GcNative* native = getMethodRuntimeData(t, method)->native();
625 if (native->fast()) {
626 pushFrame(t, method);
627
628 uint64_t result;
629 {
630 THREAD_RESOURCE0(t, popFrame(static_cast<Thread*>(t)));
631
632 unsigned footprint = method->parameterFootprint();
633 THREAD_RUNTIME_ARRAY(t, uintptr_t, args, footprint);
634 unsigned sp = frameBase(t, t->frame);
635 unsigned argOffset = 0;
636 if ((method->flags() & ACC_STATIC) == 0) {
637 RUNTIME_ARRAY_BODY(args)[argOffset++]
638 = reinterpret_cast<uintptr_t>(peekObject(t, sp++));
639 }
640
641 marshalArguments(
642 t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true);
643
644 if(method->returnCode() != VoidField) {
645 result = reinterpret_cast<FastNativeFunction>(native->function())(
646 t, method, RUNTIME_ARRAY_BODY(args));
647 }
648 else {
649 result = 0;
650 reinterpret_cast<FastVoidNativeFunction>(native->function())(
651 t, method, RUNTIME_ARRAY_BODY(args));
652 }
653 }
654
655 pushResult(t, method->returnCode(), result, false);
656
657 return method->returnCode();
658 } else {
659 return invokeNativeSlow(t, method, native->function());
660 }
661}
662
663inline void store(Thread* t, unsigned index)
664{

Callers 2

interpret3Function · 0.70
invokeFunction · 0.70

Calls 10

resolveNativeFunction · 0.85
getMethodRuntimeDataFunction · 0.85
pushFrameFunction · 0.85
popFrameFunction · 0.85
peekObjectFunction · 0.85
marshalArgumentsFunction · 0.85
pushResultFunction · 0.85
flagsMethod · 0.80
frameBaseFunction · 0.70
invokeNativeSlowFunction · 0.70

Tested by

no test coverage detected