Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compile code for calling native functions.
MVM_nativecall_build builds a JIT graph manually and compiles it. The result is attached to the MVMNativeCallBody. For now the new nativeinvoke_* ops (mirroring invoke_*) will enter that code. Ideally we will replace the whole frame containing the nativeinvoke by JIT compiled code. The nativeinvoke_o op just invokes the JITed code which will handle argument fetching on its own so we can avoid the overhead of copying arguments into an nqp::list. We need to unblock GC on the current thread after we return from the native function and before we box the return value. Otherwise if GC is triggered by the boxing function, we will hang as GC is blocked. You can now tell the JIT that the C function you want to call should take an argument from WORK[cur_op + whatever] which is the equivalent of all those GET_REG(cur_op, whatever) in interp.c. Same for return values. When in interp.c you'd write GET_REG(cur_op, 0) = ...; you tell the JIT: node->u.call.rv_mode = MVM_JIT_RV_DYNIDX; box_rv_node->u.call.rv_idx = 0;
- Loading branch information