📄 jit3-i386.def
字号:
LOUT(o); debug(("fld %d(ebp)\n", o));}define_insn(cvt_double_float, cvtdf_RxR){ int o; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); o = rslot_double(2); wreg_float(0); OUT(0xDD); OUT(0x80|REG_ebp); LOUT(o); debug(("fldl %d(ebp)\n", o));}/* --------------------------------------------------------------------- */define_insn(build_key, set_word_xxC){ jint val = const_int(2); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); LOUT(val); debug((".word %08x\n", val));}define_insn(build_code_ref, set_wordpc_xxC){ label* l = const_label(2); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); l->type |= Llong|Labsolute; l->at = CODEPC; LOUT(0); l->from = CODEPC; debug((".word %s\n", KaffeJIT3_getLabelName(l)));}/* --------------------------------------------------------------------- */define_insn(set_label, set_label_xxC){ label* l = const_label(2); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); l->to = CODEPC;}define_insn(branch, branch_xCC){ label* l = const_label(1); int bt = const_int(2); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); l->type |= Llong|Lrelative; switch (bt) { case ba: OUT(0xE9); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jmpl %s\n", KaffeJIT3_getLabelName(l))); break; case beq: OUT(0x0F); OUT(0x84); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("je %s\n", KaffeJIT3_getLabelName(l))); break; case bne: OUT(0x0F); OUT(0x85); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jne %s\n", KaffeJIT3_getLabelName(l))); break; case blt: OUT(0x0F); OUT(0x8C); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jlt %s\n", KaffeJIT3_getLabelName(l))); break; case ble: OUT(0x0F); OUT(0x8E); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jle %s\n", KaffeJIT3_getLabelName(l))); break; case bgt: OUT(0x0F); OUT(0x8F); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jgt %s\n", KaffeJIT3_getLabelName(l))); break; case bge: OUT(0x0F); OUT(0x8D); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jge %s\n", KaffeJIT3_getLabelName(l))); break; case bult: OUT(0x0F); OUT(0x82); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jult %s\n", KaffeJIT3_getLabelName(l))); break; case bugt: OUT(0x0F); OUT(0x87); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("jugt %s\n", KaffeJIT3_getLabelName(l))); break; case buge: OUT(0x0F); OUT(0x83); l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("juge %s\n", KaffeJIT3_getLabelName(l))); break; default: KAFFEVM_ABORT(); }}define_insn(branch_indirect, branch_indirect_xRC){ int r = rreg_int(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); assert(const_int(2) == ba); OUT(0xFF); OUT(0xE0|r); debug(("jmp (%s)\n", regname(r)));}define_insn(call_ref, call_xCC){ label* l = const_label(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); assert(const_int(2) == ba);#if defined(KAFFE_PROFILER) if (profFlag && !(l->type & Lnoprofile)) { /* don't profile call_soft */ profiler_start(globalMethod->totalChildrenClicks, 1); }#endif OUT(0xE8); l->type |= Llong|Lrelative; l->at = CODEPC; LOUT(0); l->from = CODEPC; debug(("call ?\n"));#if defined(KAFFE_PROFILER) if (profFlag && !(l->type & Lnoprofile)) { /* don't profile call_soft */ profiler_end(globalMethod->totalChildrenClicks, 1); }#endif}define_insn(call, call_xRC){ int r = rreg_int(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); assert(const_int(2) == ba);#if defined(KAFFE_PROFILER) if (profFlag) { profiler_start(globalMethod->totalChildrenClicks, 1); }#endif OUT(0xFF); OUT(0xD0|r); debug(("call %s\n", regname(r)));#if defined(KAFFE_PROFILER) if (profFlag) { profiler_end(globalMethod->totalChildrenClicks, 1); }#endif}define_insn(call_indirect_const, call_ind_xCC){ int m = const_int(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); assert(const_int(2) == ba);#if defined(KAFFE_PROFILER) if (profFlag) { profiler_start(globalMethod->totalChildrenClicks, 1); }#endif WOUT(0x15FF); LOUT(m); debug(("call *%x\n", m));#if defined(KAFFE_PROFILER) if (profFlag) { profiler_end(globalMethod->totalChildrenClicks, 1); }#endif}define_insn(push_int, push_xRC){ int r; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); if (inRegister(1, Rint|Rref)) { r = rreg_int(1); OUT(0x50|r); debug(("pushl %s\n", regname(r))); } else { r = rslot_int(1); OUT(0xFF); OUT(0xB5); LOUT(r); debug(("pushl %d(ebp)\n", r)); }}define_insn(push_float, fpush_xRC){ int r = rreg_int(1); /* Move the float into a register */ debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x50|r); debug(("pushl %s\n", regname(r)));}define_insn(push_double, fpushl_xRC){ int o = rslot_double(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0xFF); OUT(0xB0|REG_ebp); LOUT(o+4); debug(("pushl %d(ebp)\n", (o+4))); OUT(0xFF); OUT(0xB0|REG_ebp); LOUT(o); debug(("pushl %d(ebp)\n", o));}define_insn(popargs, popargs_xxC){ int o = const_int(2); o *= 4; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x81); OUT(0xC0|REG_esp); LOUT(o); debug(("addl %d,esp\n", o));}define_insn(return_int, return_Rxx){ debug(("instr\t%s\n",__PRETTY_FUNCTION__));DBG(REGFORCE, dprintf ("return_int()\n"); ); set_slot_register(seq_dst(s), REG_eax, Rint);}define_insn(return_long, returnl_Rxx){ debug(("instr\t%s\n",__PRETTY_FUNCTION__));DBG(REGFORCE, dprintf ("return_long()\n"); ); set_slot_register(seq_dst(s), REG_eax, Rint); set_slot_register(seq_dst(s)+1, REG_edx, Rint);}define_insn(return_float, freturn_Rxx){ debug(("instr\t%s\n",__PRETTY_FUNCTION__));DBG(REGFORCE, dprintf ("return_float()\n"); ); set_slot_register(seq_dst(s), REG_flt0, Rfloat);}define_insn(return_double, freturnl_Rxx){ debug(("instr\t%s\n",__PRETTY_FUNCTION__));DBG(REGFORCE, dprintf ("return_double()\n"); ); set_slot_register(seq_dst(s), REG_dbl0, Rdouble);}define_insn(returnarg_int, returnarg_xxR){ int r; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); r = rreg_int(2); do_move_int(REG_eax, r);}define_insn(returnarg_long, returnargl_xxR){ REGSLOT* r; int r1; int r2; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); r = seq_slot(s, 2); r1 = _slowSlotRegister(r, Rint, rread); r2 = _slowSlotRegister(r+1, Rint, rread); /* Return long is a bit complicated since part of the source may * be the destination. */ if (REG_eax != r2) { do_move_int(REG_eax, r1); do_move_int(REG_edx, r2); } else if (REG_edx != r1) { do_move_int(REG_edx, r2); do_move_int(REG_eax, r1); } else { /* r1 == REG_edx && r2 == REG_eax - swap */ OUT(0x87); OUT(0xC0|r1<<3|r2); }}define_insn(returnarg_float, freturnarg_xxR){ debug(("instr\t%s\n",__PRETTY_FUNCTION__)); /* Force value into float register */ rreg_float(2);}define_insn(returnarg_double, freturnargl_xxR){ debug(("instr\t%s\n",__PRETTY_FUNCTION__)); /* Force value into double register */ rreg_double(2);}/* --------------------------------------------------------------------- */define_insn(add_int_const, add_RRC){ int rw; int v; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); check_reg_01(); v = const_int(2); rw = rwreg_int(0); OUT(0x81); OUT(0xC0|rw); LOUT(v); debug(("addl #%d,%s\n", v, regname(rw)));}define_insn(sub_int_const, sub_RRC){ int rw; int v; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); check_reg_01(); v = const_int(2); rw = rwreg_int(0); OUT(0x81); OUT(0xE8|rw); LOUT(v); debug(("subl #%d,%s\n", v, regname(rw)));}define_insn(load_offset_int, load_RRC){ int v = const_int(2); int r = rreg_int(1); int w = wreg_int(0); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); assert(r != REG_esp); OUT(0x8B); OUT(0x80|(w<<3)|r); LOUT(v); debug(("movl %d(%s),%s\n", v, regname(r), regname(w)));}define_insn(load_byte, loadb_RxR){ int r = rreg_int(2); int w = wreg_int(0); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x0F); OUT(0xBE); OUT(0x00|(w<<3)|r); if (r == REG_esp) { OUT(0x20|REG_esp); } debug(("movsb (%s),%s\n", regname(r), regname(w)));}define_insn(load_char, loadc_RxR){ int r = rreg_int(2); int w = wreg_int(0); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x0F); OUT(0xB7); OUT(0x00|(w<<3)|r); if (r == REG_esp) { OUT(0x20|REG_esp); } debug(("movzw (%s),%s\n", regname(r), regname(w)));}define_insn(load_short, loads_RxR){ int r = rreg_int(2); int w = wreg_int(0); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x0F); OUT(0xBF); OUT(0x00|(w<<3)|r); if (r == REG_esp) { OUT(0x20|REG_esp); } debug(("movsw (%s),%s\n", regname(r), regname(w)));}define_insn(store_offset_int, store_xRRC){ int v; int r1; int r0; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); v = const_int(2); r0 = rreg_int(0); r1 = rreg_int(1); assert(r0 != REG_esp); OUT(0x89); OUT(0x80|(r0<<3)|r1); LOUT(v); debug(("movl %s,%d(%s)\n", regname(r0), v, regname(r1)));}define_insn(store_byte, storeb_xRR){ int r; int w; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); /* Can only store accumulators as bytes */ r = rreg_subint(2); /* If we cannot get the register into the subint * (it's probably global) then do it ourselves. */ if (r == NOREG) { r = rreg_int(2); safe_move_int(REG_eax, r); } w = rreg_int(1); OUT(0x88); OUT(0x00|(r<<3)|w); if (w == REG_esp) { OUT(0x20|REG_esp); } debug(("movb %s,(%s)\n", regname(r), regname(w)));}define_insn(store_short, stores_xRR){ int r = rreg_int(2); int w = rreg_int(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x66); OUT(0x89); OUT(0x00|(r<<3)|w); if (w == REG_esp) { OUT(0x20|REG_esp); } debug(("movw %s,(%s)\n", regname(r), regname(w)));}define_insn(cmp_int_const, cmp_xRC){ int r1 = rreg_int(1); int v = const_int(2); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x81); OUT(0xF8|r1); LOUT(v); debug(("cmpl #%d,%s\n", v, regname(r1)));}define_insn(push_int_const, push_xCC){ int v = const_int(1); debug(("instr\t%s\n",__PRETTY_FUNCTION__)); OUT(0x68); LOUT(v); debug(("pushl #%d\n", v));}define_insn(lshl_int_const, lshl_RRC){ int rw; int v; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); check_reg_01(); rw = rreg_int(0); v = const_int(2); OUT(0xC1); OUT(0xE0|rw); OUT(v); debug(("shll #%d,%s\n", v, regname(rw)));}define_insn(mon_enter, monenter_xxRCC){ Method* meth; label* l; int r; debug(("instr\t%s\n",__PRETTY_FUNCTION__)); meth = (Method*)const_int(3); l = const_label(4); clobberRegister(REG_eax); clobberRegister(REG_ecx); if (meth == 0) { r = rreg_int(2); OUT(0x8b); OUT(0x40|r); OUT(0x04; debug(("movl 0x4(REG),eax\n"))); OUT(0x85); OUT(0xc0; debug(("testl eax,eax\n"))); OUT(0x75); OUT(0x0b; debug(("jne 12 <start+12>\n")));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -