/** * Constructs a constant pool table. * * @param thisclass the name of the class using this constant * pool table */ public ConstPool(String thisclass) { items = new LongVector(); itemsCache = null; numOfItems = 0; addItem0(null); // index 0 is reserved by the JVM. thisClassInfo = addClassInfo(thisclass); }
private int addItem0(ConstInfo info) { items.addElement(info); return numOfItems++; }
ConstInfo getItem(int n) { return items.elementAt(n); }
private void read(DataInputStream in) throws IOException { int n = in.readUnsignedShort(); items = new LongVector(n); numOfItems = 0; addItem(null); // index 0 is reserved by the JVM. while (--n > 0) { // index 0 is reserved by JVM int tag = readOne(in); if ((tag == LongInfo.tag) || (tag == DoubleInfo.tag)) { addItem(new ConstInfoPadding()); --n; } } int i = 1; while (true) { ConstInfo info = items.elementAt(i++); if (info == null) break; else info.makeHashtable(this); } }
private void read(DataInputStream in) throws IOException { int n = in.readUnsignedShort(); items = new LongVector(n); numOfItems = 0; addItem(null); // index 0 is reserved by the JVM. while (--n > 0) { // index 0 is reserved by JVM int tag = readOne(in); if ((tag == LongInfo.tag) || (tag == DoubleInfo.tag)) { addItem(new ConstInfoPadding()); --n; } } int i = 1; while (true) { ConstInfo info = (ConstInfo)items.elementAt(i++); if (info == null) break; else info.makeHashtable(this); } }
ConstInfo getItem(int n) { return items.elementAt(n); }
private int addItem0(ConstInfo info) { items.addElement(info); return numOfItems++; }
private void read(DataInputStream in) throws IOException { int n = in.readUnsignedShort(); items = new LongVector(n); numOfItems = 0; addItem0(null); // index 0 is reserved by the JVM. while (--n > 0) { // index 0 is reserved by JVM int tag = readOne(in); if ((tag == LongInfo.tag) || (tag == DoubleInfo.tag)) { addConstInfoPadding(); --n; } } }
private static HashMap makeItemsCache(LongVector items) { HashMap cache = new HashMap(); int i = 1; while (true) { ConstInfo info = items.elementAt(i++); if (info == null) break; else cache.put(info, info); } return cache; }
private int addItem(ConstInfo info) { if (itemsCache == null) itemsCache = makeItemsCache(items); ConstInfo found = (ConstInfo)itemsCache.get(info); if (found != null) return found.index; else { items.addElement(info); itemsCache.put(info, info); return numOfItems++; } }
/** * Constructs a constant pool table. * * @param thisclass the name of the class using this constant * pool table */ public ConstPool(String thisclass) { items = new LongVector(); itemsCache = null; numOfItems = 0; addItem0(null); // index 0 is reserved by the JVM. thisClassInfo = addClassInfo(thisclass); }
/** * Prints the contents of the constant pool table. */ public void print(PrintWriter out) { int size = numOfItems; for (int i = 1; i < size; ++i) { out.print(i); out.print(" "); items.elementAt(i).print(out); } } }
private int addItem(ConstInfo info) { if (itemsCache == null) itemsCache = makeItemsCache(items); ConstInfo found = itemsCache.get(info); if (found != null) return found.index; items.addElement(info); itemsCache.put(info, info); return numOfItems++; }
private void read(DataInputStream in) throws IOException { int n = in.readUnsignedShort(); items = new LongVector(n); numOfItems = 0; addItem0(null); // index 0 is reserved by the JVM. while (--n > 0) { // index 0 is reserved by JVM int tag = readOne(in); if ((tag == LongInfo.tag) || (tag == DoubleInfo.tag)) { addConstInfoPadding(); --n; } } }
private static Map<ConstInfo,ConstInfo> makeItemsCache(LongVector items) { Map<ConstInfo,ConstInfo> cache = new HashMap<ConstInfo,ConstInfo>(); int i = 1; while (true) { ConstInfo info = items.elementAt(i++); if (info == null) break; cache.put(info, info); } return cache; }
private int addItem0(ConstInfo info) { items.addElement(info); return numOfItems++; }
/** * Constructs a constant pool table. * * @param thisclass the name of the class using this constant * pool table */ public ConstPool(String thisclass) { items = new LongVector(); numOfItems = 0; addItem(null); // index 0 is reserved by the JVM. classes = new HashMap(); strings = new HashMap(); thisClassInfo = addClassInfo(thisclass); }
/** * Writes the contents of the constant pool table. */ public void write(DataOutputStream out) throws IOException { out.writeShort(numOfItems); LongVector v = items; int size = numOfItems; for (int i = 1; i < size; ++i) v.elementAt(i).write(out); }
private int addItem0(ConstInfo info) { items.addElement(info); return numOfItems++; }
/** * Constructs a constant pool table. * * @param thisclass the name of the class using this constant * pool table */ public ConstPool(String thisclass) { items = new LongVector(); numOfItems = 0; addItem(null); // index 0 is reserved by the JVM. classes = new HashMap(); strings = new HashMap(); constInfoCache = new ConstInfo[CACHE_SIZE]; constInfoIndexCache = new int[CACHE_SIZE]; thisClassInfo = addClassInfo(thisclass); }