com.sun.tools.javac.jvm
public class: Pool [javadoc |
source]
java.lang.Object
com.sun.tools.javac.jvm.Pool
An internal structure that corresponds to the constant pool of a classfile.
This is NOT part of any supported API.
If you write code that depends on this, you do so at your own risk.
This code and its internal interfaces are subject to change or
deletion without notice.
Field Summary |
---|
public static final int | MAX_ENTRIES | |
public static final int | MAX_STRING_LENGTH | |
int | pp | Index of next constant to be entered. |
Object[] | pool | The initial pool buffer. |
Map<Object, Integer> | indices | A hashtable containing all constants in the pool. |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from com.sun.tools.javac.jvm.Pool Detail: |
public int get(Object o) {
Integer n = indices.get(o);
return n == null ? -1 : n.intValue();
}
Return the given object's index in the pool,
or -1 if object is not in there. |
public int numEntries() {
return pp;
}
Return the number of entries in the constant pool. |
public int put(Object value) {
if (value instanceof MethodSymbol)
value = new Method((MethodSymbol)value);
else if (value instanceof VarSymbol)
value = new Variable((VarSymbol)value);
// assert !(value instanceof Type.TypeVar);
Integer index = indices.get(value);
if (index == null) {
// System.err.println("put " + value + " " + value.getClass());//DEBUG
index = pp;
indices.put(value, index);
if (pp == pool.length) doublePool();
pool[pp++] = value;
if (value instanceof Long || value instanceof Double) {
if (pp == pool.length) doublePool();
pool[pp++] = null;
}
}
return index.intValue();
}
Place an object in the pool, unless it is already there.
If object is a symbol also enter its owner unless the owner is a
package. Return the object's index in the pool. |
public void reset() {
pp = 1;
indices.clear();
}
Remove everything from this pool. |