/** * 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); }
return CstFloat.make(Float.floatToIntBits((Float) value)); } else if (value instanceof Integer) { return CstInteger.make((Integer) value); } else if (value instanceof Long) { return CstLong.make((Long) value);
/** * 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),
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstString name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? name : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_STRING, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_STRING, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
return CstFloat.make(Float.floatToIntBits((Float) value)); } else if (value instanceof Integer) { return CstInteger.make((Integer) value); } else if (value instanceof Long) { return CstLong.make((Long) value);
return CstFloat.make(Float.floatToIntBits((Float) value)); } else if (value instanceof Integer) { return CstInteger.make((Integer) value); } else if (value instanceof Long) { return CstLong.make((Long) value);
return CstFloat.make(Float.floatToIntBits((Float) value)); } else if (value instanceof Integer) { return CstInteger.make((Integer) value); } else if (value instanceof Long) { return CstLong.make((Long) value);
/** * Constructs a standard {@code InnerClass} annotation. * * @param name {@code null-ok;} the original name of the class, or * {@code null} to represent an anonymous class * @param accessFlags the original access flags * @return {@code non-null;} the annotation */ public static Annotation makeInnerClass(CstUtf8 name, int accessFlags) { Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM); Constant nameCst = (name != null) ? new CstString(name) : CstKnownNull.THE_ONE; result.put(new NameValuePair(NAME_UTF, nameCst)); result.put(new NameValuePair(ACCESS_FLAGS_UTF, CstInteger.make(accessFlags))); result.setImmutable(); return result; }
CstInteger cst2 = CstInteger.make(-cst.getValue()); return cst2.fitsIn16Bits(); default:
CstInteger cst2 = CstInteger.make(-cst.getValue()); return cst2.fitsIn16Bits(); default:
CstInteger cst2 = CstInteger.make(-cst.getValue()); return cst2.fitsIn16Bits(); default:
if (opcode == RegOps.SUB && cst instanceof CstInteger) { opcode = RegOps.ADD; cst = CstInteger.make(-((CstInteger)cst).getValue());