/** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; }
/** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; }
/** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public final InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; }
/** * Translate this node into a fresh instruction list. * The original instruction list is saved and restored. */ public final InstructionList compile(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; }
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
public void replaceCheckMethod() { ClassGen cg = cgs.get(AuthClass); Method method = cg.getMethods()[0]; MethodGen mg = new MethodGen(method, cg.getClassName(), cg.getConstantPool()); InstructionList list = new InstructionList(); list.append(new ICONST(1)); list.append(new IRETURN()); mg.removeExceptionHandlers(); mg.removeLineNumbers(); mg.removeLocalVariables(); mg.removeExceptions(); mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack(); cg.replaceMethod(method, mg.getMethod()); }
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
mg.setInstructionList(il); mg.setMaxLocals(); mg.setMaxStack();
public void fixPOPs() { for (ClassGen cg : cgs.values()) { int replaced = 0; for (Method method : cg.getMethods()) { //logger.debug("in method " + method.getName()); MethodGen mg = new MethodGen(method, cg.getClassName(), cg.getConstantPool()); InstructionList list = mg.getInstructionList(); if (list == null) { continue; } InstructionHandle[] handles = list.getInstructionHandles(); if (handles[0].getInstruction() instanceof DUP || handles[0].getInstruction() instanceof ASTORE || handles[0].getInstruction() instanceof POP) { handles[0].setInstruction(new NOP()); replaced++; } mg.setInstructionList(list); mg.removeNOPs(); mg.setMaxLocals(); mg.setMaxStack(); cg.replaceMethod(method, mg.getMethod()); } if (replaced > 0) { logger.debug("Removed " + replaced + " invalid POPs in " + cg.getClassName()); } } }
/** * BCEL-208: A couple of methods in MethodGen.java need to test for * an empty instruction list. */ public void testB208() throws ClassNotFoundException { final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME+".data.PLSETestClass"); final ClassGen gen = new ClassGen(clazz); final ConstantPoolGen pool = gen.getConstantPool(); final Method m = gen.getMethodAt(1); final MethodGen mg = new MethodGen(m, gen.getClassName(), pool); mg.setInstructionList(null); mg.addLocalVariable("local2", Type.INT, null, null); // currently, this will cause null pointer exception mg.getLocalVariableTable(pool); }
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
correct++; mgen.setInstructionList(list); mgen.setMaxLocals(); mgen.setMaxStack();
mg.setInstructionList(list); mg.setMaxLocals(); mg.setMaxStack();
mg.setInstructionList(list); mg.removeNOPs(); mg.setMaxLocals();
correct++; logger.debug("corrected exit flow in " + cg.getClassName() + "." + mgen.getName() + mgen.getSignature()); mgen.setInstructionList(list); mgen.setMaxLocals(); mgen.setMaxStack();
setName(method_name); setClassName(class_name); setInstructionList(il); setConstantPool(cp); final boolean abstract_ = isAbstract() || isNative();
handles[x + 3].setInstruction(nop); replaced++; mg.setInstructionList(list); mg.removeNOPs(); mg.setMaxLocals();
setName(method_name); setClassName(class_name); setInstructionList(il); setConstantPool(cp);