MCPcopy Create free account
hub / github.com/D7EAD/mkPIVM / enc_native

Function enc_native

src/codec.cpp:2482–2498  ·  view source on GitHub ↗

CALL_NATIVE / JMP_NATIVE / RET_NATIVE

Source from the content-addressed store, hash-verified

2480
2481 // CALL_NATIVE / JMP_NATIVE / RET_NATIVE
2482 static void enc_native(BytecodeBuilder& o, const IRInsn& i, const VMConfig& v, const Codec* self) {
2483 o.u8(v.opcode_for(self->family()));
2484 o.emit_trampoline_offset_for_return_va(i.return_va);
2485
2486 if (std::holds_alternative<Imm>(i.ops[0])) {
2487 o.u8(0);
2488 enc_imm_n(o, get_op<Imm>(i, 0).value, 8);
2489 }
2490 else if (std::holds_alternative<VirReg>(i.ops[0])) {
2491 o.u8(1);
2492 enc_slot(o, v, get_op<VirReg>(i, 0));
2493 }
2494 else {
2495 o.u8(2);
2496 enc_mem(o, v, get_op<Mem>(i, 0));
2497 }
2498 }
2499
2500 static void emit_native_handler(X64Emitter& e, const VMConfig& vm, bool is_jmp) {
2501 const auto& r = vm.dispatcher_regs();

Callers 1

encodeMethod · 0.85

Calls 7

enc_imm_nFunction · 0.85
enc_slotFunction · 0.85
enc_memFunction · 0.85
opcode_forMethod · 0.80
u8Method · 0.45
familyMethod · 0.45

Tested by

no test coverage detected