private void jsrJmp(Bytecode b) { b.addOpcode(Opcode.GOTO); jsrList.add(new int[] {b.currentPc(), var}); b.addIndex(0); }
/** * Appends CHECKCAST. * * @param classname a fully-qualified class name. */ public void addCheckcast(String classname) { addOpcode(CHECKCAST); addIndex(constPool.addClassInfo(classname)); }
/** * Appends ANEWARRAY. * * @param classname the qualified class name of the element type. */ public void addAnewarray(String classname) { addOpcode(ANEWARRAY); addIndex(constPool.addClassInfo(classname)); }
/** * Appends CHECKCAST. * * @param c the type. */ public void addCheckcast(CtClass c) { addOpcode(CHECKCAST); addIndex(constPool.addClassInfo(c)); }
/** * Appends INSTANCEOF. * * @param classname the class name. */ public void addInstanceof(String classname) { addOpcode(INSTANCEOF); addIndex(constPool.addClassInfo(classname)); }
/** * Appends NEW. * * @param clazz the class of the created instance. */ public void addNew(CtClass clazz) { addOpcode(NEW); addIndex(constPool.addClassInfo(clazz)); }
/** * Appends LDC2_W. The pushed item is a long value. */ public void addLdc2w(long l) { addOpcode(LDC2_W); addIndex(constPool.addLongInfo(l)); }
/** * Appends LDC2_W. The pushed item is a double value. */ public void addLdc2w(double d) { addOpcode(LDC2_W); addIndex(constPool.addDoubleInfo(d)); }
/** * Appends NEW. * * @param classname the fully-qualified class name. */ public void addNew(String classname) { addOpcode(NEW); addIndex(constPool.addClassInfo(classname)); }
private void atBreakStmnt(Stmnt st, boolean notCont) throws CompileError { if (st.head() != null) throw new CompileError( "sorry, not support labeled break or continue"); bytecode.addOpcode(Opcode.GOTO); Integer pc = new Integer(bytecode.currentPc()); bytecode.addIndex(0); if (notCont) breakList.add(pc); else continueList.add(pc); }
/** * Appends ICONST and ANEWARRAY. * * @param clazz the elememnt type. * @param length the array length. */ public void addAnewarray(CtClass clazz, int length) { addIconst(length); addOpcode(ANEWARRAY); addIndex(constPool.addClassInfo(clazz)); }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { bytecode.addOpcode(NEW); bytecode.addIndex(newIndex); bytecode.addOpcode(DUP); gen.atMethodCallCore(newType, MethodInfo.nameInit, args, false, true, -1, null); gen.setType(newType); }
/** * Appends MULTINEWARRAY. * * @param desc the type descriptor of the created array. * @param dim dimensions. * @return the value of <code>dim</code>. */ public int addMultiNewarray(String desc, int dim) { add(MULTIANEWARRAY); addIndex(constPool.addClassInfo(desc)); add(dim); growStack(1 - dim); return dim; }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (gen.getMethodArgsLength(args) != 1) throw new CompileError(Javac.proceedName + "() cannot take more than one parameter " + "for cast"); gen.atMethodArgs(args, new int[1], new int[1], new String[1]); bytecode.addOpcode(Opcode.CHECKCAST); bytecode.addIndex(index); gen.setType(retType); }
private void addInvokestatic(int clazz, String name, String desc, boolean isInterface) { add(INVOKESTATIC); int index; if (isInterface) index = constPool.addInterfaceMethodrefInfo(clazz, name, desc); else index = constPool.addMethodrefInfo(clazz, name, desc); addIndex(index); growStack(Descriptor.dataSize(desc)); }
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError { if (gen.getMethodArgsLength(args) != 1) throw new CompileError(Javac.proceedName + "() cannot take more than one parameter " + "for instanceof"); gen.atMethodArgs(args, new int[1], new int[1], new String[1]); bytecode.addOpcode(Opcode.INSTANCEOF); bytecode.addIndex(index); gen.setType(CtClass.booleanType); }
/** * Appends GETSTATIC. * * @param c the class * @param name the field name * @param type the descriptor of the field type. * * @see Descriptor#of(CtClass) */ public void addGetstatic(CtClass c, String name, String type) { add(GETSTATIC); int ci = constPool.addClassInfo(c); addIndex(constPool.addFieldrefInfo(ci, name, type)); growStack(Descriptor.dataSize(type)); }
/** * Appends GETFIELD. * * @param c the class. * @param name the field name. * @param type the descriptor of the field type. * * @see Descriptor#of(CtClass) */ public void addGetfield(CtClass c, String name, String type) { add(GETFIELD); int ci = constPool.addClassInfo(c); addIndex(constPool.addFieldrefInfo(ci, name, type)); growStack(Descriptor.dataSize(type) - 1); }
private void addPutstatic0(CtClass target, String classname, String fieldName, String desc) { add(PUTSTATIC); // target is null if it represents THIS. int ci = classname == null ? constPool.addClassInfo(target) : constPool.addClassInfo(classname); addIndex(constPool.addFieldrefInfo(ci, fieldName, desc)); growStack(-Descriptor.dataSize(desc)); }
private void addPutfield0(CtClass target, String classname, String name, String desc) { add(PUTFIELD); // target is null if it represents THIS. int ci = classname == null ? constPool.addClassInfo(target) : constPool.addClassInfo(classname); addIndex(constPool.addFieldrefInfo(ci, name, desc)); growStack(-1 - Descriptor.dataSize(desc)); }