public LocalVariableGen addLocalVariable2(String name, Type type, InstructionHandle start) { LocalVariableGen lvg = super.addLocalVariable(name, type, _slotAllocator.allocateSlot(type), start, null); getLocalVariableRegistry().registerLocalVariable(lvg); return lvg; }
/** * Allocates a local variable. If the slot allocator has already been * initialized, then call addLocalVariable2() so that the new variable * is known to the allocator. Failing to do this may cause the allocator * to return a slot that is already in use. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; }
/** * Adds a local variable to this method. * * @param name variable name * @param type variable type * @param slot the index of the local variable, if type is long or double, the next available * index is slot+2 * @param start from where the variable is valid * @param end until where the variable is valid * @return new local variable object * @see LocalVariable */ public LocalVariableGen addLocalVariable( final String name, final Type type, final int slot, final InstructionHandle start, final InstructionHandle end ) { return addLocalVariable(name, type, slot, start, end, slot); }
/** * Adds a local variable to this method and assigns an index automatically. * * @param name variable name * @param type variable type * @param start from where the variable is valid, if this is null, * it is valid from the start * @param end until where the variable is valid, if this is null, * it is valid to the end * @return new local variable object * @see LocalVariable */ public LocalVariableGen addLocalVariable( final String name, final Type type, final InstructionHandle start, final InstructionHandle end ) { return addLocalVariable(name, type, max_locals, start, end); }
/** * Adds a local variable to this method and assigns an index automatically. * * @param name variable name * @param type variable type * @param start from where the variable is valid, if this is null, * it is valid from the start * @param end until where the variable is valid, if this is null, * it is valid to the end * @return new local variable object * @see LocalVariable */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { return addLocalVariable(name, type, max_locals, start, end); }
private void JVMTools_allocateLocalVariable(Class vartype, String varname) { assert local_vars.get(varname) == null; LocalVariableGen lg = mg.addLocalVariable(varname, getObjectType(vartype), null, null); local_vars.put(varname, lg.getIndex()); lg.setStart(JVMTools_NOP()); }
public LocalVariableGen addLocalVariable2(String name, Type type, InstructionHandle start) { LocalVariableGen lvg = super.addLocalVariable(name, type, _slotAllocator.allocateSlot(type), start, null); getLocalVariableRegistry().registerLocalVariable(lvg); return lvg; }
public LocalVariableGen addLocalVariable2(String name, Type type, InstructionHandle start) { LocalVariableGen lvg = super.addLocalVariable(name, type, _slotAllocator.allocateSlot(type), start, null); getLocalVariableRegistry().registerLocalVariable(lvg); return lvg; }
public LocalVariableGen addLocalVariable2(String name, Type type, InstructionHandle start) { LocalVariableGen lvg = super.addLocalVariable(name, type, _slotAllocator.allocateSlot(type), start, null); getLocalVariableRegistry().registerLocalVariable(lvg); return lvg; }
/** * Allocates a local variable. If the slot allocator has already been * initialized, then call addLocalVariable2() so that the new variable * is known to the allocator. Failing to do this may cause the allocator * to return a slot that is already in use. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; }
/** * Allocates a local variable. If the slot allocator has already been * initialized, then call addLocalVariable2() so that the new variable * is known to the allocator. Failing to do this may cause the allocator * to return a slot that is already in use. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; }
/** * Allocates a local variable. If the slot allocator has already been * initialized, then call addLocalVariable2() so that the new variable * is known to the allocator. Failing to do this may cause the allocator * to return a slot that is already in use. */ public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) { LocalVariableGen lvg; if (_allocatorInit) { lvg = addLocalVariable2(name, type, start); } else { lvg = super.addLocalVariable(name, type, start, end); getLocalVariableRegistry().registerLocalVariable(lvg); } return lvg; }
addLocalVariable("this", ObjectType.getInstance(class_name), start, end); addLocalVariable(arg_names[i], arg_types[i], start, end);
private void updateLocalVariableTable(final LocalVariableTable a) { final LocalVariable[] lv = a.getLocalVariableTable(); removeLocalVariables(); for (final LocalVariable l : lv) { InstructionHandle start = il.findHandle(l.getStartPC()); final InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength()); // Repair malformed handles if (null == start) { start = il.getStart(); } // end == null => live to end of method // Since we are recreating the LocalVaraible, we must // propagate the orig_index to new copy. addLocalVariable(l.getName(), Type.getType(l.getSignature()), l .getIndex(), start, end, l.getOrigIndex()); } }
addLocalVariable("this", new ObjectType(class_name), start, end); addLocalVariable(arg_names[i], arg_types[i], start, end);
final LocalVariableGen clazz = read.addLocalVariable("clazz", sourceClassType, null, null); final int clazzIndex = clazz.getIndex(); clazz.setStart(il.append(new ASTORE(clazzIndex)));
/** * 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); }
LocalVariableGen mainclass_arg = tmpMg.addLocalVariable("mainclass_", new ObjectType(classname), null, null); InstructionHandle ih = tmpIl.append(InstructionFactory.createStore(new ObjectType(classname), mainclass_arg.getIndex()));
Type.VOID, new Type[] { new ObjectType("java.io.Reader") }, Const.INVOKESPECIAL)); LocalVariableGen lg = mg.addLocalVariable("in", new ObjectType( "java.io.BufferedReader"), null, null); final int in = lg.getIndex(); lg.setStart(il.append(new ASTORE(in))); // "in" valid from here lg = mg.addLocalVariable("name", Type.STRING, null, null); final int name = lg.getIndex(); il.append(InstructionConst.ACONST_NULL); final InstructionHandle try_end = il.append(g); final LocalVariableGen var_ex = mg.addLocalVariable("ex", Type .getType("Ljava.io.IOException;"), null, null); final int var_ex_slot = var_ex.getIndex();
addLocalVariable(l.getName(), Type.getType(l.getSignature()), l.getIndex(), start, end);