Ent ent = get(o);
if(ent != null) return ent;
- if(nextIndex == 65536) throw new ClassGen.Exn("constant pool full");
-
if(o instanceof Type.Object) {
CPRefEnt ce = new CPRefEnt(7);
ce.e1 = addUtf8(((Type.Object)o).internalForm());
throw new IllegalArgumentException("Unknown type passed to add");
}
- ent.index = nextIndex++;
- if(ent instanceof LongEnt) nextIndex++;
+ int spaces = ent instanceof LongEnt ? 2 : 1;
+
+ if(nextIndex + spaces > 65536) throw new ClassGen.Exn("constant pool full");
+
+ ent.index = nextIndex;
+ nextIndex += spaces;
count++;
entries.put(o,ent);
p += 1 + 3 + 4; // opcode itself, padding, default
if(op == TABLESWITCH) p += 4 + 4 + targets.length * 4; // lo, hi, targets
else p += 4 + targets.length * 4 * 2; // count, key,val * targets
+ if(op == LOOKUPSWITCH) {
+ int[] vals = ((LSI)si).vals;
+ for(j=1;j<vals.length;j++)
+ if(vals[j] <= vals[j-1])
+ throw new IllegalStateException("out of order/duplicate lookupswitch values");
+ }
break;
}
case LDC: