/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new PlainCstInsn(getOpcode(), getPosition(), getResult().withOffset(delta), getSources().withOffset(delta), getConstant()); }
/** {@inheritDoc} */ @Override public Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources) { return new PlainCstInsn(getOpcode(), getPosition(), result, sources, getConstant()); } }
SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); int ropOpcode = rop.getOpcode(); DalvInsn di; RegisterSpec dest = insn.getResult(); int param = ((CstInteger) insn.getConstant()).getValue(); RegisterSpec source = RegisterSpec.make(regCount - paramSize + param, di = new CstInsn(opcode, pos, regs, insn.getConstant()); addOutput(di);
/** * Assigns registers to locals. From the spec: * "the N arguments to a method land in the last N registers of the * method's invocation frame, in order. Wide arguments consume two * registers. Instance methods are passed a this reference as their * first argument." * * In addition to assigning registers to each of the locals, this creates * instructions to move parameters into their initial registers. These * instructions are inserted before the code's first real instruction. */ void initializeLocals() { if (localsInitialized) { throw new AssertionError(); } localsInitialized = true; int reg = 0; for (Local<?> local : locals) { reg += local.initialize(reg); } int firstParamReg = reg; List<Insn> moveParameterInstructions = new ArrayList<Insn>(); for (Local<?> local : parameters) { CstInteger paramConstant = CstInteger.make(reg - firstParamReg); reg += local.initialize(reg); moveParameterInstructions.add(new PlainCstInsn(Rops.opMoveParam(local.type.ropType), sourcePosition, local.spec(), RegisterSpecList.EMPTY, paramConstant)); } labels.get(0).instructions.addAll(0, moveParameterInstructions); }
@Override public void visitPlainCstInsn(PlainCstInsn insn) { if (insn.getOpcode().getOpcode()== RegOps.MOVE_PARAM) { int param = ((CstInteger) insn.getConstant()).getValue(); paramsAreInOrder[0] = paramsAreInOrder[0] && ((initialRegCount - paramSize + param) == insn.getResult().getReg()); } } });
/** {@inheritDoc} */ @Override public Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources) { return new PlainCstInsn(getOpcode(), getPosition(), result, sources, getConstant()); } }
SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); int ropOpcode = rop.getOpcode(); DalvInsn di; RegisterSpec dest = insn.getResult(); int param = ((CstInteger) insn.getConstant()).getValue(); RegisterSpec source = RegisterSpec.make(regCount - paramSize + param, di = new CstInsn(opcode, pos, regs, insn.getConstant()); addOutput(di);
/** * Copies the constant value {@code value} to {@code target}. The constant * must be a primitive, String, Class, TypeId, or null. */ public <T> void loadConstant(Local<T> target, T value) { Rop rop = value == null ? Rops.CONST_OBJECT_NOTHROW : Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
@Override public void visitPlainCstInsn(PlainCstInsn insn) { if (insn.getOpcode().getOpcode()== RegOps.MOVE_PARAM) { int param = ((CstInteger) insn.getConstant()).getValue(); paramsAreInOrder[0] = paramsAreInOrder[0] && ((initialRegCount - paramSize + param) == insn.getResult().getReg()); } } });
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new PlainCstInsn(getOpcode(), getPosition(), getResult().withOffset(delta), getSources().withOffset(delta), getConstant()); }
/** {@inheritDoc} */ @Override public Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources) { return new PlainCstInsn(getOpcode(), getPosition(), result, sources, getConstant()); } }
SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); int ropOpcode = rop.getOpcode(); DalvInsn di; RegisterSpec dest = insn.getResult(); int param = ((CstInteger) insn.getConstant()).getValue(); RegisterSpec source = RegisterSpec.make(regCount - paramSize + param, di = new CstInsn(opcode, pos, regs, insn.getConstant()); addOutput(di);
/** * Assigns registers to locals. From the spec: "the N arguments to a method land in the last N registers of the method's invocation frame, in order. Wide arguments consume two registers. Instance methods are passed a this reference as their first argument." * * In addition to assigning registers to each of the locals, this creates instructions to move parameters into their initial registers. These instructions are inserted before the code's first real instruction. */ void initializeLocals() { if (localsInitialized) { throw new AssertionError(); } localsInitialized = true; int reg = 0; for (Local<?> local : locals) { reg += local.initialize(reg); } int firstParamReg = reg; List<Insn> moveParameterInstructions = new ArrayList<Insn>(); for (Local<?> local : parameters) { CstInteger paramConstant = CstInteger.make(reg - firstParamReg); reg += local.initialize(reg); moveParameterInstructions.add(new PlainCstInsn(Rops.opMoveParam(local.type.ropType), sourcePosition, local.spec(), RegisterSpecList.EMPTY, paramConstant)); } labels.get(0).instructions.addAll(0, moveParameterInstructions); }
@Override public void visitPlainCstInsn(PlainCstInsn insn) { if (insn.getOpcode().getOpcode()== RegOps.MOVE_PARAM) { int param = ((CstInteger) insn.getConstant()).getValue(); paramsAreInOrder[0] = paramsAreInOrder[0] && ((initialRegCount - paramSize + param) == insn.getResult().getReg()); } } });
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new PlainCstInsn(getOpcode(), getPosition(), getResult().withOffset(delta), getSources().withOffset(delta), getConstant()); }
/** {@inheritDoc} */ @Override public Insn withNewRegisters(RegisterSpec result, RegisterSpecList sources) { return new PlainCstInsn(getOpcode(), getPosition(), result, sources, getConstant()); } }
SourcePosition pos = insn.getPosition(); Dop opcode = RopToDop.dopFor(insn); Rop rop = insn.getOpcode(); int ropOpcode = rop.getOpcode(); DalvInsn di; RegisterSpec dest = insn.getResult(); int param = ((CstInteger) insn.getConstant()).getValue(); RegisterSpec source = RegisterSpec.make(regCount - paramSize + param, di = new CstInsn(opcode, pos, regs, insn.getConstant()); addOutput(di);
/** * Assigns registers to locals. From the spec: * "the N arguments to a method land in the last N registers of the * method's invocation frame, in order. Wide arguments consume two * registers. Instance methods are passed a this reference as their * first argument." * * In addition to assigning registers to each of the locals, this creates * instructions to move parameters into their initial registers. These * instructions are inserted before the code's first real instruction. */ void initializeLocals() { if (localsInitialized) { throw new AssertionError(); } localsInitialized = true; int reg = 0; for (Local<?> local : locals) { reg += local.initialize(reg); } int firstParamReg = reg; List<Insn> moveParameterInstructions = new ArrayList<Insn>(); for (Local<?> local : parameters) { CstInteger paramConstant = CstInteger.make(reg - firstParamReg); reg += local.initialize(reg); moveParameterInstructions.add(new PlainCstInsn(Rops.opMoveParam(local.type.ropType), sourcePosition, local.spec(), RegisterSpecList.EMPTY, paramConstant)); } labels.get(0).instructions.addAll(0, moveParameterInstructions); }
@Override public void visitPlainCstInsn(PlainCstInsn insn) { if (insn.getOpcode().getOpcode()== RegOps.MOVE_PARAM) { int param = ((CstInteger) insn.getConstant()).getValue(); paramsAreInOrder[0] = paramsAreInOrder[0] && ((initialRegCount - paramSize + param) == insn.getResult().getReg()); } } });
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new PlainCstInsn(getOpcode(), getPosition(), getResult().withOffset(delta), getSources().withOffset(delta), getConstant()); }