Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwagelaar2014-01-16 11:31:20 -0500
committerdwagelaar2014-01-16 11:31:20 -0500
commit3b3050be4511a2edb5a55f225fa3acedd4b3097f (patch)
tree88883a932b5d6c600b9b141c93e4ff215ef817d7 /plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse
parent0370afb3a78c13520a631d6f70798e5793e1e9cc (diff)
downloadorg.eclipse.atl-3b3050be4511a2edb5a55f225fa3acedd4b3097f.tar.gz
org.eclipse.atl-3b3050be4511a2edb5a55f225fa3acedd4b3097f.tar.xz
org.eclipse.atl-3b3050be4511a2edb5a55f225fa3acedd4b3097f.zip
425904: JIT compiler wrongly wraps byte arrays as a Sequence
https://bugs.eclipse.org/bugs/show_bug.cgi?id=425904
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java28
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java2
2 files changed, 16 insertions, 14 deletions
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
index 43d9fa1d..4fdb11e5 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/jit/ByteCodeSwitch.java
@@ -2135,20 +2135,22 @@ public class ByteCodeSwitch extends EmftvmSwitch<MethodVisitor> implements Opcod
}
} else if (cls.isArray()) {
final Class<?> cType = cls.getComponentType();
- // Array of cType
- final Label ifNull = new Label();
- dup(); // [..., array, array]
- ifnull(ifNull); // jump if array == null: [..., array]
if (Object.class.isAssignableFrom(cType)) {
- invokeStat(Arrays.class, "asList", List.class, Object[].class); // Arrays.asList(array): [..., list]
- } else {
- invokeStat(JITCodeBlock.class, "asList", List.class, cls); // JITCodeBlock.asList(array): [..., list]
- }
- new_(LazyListOnList.class); // new LazyListOnList: [..., list, lazylist]
- dup_x1(); // [..., lazylist, list, lazylist]
- swap(); // [..., lazylist, lazylist, list]
- invokeCons(LazyListOnList.class, List.class); // lazylist.<init>(list): [..., lazylist]
- label(ifNull);
+ // Array of cType
+ final Label ifNull = new Label();
+ dup(); // [..., array, array]
+ ifnull(ifNull); // jump if array == null: [..., array]
+ if (Object.class.isAssignableFrom(cType)) {
+ invokeStat(Arrays.class, "asList", List.class, Object[].class); // Arrays.asList(array): [..., list]
+ } else {
+ invokeStat(JITCodeBlock.class, "asList", List.class, cls); // JITCodeBlock.asList(array): [..., list]
+ }
+ new_(LazyListOnList.class); // new LazyListOnList: [..., list, lazylist]
+ dup_x1(); // [..., lazylist, list, lazylist]
+ swap(); // [..., lazylist, lazylist, list]
+ invokeCons(LazyListOnList.class, List.class); // lazylist.<init>(list): [..., lazylist]
+ label(ifNull);
+ } // don't wrap primitive type arrays
}
// [..., Object]
}
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
index 2e84a56f..692600e4 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
@@ -520,7 +520,7 @@ public final class EMFTVMUtil {
if (Object.class.isAssignableFrom(value.getClass().getComponentType())) {
return new LazyListOnList<Object>(Arrays.asList((Object[]) value));
} else {
- return value; // do wrap primitive type arrays
+ return value; // don't wrap primitive type arrays
}
}
assert eo == null || !(value instanceof Collection<?>);

Back to the top