From 1a4465a371504e47007e1df4f568ff91ed2820fc Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Wed, 17 Jul 2024 19:59:01 +0200 Subject: [PATCH] changes template: adds correct illegal instruction, reorders gen_sync to allow correct instr id eve when trapping, adds newly generated vm --- gen_input/templates/asmjit/CORENAME.cpp.gtl | 20 +- src/vm/asmjit/vm_tgc5c.cpp | 198 +++++++++++--------- 2 files changed, 123 insertions(+), 95 deletions(-) diff --git a/gen_input/templates/asmjit/CORENAME.cpp.gtl b/gen_input/templates/asmjit/CORENAME.cpp.gtl index 76a3d45..90446be 100644 --- a/gen_input/templates/asmjit/CORENAME.cpp.gtl +++ b/gen_input/templates/asmjit/CORENAME.cpp.gtl @@ -173,8 +173,8 @@ private: /*generate behavior*/ <%instr.behavior.eachLine{%>${it} <%}%> - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, ${idx}); + gen_instr_epilogue(jh); return returnValue; } <%}%> @@ -183,13 +183,27 @@ private: ****************************************************************************/ continuation_e illegal_instruction(virt_addr_t &pc, code_word_t instr, jit_holder& jh ) { x86::Compiler& cc = jh.cc; + if(this->disass_enabled){ + auto mnemonic = std::string("illegal_instruction"); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignature::build()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } cc.comment(fmt::format("illegal_instruction{:#x}:",pc.val).c_str()); gen_sync(jh, PRE_SYNC, instr_descr.size()); + mov(cc, jh.pc, pc.val); + gen_set_tval(jh, instr); pc = pc + ((instr & 3) == 3 ? 4 : 2); + mov(cc, jh.next_pc, pc.val); gen_instr_prologue(jh); cc.comment("//behavior:"); - gen_instr_epilogue(jh); + gen_raise(jh, 0, 2); gen_sync(jh, POST_SYNC, instr_descr.size()); + gen_instr_epilogue(jh); return BRANCH; } @@ -283,7 +297,6 @@ void vm_impl::gen_instr_prologue(jit_holder& jh) { auto& cc = jh.cc; cc.comment("//gen_instr_prologue"); - cc.inc(get_ptr_for(jh, traits::ICOUNT)); x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); @@ -299,6 +312,7 @@ void vm_impl::gen_instr_epilogue(jit_holder& jh) { mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); cmp(cc, current_trap_state, 0); cc.jne(jh.trap_entry); + cc.inc(get_ptr_for(jh, traits::ICOUNT)); } template void vm_impl::gen_block_prologue(jit_holder& jh){ diff --git a/src/vm/asmjit/vm_tgc5c.cpp b/src/vm/asmjit/vm_tgc5c.cpp index 810da11..e4f351e 100644 --- a/src/vm/asmjit/vm_tgc5c.cpp +++ b/src/vm/asmjit/vm_tgc5c.cpp @@ -357,8 +357,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 0); + gen_instr_epilogue(jh); return returnValue; } @@ -404,8 +404,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 1); + gen_instr_epilogue(jh); return returnValue; } @@ -461,8 +461,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 2); + gen_instr_epilogue(jh); return returnValue; } @@ -531,8 +531,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 3); + gen_instr_epilogue(jh); return returnValue; } @@ -592,8 +592,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 4); + gen_instr_epilogue(jh); return returnValue; } @@ -653,8 +653,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 5); + gen_instr_epilogue(jh); return returnValue; } @@ -716,8 +716,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 6); + gen_instr_epilogue(jh); return returnValue; } @@ -779,8 +779,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 7); + gen_instr_epilogue(jh); return returnValue; } @@ -840,8 +840,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 8); + gen_instr_epilogue(jh); return returnValue; } @@ -901,8 +901,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 9); + gen_instr_epilogue(jh); return returnValue; } @@ -955,8 +955,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 10); + gen_instr_epilogue(jh); return returnValue; } @@ -1009,8 +1009,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 11); + gen_instr_epilogue(jh); return returnValue; } @@ -1063,8 +1063,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 12); + gen_instr_epilogue(jh); return returnValue; } @@ -1116,8 +1116,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 13); + gen_instr_epilogue(jh); return returnValue; } @@ -1169,8 +1169,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 14); + gen_instr_epilogue(jh); return returnValue; } @@ -1218,8 +1218,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 15); + gen_instr_epilogue(jh); return returnValue; } @@ -1267,8 +1267,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 16); + gen_instr_epilogue(jh); return returnValue; } @@ -1316,8 +1316,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 17); + gen_instr_epilogue(jh); return returnValue; } @@ -1366,8 +1366,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 18); + gen_instr_epilogue(jh); return returnValue; } @@ -1429,8 +1429,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 19); + gen_instr_epilogue(jh); return returnValue; } @@ -1491,8 +1491,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 20); + gen_instr_epilogue(jh); return returnValue; } @@ -1540,8 +1540,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 21); + gen_instr_epilogue(jh); return returnValue; } @@ -1589,8 +1589,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 22); + gen_instr_epilogue(jh); return returnValue; } @@ -1638,8 +1638,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 23); + gen_instr_epilogue(jh); return returnValue; } @@ -1687,8 +1687,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 24); + gen_instr_epilogue(jh); return returnValue; } @@ -1736,8 +1736,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 25); + gen_instr_epilogue(jh); return returnValue; } @@ -1787,8 +1787,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 26); + gen_instr_epilogue(jh); return returnValue; } @@ -1837,8 +1837,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 27); + gen_instr_epilogue(jh); return returnValue; } @@ -1887,8 +1887,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 28); + gen_instr_epilogue(jh); return returnValue; } @@ -1937,8 +1937,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 29); + gen_instr_epilogue(jh); return returnValue; } @@ -2001,8 +2001,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 30); + gen_instr_epilogue(jh); return returnValue; } @@ -2063,8 +2063,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 31); + gen_instr_epilogue(jh); return returnValue; } @@ -2112,8 +2112,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 32); + gen_instr_epilogue(jh); return returnValue; } @@ -2162,8 +2162,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 33); + gen_instr_epilogue(jh); return returnValue; } @@ -2214,8 +2214,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 34); + gen_instr_epilogue(jh); return returnValue; } @@ -2263,8 +2263,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 35); + gen_instr_epilogue(jh); return returnValue; } @@ -2312,8 +2312,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 36); + gen_instr_epilogue(jh); return returnValue; } @@ -2354,8 +2354,8 @@ private: gen_write_mem(jh, traits::FENCE, static_cast(traits::fence), (uint8_t)pred<<4|succ, 4); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 37); + gen_instr_epilogue(jh); return returnValue; } @@ -2390,8 +2390,8 @@ private: gen_raise(jh, 0, 11); auto returnValue = TRAP; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 38); + gen_instr_epilogue(jh); return returnValue; } @@ -2426,8 +2426,8 @@ private: gen_raise(jh, 0, 3); auto returnValue = TRAP; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 39); + gen_instr_epilogue(jh); return returnValue; } @@ -2462,8 +2462,8 @@ private: gen_leave(jh, 3); auto returnValue = TRAP; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 40); + gen_instr_epilogue(jh); return returnValue; } @@ -2498,8 +2498,8 @@ private: gen_wait(jh, 1); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 41); + gen_instr_epilogue(jh); return returnValue; } @@ -2552,8 +2552,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 42); + gen_instr_epilogue(jh); return returnValue; } @@ -2606,8 +2606,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 43); + gen_instr_epilogue(jh); return returnValue; } @@ -2660,8 +2660,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 44); + gen_instr_epilogue(jh); return returnValue; } @@ -2710,8 +2710,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 45); + gen_instr_epilogue(jh); return returnValue; } @@ -2763,8 +2763,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 46); + gen_instr_epilogue(jh); return returnValue; } @@ -2816,8 +2816,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 47); + gen_instr_epilogue(jh); return returnValue; } @@ -2856,8 +2856,8 @@ private: gen_write_mem(jh, traits::FENCE, static_cast(traits::fencei), imm, 4); auto returnValue = FLUSH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 48); + gen_instr_epilogue(jh); return returnValue; } @@ -2909,8 +2909,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 49); + gen_instr_epilogue(jh); return returnValue; } @@ -2963,8 +2963,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 50); + gen_instr_epilogue(jh); return returnValue; } @@ -3016,8 +3016,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 51); + gen_instr_epilogue(jh); return returnValue; } @@ -3068,8 +3068,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 52); + gen_instr_epilogue(jh); return returnValue; } @@ -3153,8 +3153,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 53); + gen_instr_epilogue(jh); return returnValue; } @@ -3218,8 +3218,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 54); + gen_instr_epilogue(jh); return returnValue; } @@ -3307,8 +3307,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 55); + gen_instr_epilogue(jh); return returnValue; } @@ -3372,8 +3372,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 56); + gen_instr_epilogue(jh); return returnValue; } @@ -3419,8 +3419,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 57); + gen_instr_epilogue(jh); return returnValue; } @@ -3465,8 +3465,8 @@ private: gen_read_mem(jh, traits::MEM, offs, 4), 32, false), 32, true)); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 58); + gen_instr_epilogue(jh); return returnValue; } @@ -3509,8 +3509,8 @@ private: load_reg_from_mem(jh, traits::X0 + rs2+8), 32, false), 4); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 59); + gen_instr_epilogue(jh); return returnValue; } @@ -3558,8 +3558,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 60); + gen_instr_epilogue(jh); return returnValue; } @@ -3594,8 +3594,8 @@ private: /*generate behavior*/ auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 61); + gen_instr_epilogue(jh); return returnValue; } @@ -3636,8 +3636,8 @@ private: mov(cc, get_ptr_for(jh, traits::LAST_BRANCH), 32U); auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 62); + gen_instr_epilogue(jh); return returnValue; } @@ -3683,8 +3683,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 63); + gen_instr_epilogue(jh); return returnValue; } @@ -3728,8 +3728,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 64); + gen_instr_epilogue(jh); return returnValue; } @@ -3774,8 +3774,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 65); + gen_instr_epilogue(jh); return returnValue; } @@ -3811,8 +3811,8 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 66); + gen_instr_epilogue(jh); return returnValue; } @@ -3852,8 +3852,8 @@ private: ); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 67); + gen_instr_epilogue(jh); return returnValue; } @@ -3906,8 +3906,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 68); + gen_instr_epilogue(jh); return returnValue; } @@ -3948,8 +3948,8 @@ private: ), 32, true)); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 69); + gen_instr_epilogue(jh); return returnValue; } @@ -3990,8 +3990,8 @@ private: ), 32, true)); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 70); + gen_instr_epilogue(jh); return returnValue; } @@ -4031,8 +4031,8 @@ private: ); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 71); + gen_instr_epilogue(jh); return returnValue; } @@ -4072,8 +4072,8 @@ private: ); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 72); + gen_instr_epilogue(jh); return returnValue; } @@ -4113,8 +4113,8 @@ private: ); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 73); + gen_instr_epilogue(jh); return returnValue; } @@ -4153,8 +4153,8 @@ private: mov(cc, get_ptr_for(jh, traits::LAST_BRANCH), 32U); auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 74); + gen_instr_epilogue(jh); return returnValue; } @@ -4201,8 +4201,8 @@ private: cc.bind(label_merge); auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 75); + gen_instr_epilogue(jh); return returnValue; } @@ -4249,8 +4249,8 @@ private: cc.bind(label_merge); auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 76); + gen_instr_epilogue(jh); return returnValue; } @@ -4297,8 +4297,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 77); + gen_instr_epilogue(jh); return returnValue; } @@ -4347,8 +4347,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 78); + gen_instr_epilogue(jh); return returnValue; } @@ -4394,8 +4394,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 79); + gen_instr_epilogue(jh); return returnValue; } @@ -4441,8 +4441,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 80); + gen_instr_epilogue(jh); return returnValue; } @@ -4477,8 +4477,8 @@ private: gen_raise(jh, 0, 2); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 81); + gen_instr_epilogue(jh); return returnValue; } @@ -4526,8 +4526,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 82); + gen_instr_epilogue(jh); return returnValue; } @@ -4576,8 +4576,8 @@ private: } auto returnValue = BRANCH; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 83); + gen_instr_epilogue(jh); return returnValue; } @@ -4612,8 +4612,8 @@ private: gen_raise(jh, 0, 3); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 84); + gen_instr_epilogue(jh); return returnValue; } @@ -4660,8 +4660,8 @@ private: } auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 85); + gen_instr_epilogue(jh); return returnValue; } @@ -4696,23 +4696,37 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); auto returnValue = CONT; - gen_instr_epilogue(jh); gen_sync(jh, POST_SYNC, 86); + gen_instr_epilogue(jh); return returnValue; } /**************************************************************************** * end opcode definitions ****************************************************************************/ - continuation_e illegal_intruction(virt_addr_t &pc, code_word_t instr, jit_holder& jh ) { + continuation_e illegal_instruction(virt_addr_t &pc, code_word_t instr, jit_holder& jh ) { x86::Compiler& cc = jh.cc; - cc.comment(fmt::format("illegal_intruction{:#x}:",pc.val).c_str()); + if(this->disass_enabled){ + auto mnemonic = std::string("illegal_instruction"); + InvokeNode* call_print_disass; + char* mnemonic_ptr = strdup(mnemonic.c_str()); + jh.disass_collection.push_back(mnemonic_ptr); + jh.cc.invoke(&call_print_disass, &print_disass, FuncSignature::build()); + call_print_disass->setArg(0, jh.arch_if_ptr); + call_print_disass->setArg(1, pc.val); + call_print_disass->setArg(2, mnemonic_ptr); + } + cc.comment(fmt::format("illegal_instruction{:#x}:",pc.val).c_str()); gen_sync(jh, PRE_SYNC, instr_descr.size()); + mov(cc, jh.pc, pc.val); + gen_set_tval(jh, instr); pc = pc + ((instr & 3) == 3 ? 4 : 2); + mov(cc, jh.next_pc, pc.val); gen_instr_prologue(jh); cc.comment("//behavior:"); - gen_instr_epilogue(jh); + gen_raise(jh, 0, 2); gen_sync(jh, POST_SYNC, instr_descr.size()); + gen_instr_epilogue(jh); return BRANCH; } @@ -4798,7 +4812,7 @@ continuation_e vm_impl::gen_single_inst_behavior(virt_addr_t &pc, unsigned ++inst_cnt; auto f = decode_instr(root, instr); if (f == nullptr) - f = &this_class::illegal_intruction; + f = &this_class::illegal_instruction; return (this->*f)(pc, instr, jh); } template @@ -4806,7 +4820,6 @@ void vm_impl::gen_instr_prologue(jit_holder& jh) { auto& cc = jh.cc; cc.comment("//gen_instr_prologue"); - cc.inc(get_ptr_for(jh, traits::ICOUNT)); x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); @@ -4822,6 +4835,7 @@ void vm_impl::gen_instr_epilogue(jit_holder& jh) { mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); cmp(cc, current_trap_state, 0); cc.jne(jh.trap_entry); + cc.inc(get_ptr_for(jh, traits::ICOUNT)); } template void vm_impl::gen_block_prologue(jit_holder& jh){