added dropInfo

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1200 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 74f161a417
commit 47b22fdb21
  1. 5
      jode/jode/bytecode/BinaryInfo.java.in
  2. 8
      jode/jode/bytecode/BytecodeInfo.java.in
  3. 45
      jode/jode/bytecode/ClassInfo.java.in
  4. 6
      jode/jode/bytecode/FieldInfo.java
  5. 10
      jode/jode/bytecode/MethodInfo.java

@ -150,6 +150,11 @@ public class BinaryInfo {
} }
} }
public void dropInfo(int howMuch) {
if ((howMuch & UNKNOWNATTRIBS) != 0)
unknownAttributes = null;
}
protected void prepareAttributes(GrowableConstantPool gcp) { protected void prepareAttributes(GrowableConstantPool gcp) {
if (unknownAttributes == null) if (unknownAttributes == null)
return; return;

@ -1420,6 +1420,14 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
writeAttributes(gcp, output); writeAttributes(gcp, output);
} }
public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0) {
lvt = null;
lnt = null;
}
super.dropInfo(howMuch);
}
public int getSize() { public int getSize() {
/* maxStack: 2 /* maxStack: 2
* maxLocals: 2 * maxLocals: 2

@ -643,6 +643,51 @@ public class ClassInfo extends BinaryInfo {
} }
} }
/**
* This is the counter part to loadInfo. It will drop all info specified
* in howMuch and clean up the memory.
* @param howMuch tells how much info we should drop
*/
public void dropInfo(int howMuch) {
if ((status & howMuch) == 0)
return;
if (modified) {
System.err.println("Dropping info 0x"
+ Integer.toHexString(howMuch)
+ " (status 0x" + Integer.toHexString(status)
+ ") in class " + this);
Thread.dumpStack();
return;
}
howMuch &= status;
if ((howMuch & FIELDS) != 0) {
fields = null;
} else if ((status & FIELDS) != 0
&& (howMuch & (KNOWNATTRIBS | UNKNOWNATTRIBS)) != 0) {
for (int i=0; i < fields.length; i++)
fields[i].dropInfo(howMuch);
}
if ((howMuch & METHODS) != 0) {
methods = null;
} else if ((status & METHODS) != 0
&& (howMuch & (KNOWNATTRIBS | UNKNOWNATTRIBS)) != 0) {
for (int i=0; i < methods.length; i++)
methods[i].dropInfo(howMuch);
}
if ((howMuch & KNOWNATTRIBS) != 0)
sourceFile = null;
if ((howMuch & OUTERCLASSES) != 0)
outerClasses = null;
if ((howMuch & INNERCLASSES) != 0) {
innerClasses = null;
extraClasses = null;
}
super.dropInfo(howMuch);
status &= ~howMuch;
}
public String getName() { public String getName() {
return name; return name;
} }

@ -140,6 +140,12 @@ public class FieldInfo extends BinaryInfo {
writeAttributes(constantPool, output); writeAttributes(constantPool, output);
} }
public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0)
constant = null;
super.dropInfo(howMuch);
}
public String getName() { public String getName() {
return name; return name;
} }

@ -156,6 +156,16 @@ public class MethodInfo extends BinaryInfo {
writeAttributes(constantPool, output); writeAttributes(constantPool, output);
} }
public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0) {
bytecode = null;
exceptions = null;
}
if (bytecode != null)
bytecode.dropInfo(howMuch);
super.dropInfo(howMuch);
}
public ClassInfo getClazzInfo() { public ClassInfo getClazzInfo() {
return clazzInfo; return clazzInfo;
} }

Loading…
Cancel
Save