From 8e8d0c0cb581b3589370e13b31102d94013d9d9d Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 4 Jul 2005 00:29:20 +0000 Subject: [PATCH] fix totally broken jssa array handling darcs-hash:20050704002920-24bed-708cf21e487ce9a97b9f3c6916dbf1eb10b42f00.gz --- src/org/ibex/classgen/ConstantPool.java | 4 +++- src/org/ibex/classgen/JSSA.java | 18 ++++++++++++++++-- src/org/ibex/classgen/Type.java | 4 ++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/org/ibex/classgen/ConstantPool.java b/src/org/ibex/classgen/ConstantPool.java index bdfddf0..f3fbdf0 100644 --- a/src/org/ibex/classgen/ConstantPool.java +++ b/src/org/ibex/classgen/ConstantPool.java @@ -85,7 +85,9 @@ class ConstantPool implements CGConst { ClassEnt(String s) { this(); this.utf8 = (Utf8Ent) addUtf8(s); } void dump(DataOutput o) throws IOException { super.dump(o); o.writeShort(utf8.n); } Type.Class getTypeClass() { return (Type.Class) key(); } - Object _key() { return Type.Class.instance(utf8.s); } + Object _key() { + return Type.fromDescriptor(utf8.s.startsWith("[") ? utf8.s : "L" + utf8.s + ";"); + } void unref() { utf8.unref(); super.unref(); } public String toString() { return "[Class: " + utf8.s + "]"; } } diff --git a/src/org/ibex/classgen/JSSA.java b/src/org/ibex/classgen/JSSA.java index d584b53..b01d262 100644 --- a/src/org/ibex/classgen/JSSA.java +++ b/src/org/ibex/classgen/JSSA.java @@ -304,6 +304,18 @@ public class JSSA extends MethodGen implements CGConst { public NewArray(Type.Array t, Expr[] dims) { this.t = t; this.dims = dims; } public NewArray(Type.Array t, Expr dim) { this(t,new Expr[]{dim}); } public Type getType() { return t; } + public String _toString() { + Type base = t; + int totalDims = 0; + while(base.isArray()) { + totalDims++; + base = base.asArray().getElementType(); + } + StringBuffer sb = new StringBuffer("new " + base); + for(int i=0;i