summaryrefslogtreecommitdiffstats
path: root/src/main/javassist
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2013-08-26 02:46:32 +0900
committerScott Marlow <smarlow@redhat.com>2013-08-28 16:56:56 -0400
commit2f1ab1e1d16a56005b194e703efd1b05da906125 (patch)
treec39e7bafa30df97936d44908cc42e8c1d48a4474 /src/main/javassist
parent724a71564c931328aab8b821b6e24c07b7ac2724 (diff)
downloadjavassist-2f1ab1e1d16a56005b194e703efd1b05da906125.tar.gz
javassist-2f1ab1e1d16a56005b194e703efd1b05da906125.zip
fixed JASSIST-205
Diffstat (limited to 'src/main/javassist')
-rw-r--r--src/main/javassist/bytecode/stackmap/MapMaker.java15
-rw-r--r--src/main/javassist/bytecode/stackmap/TypeData.java9
2 files changed, 20 insertions, 4 deletions
diff --git a/src/main/javassist/bytecode/stackmap/MapMaker.java b/src/main/javassist/bytecode/stackmap/MapMaker.java
index b1aa7008..a9ff1e08 100644
--- a/src/main/javassist/bytecode/stackmap/MapMaker.java
+++ b/src/main/javassist/bytecode/stackmap/MapMaker.java
@@ -228,7 +228,8 @@ public class MapMaker extends Tracer {
private void mergeMap(TypedBlock dest, boolean mergeStack) throws BadBytecode {
int n = localsTypes.length;
for (int i = 0; i < n; i++)
- dest.localsTypes[i] = merge(localsTypes[i], dest.localsTypes[i]);
+ dest.localsTypes[i] = merge(validateTypeData(localsTypes, n, i),
+ dest.localsTypes[i]);
if (mergeStack) {
n = stackTop;
@@ -290,7 +291,8 @@ public class MapMaker extends Tracer {
protected static int recordTypeData(int n, TypeData[] srcTypes, TypeData[] destTypes) {
int k = -1;
for (int i = 0; i < n; i++) {
- TypeData t = srcTypes[i];
+ // TypeData t = srcTypes[i];
+ TypeData t = validateTypeData(srcTypes, n, i);
destTypes[i] = t.join();
if (t != TOP)
k = i + 1; // t might be long or double.
@@ -304,6 +306,15 @@ public class MapMaker extends Tracer {
destTypes[i] = srcTypes[i];
}
+ private static TypeData validateTypeData(TypeData[] data, int length, int index) {
+ TypeData td = data[index];
+ if (td.is2WordType() && index + 1 < length)
+ if (data[index + 1] != TOP)
+ return TOP;
+
+ return td;
+ }
+
// Phase 1.5
/*
diff --git a/src/main/javassist/bytecode/stackmap/TypeData.java b/src/main/javassist/bytecode/stackmap/TypeData.java
index 363aa241..66199927 100644
--- a/src/main/javassist/bytecode/stackmap/TypeData.java
+++ b/src/main/javassist/bytecode/stackmap/TypeData.java
@@ -157,6 +157,7 @@ public abstract class TypeData {
protected ArrayList usedBy; // reverse relations of lowers
protected ArrayList uppers; // upper bounds of this type.
protected String fixedType;
+ private boolean is2WordType; // cache
public TypeVar(TypeData t) {
uppers = null;
@@ -164,6 +165,7 @@ public abstract class TypeData {
usedBy = new ArrayList(2);
merge(t);
fixedType = null;
+ is2WordType = t.is2WordType();
}
public String getName() {
@@ -181,8 +183,10 @@ public abstract class TypeData {
}
public boolean is2WordType() {
- if (fixedType == null)
- return ((TypeData)lowers.get(0)).is2WordType();
+ if (fixedType == null) {
+ return is2WordType;
+ // return ((TypeData)lowers.get(0)).is2WordType();
+ }
else
return false;
}
@@ -319,6 +323,7 @@ public abstract class TypeData {
TypeVar cv = (TypeVar)scc.get(i);
cv.lowers.clear();
cv.lowers.add(kind);
+ is2WordType = kind.is2WordType();
}
}
else {