/** * Load this item to a general purpose register. * * @param ec */ final void loadToGPR(EmitterContext ec) { if (!isGPR()) { X86Register r = ec.getGPRPool().request(JvmType.INT); if (r == null) { ec.getVStack().push(ec); r = ec.getGPRPool().request(JvmType.INT); } if (VmUtils.verifyAssertions()) VmUtils._assert(r != null, "r != null"); loadTo(ec, (X86Register.GPR) r); } }
/** * Load this item into a register that is suitable for BITS8 mode. * * @param ec */ final void loadToBITS8GPR(EmitterContext ec) { if (!isGPR() || !gpr.isSuitableForBits8()) { final X86RegisterPool pool = ec.getGPRPool(); X86Register r = pool.request(JvmType.INT, this, true); if (r == null) { ec.getVStack().push(ec); r = ec.getGPRPool().request(JvmType.INT, this, true); } if (VmUtils.verifyAssertions()) VmUtils._assert(r != null, "r != null"); loadTo(ec, (X86Register.GPR) r); } }
/** @see org.jnode.vm.x86.compiler.l1a.Item#load(EmitterContext) */ final void load(EmitterContext ec) { if (!isGPR()) { final X86RegisterPool pool = ec.getGPRPool(); X86Register r = pool.request(getType(), this); if (r == null) { final VirtualStack vstack = ec.getVStack(); vstack.push(ec); r = pool.request(getType(), this); } if (VmUtils.verifyAssertions()) VmUtils._assert(r != null, "r != null"); loadTo(ec, (X86Register.GPR) r); } if (VmUtils.verifyAssertions()) { verifyState(ec); } }
/** * @see org.jnode.vm.x86.compiler.l1a.Item#spill(EmitterContext, * org.jnode.assembler.x86.X86Register) */ final void spill(EmitterContext ec, X86Register reg) { if (VmUtils.verifyAssertions()) { VmUtils._assert( isGPR() && (this.gpr.getNr() == reg.getNr()), "spill1 gpr=" + gpr + ", reg=" + reg); } final X86RegisterPool pool = ec.getGPRPool(); X86Register r = pool.request(getType()); if (r == null) { ec.getVStack().push(ec); if (getKind() == Kind.STACK) { return; } r = pool.request(getType()); if (VmUtils.verifyAssertions()) VmUtils._assert(r != null, "r != null"); } loadTo(ec, (X86Register.GPR) r); pool.transferOwnerTo(r, this); if (VmUtils.verifyAssertions()) { verifyState(ec); } }
/** * Load item into the given register (only for Category 1 items), if its kind matches the mask. * * @param ec * @param mask * @param t0 the destination register */ final void loadToIf(EmitterContext ec, int mask, X86Register.GPR t0) { if ((getKind() & mask) > 0) loadTo(ec, t0); }