/** * 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); }
/** * 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); }
/** * 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); }
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));
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);
RegisterSpec.makeLocalOptional(at, one, local.getLocalItem()); Insn insn = new PlainCstInsn(Rops.opMoveParam(one), pos, result, RegisterSpecList.EMPTY, CstInteger.make(at));
case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest);