Pointers(int cur, int m, int m0, ExceptionTable et, CodeAttribute ca) { cursor = cur; mark = m; mark0 = m0; etable = et; // non null line = (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); vars = (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.tag); types = (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.typeTag); stack = (StackMapTable)ca.getAttribute(StackMapTable.tag); stack2 = (StackMap)ca.getAttribute(StackMap.tag); }
throw new CannotCompileException("no method body"); LocalVariableAttribute va = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.tag); if (va == null) {
Pointers(int cur, int m, int m0, ExceptionTable et, CodeAttribute ca) { cursor = cur; mark = m; mark0 = m0; etable = et; // non null line = (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); vars = (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.tag); types = (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.typeTag); stack = (StackMapTable)ca.getAttribute(StackMapTable.tag); stack2 = (StackMap)ca.getAttribute(StackMap.tag); }
throw new CannotCompileException("no method body"); LocalVariableAttribute va = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.tag); if (va == null) {
private static byte[] insertGapCore1(byte[] code, int where, int gapLength, boolean exclusive, ExceptionTable etable, CodeAttribute ca) throws BadBytecode, AlignmentException { int codeLength = code.length; byte[] newcode = new byte[codeLength + gapLength]; insertGap2(code, where, gapLength, codeLength, newcode, exclusive); etable.shiftPc(where, gapLength, exclusive); LineNumberAttribute na = (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); if (na != null) na.shiftPc(where, gapLength, exclusive); LocalVariableAttribute va = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.tag); if (va != null) va.shiftPc(where, gapLength, exclusive); LocalVariableAttribute vta = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.typeTag); if (vta != null) vta.shiftPc(where, gapLength, exclusive); StackMapTable smt = (StackMapTable)ca.getAttribute(StackMapTable.tag); if (smt != null) smt.shiftPc(where, gapLength, exclusive); StackMap sm = (StackMap)ca.getAttribute(StackMap.tag); if (sm != null) sm.shiftPc(where, gapLength, exclusive); return newcode; }
/** * Returns the line number of the source line corresponding to the specified * bytecode contained in this method. * * @param pos * the position of the bytecode (>= 0). an index into the code * array. * @return -1 if this information is not available. */ public int getLineNumber(int pos) { CodeAttribute ca = getCodeAttribute(); if (ca == null) return -1; LineNumberAttribute ainfo = (LineNumberAttribute)ca .getAttribute(LineNumberAttribute.tag); if (ainfo == null) return -1; return ainfo.toLineNumber(pos); }
private static byte[] insertGapCore1(byte[] code, int where, int gapLength, boolean exclusive, ExceptionTable etable, CodeAttribute ca) throws BadBytecode, AlignmentException { int codeLength = code.length; byte[] newcode = new byte[codeLength + gapLength]; insertGap2(code, where, gapLength, codeLength, newcode, exclusive); etable.shiftPc(where, gapLength, exclusive); LineNumberAttribute na = (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); if (na != null) na.shiftPc(where, gapLength, exclusive); LocalVariableAttribute va = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.tag); if (va != null) va.shiftPc(where, gapLength, exclusive); LocalVariableAttribute vta = (LocalVariableAttribute)ca.getAttribute( LocalVariableAttribute.typeTag); if (vta != null) vta.shiftPc(where, gapLength, exclusive); StackMapTable smt = (StackMapTable)ca.getAttribute(StackMapTable.tag); if (smt != null) smt.shiftPc(where, gapLength, exclusive); StackMap sm = (StackMap)ca.getAttribute(StackMap.tag); if (sm != null) sm.shiftPc(where, gapLength, exclusive); return newcode; }
/** * Returns the line number of the source line corresponding to the specified * bytecode contained in this method. * * @param pos * the position of the bytecode (>= 0). an index into the code * array. * @return -1 if this information is not available. */ public int getLineNumber(int pos) { CodeAttribute ca = getCodeAttribute(); if (ca == null) return -1; LineNumberAttribute ainfo = (LineNumberAttribute)ca .getAttribute(LineNumberAttribute.tag); if (ainfo == null) return -1; return ainfo.toLineNumber(pos); }
= (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.tag); if (va != null) va.shiftIndex(where, size); = (LocalVariableTypeAttribute)ca.getAttribute(LocalVariableTypeAttribute.tag); if (lvta != null) lvta.shiftIndex(where, size); StackMapTable smt = (StackMapTable)ca.getAttribute(StackMapTable.tag); if (smt != null) smt.insertLocal(where, StackMapTable.typeTagOf(typeDesc), classInfo); StackMap sm = (StackMap)ca.getAttribute(StackMap.tag); if (sm != null) sm.insertLocal(where, StackMapTable.typeTagOf(typeDesc), classInfo);
@Override public void scan(Object cls) { final MetadataAdapter md = getMetadataAdapter(); for (Object method : md.getMethods(cls)) { String key = md.getMethodFullKey(cls, method); if (acceptResult(key)) { LocalVariableAttribute table = (LocalVariableAttribute) ((MethodInfo) method).getCodeAttribute().getAttribute(LocalVariableAttribute.tag); int length = table.tableLength(); int i = Modifier.isStatic(((MethodInfo) method).getAccessFlags()) ? 0 : 1; //skip this if (i < length) { List<String> names = new ArrayList<String>(length - i); while (i < length) names.add(((MethodInfo) method).getConstPool().getUtf8Info(table.nameIndex(i++))); getStore().put(key, Joiner.on(", ").join(names)); } } } } }
@Override public void scan(Object cls) { final MetadataAdapter md = getMetadataAdapter(); for (Object method : md.getMethods(cls)) { String key = md.getMethodFullKey(cls, method); if (acceptResult(key)) { LocalVariableAttribute table = (LocalVariableAttribute) ((MethodInfo) method).getCodeAttribute().getAttribute(LocalVariableAttribute.tag); int length = table.tableLength(); int i = Modifier.isStatic(((MethodInfo) method).getAccessFlags()) ? 0 : 1; //skip this if (i < length) { List<String> names = new ArrayList<String>(length - i); while (i < length) names.add(((MethodInfo) method).getConstPool().getUtf8Info(table.nameIndex(i++))); getStore().put(key, Joiner.on(", ").join(names)); } } } } }
= (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.tag); if (va != null) va.shiftIndex(where, size); = (LocalVariableTypeAttribute)ca.getAttribute(LocalVariableTypeAttribute.tag); if (lvta != null) lvta.shiftIndex(where, size); StackMapTable smt = (StackMapTable)ca.getAttribute(StackMapTable.tag); if (smt != null) smt.insertLocal(where, StackMapTable.typeTagOf(typeDesc), classInfo); StackMap sm = (StackMap)ca.getAttribute(StackMap.tag); if (sm != null) sm.insertLocal(where, StackMapTable.typeTagOf(typeDesc), classInfo);
/** * Records parameter names if the LocalVariableAttribute is available. * It returns false unless the LocalVariableAttribute is available. * * @param numOfLocalVars the number of local variables used * for storing the parameters. * @return false if the CodeAttribute does not include a * LocalVariableAttribute. */ public boolean recordParamNames(CodeAttribute ca, int numOfLocalVars) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength(); for (int i = 0; i < n; ++i) { int index = va.index(i); if (index < numOfLocalVars) gen.recordVariable(va.descriptor(i), va.variableName(i), index, stable); } return true; }
/** * Records parameter names if the LocalVariableAttribute is available. * It returns false unless the LocalVariableAttribute is available. * * @param numOfLocalVars the number of local variables used * for storing the parameters. * @return false if the CodeAttribute does not include a * LocalVariableAttribute. */ public boolean recordParamNames(CodeAttribute ca, int numOfLocalVars) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength(); for (int i = 0; i < n; ++i) { int index = va.index(i); if (index < numOfLocalVars) gen.recordVariable(va.descriptor(i), va.variableName(i), index, stable); } return true; }
/** * Records local variables available at the specified program counter. * If the LocalVariableAttribute is not available, this method does not * record any local variable. It only returns false. * * @param pc program counter (>= 0) * @return false if the CodeAttribute does not include a * LocalVariableAttribute. */ public boolean recordLocalVariables(CodeAttribute ca, int pc) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength(); for (int i = 0; i < n; ++i) { int start = va.startPc(i); int len = va.codeLength(i); if (start <= pc && pc < start + len) gen.recordVariable(va.descriptor(i), va.variableName(i), va.index(i), stable); } return true; }
= (StackMapTable)iterator.get().getAttribute(StackMapTable.tag); if (smt != null) smt.removeNew(pos); = (StackMap)iterator.get().getAttribute(StackMap.tag); if (sm != null) sm.removeNew(pos);
/** * Records local variables available at the specified program counter. * If the LocalVariableAttribute is not available, this method does not * record any local variable. It only returns false. * * @param pc program counter (>= 0) * @return false if the CodeAttribute does not include a * LocalVariableAttribute. */ public boolean recordLocalVariables(CodeAttribute ca, int pc) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength(); for (int i = 0; i < n; ++i) { int start = va.startPc(i); int len = va.codeLength(i); if (start <= pc && pc < start + len) gen.recordVariable(va.descriptor(i), va.variableName(i), va.index(i), stable); } return true; }
= (StackMapTable)iterator.get().getAttribute(StackMapTable.tag); if (smt != null) smt.removeNew(pos); = (StackMap)iterator.get().getAttribute(StackMap.tag); if (sm != null) sm.removeNew(pos);
= (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); if (ainfo == null) throw new CannotCompileException("no line number info");
= (LineNumberAttribute)ca.getAttribute(LineNumberAttribute.tag); if (ainfo == null) throw new CannotCompileException("no line number info");