fix for double, ong constants

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@284 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 33cb5ae627
commit 553b1a9e0f
  1. 14
      jode/jode/bytecode/GrowableConstantPool.java

@ -31,10 +31,10 @@ public class GrowableConstantPool extends ConstantPool {
public GrowableConstantPool () { public GrowableConstantPool () {
count = 1; count = 1;
tags = new int[1]; tags = new int[128];
indices1 = new int[1]; indices1 = new int[128];
indices2 = new int[1]; indices2 = new int[128];
constants = new Object[1]; constants = new Object[128];
} }
public final void grow(int wantedSize) { public final void grow(int wantedSize) {
@ -55,13 +55,13 @@ public class GrowableConstantPool extends ConstantPool {
} }
} }
public int putConstant(int tag, Object constant) { int putConstant(int tag, Object constant) {
String key = tag+"C"+constant; String key = tag+"C"+constant;
Integer index = (Integer) entryToIndex.get(key); Integer index = (Integer) entryToIndex.get(key);
if (index != null) if (index != null)
return index.intValue(); return index.intValue();
int newIndex = count; int newIndex = count;
grow(count+1); grow(count+(tag == DOUBLE || tag == LONG ? 2 : 1));
tags[newIndex] = tag; tags[newIndex] = tag;
constants[newIndex] = constant; constants[newIndex] = constant;
entryToIndex.put(key, new Integer(newIndex)); entryToIndex.put(key, new Integer(newIndex));
@ -71,7 +71,7 @@ public class GrowableConstantPool extends ConstantPool {
return newIndex; return newIndex;
} }
public int putIndexed(int tag, int index1, int index2) { int putIndexed(int tag, int index1, int index2) {
String key = tag+"I"+index1+","+index2; String key = tag+"I"+index1+","+index2;
Integer index = (Integer) entryToIndex.get(key); Integer index = (Integer) entryToIndex.get(key);
if (index != null) if (index != null)

Loading…
Cancel
Save