From 31f64396527a92c45a15ab86b859e98cd75bbd61 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 13 Mar 2015 14:26:36 +0400 Subject: [PATCH] Fix another bug in DFG simplifier. Fix long subtraction bug --- .../main/java/org/teavm/dependency/DataFlowGraphBuilder.java | 4 ++-- teavm-core/src/main/resources/org/teavm/javascript/runtime.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java b/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java index a065708fa..d71cec93d 100644 --- a/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java @@ -66,7 +66,7 @@ public class DataFlowGraphBuilder implements InstructionReader { startNodes.add(i); } for (int pred : graph.incomingEdges(i)) { - if (importantNodes.contains(pred) && importantNodes.contains(i)) { + if (importantNodes.contains(classes.find(pred)) && importantNodes.contains(classes.find(i))) { continue; } int newCls = classes.union(pred, i); @@ -80,7 +80,7 @@ public class DataFlowGraphBuilder implements InstructionReader { for (int[] scc : sccs) { int last = -1; for (int node : scc) { - if (!importantNodes.contains(node)) { + if (!importantNodes.contains(classes.find(node))) { continue; } last = last < 0 ? node : classes.union(node, last); diff --git a/teavm-core/src/main/resources/org/teavm/javascript/runtime.js b/teavm-core/src/main/resources/org/teavm/javascript/runtime.js index 797e95b19..b3629bfb5 100644 --- a/teavm-core/src/main/resources/org/teavm/javascript/runtime.js +++ b/teavm-core/src/main/resources/org/teavm/javascript/runtime.js @@ -605,7 +605,7 @@ function Long_toNumber(val) { return 0x100000000 * hi + lo; } function Long_add(a, b) { - if (a.hi === a.lo >> 31 && b.hi === b.lo >> 31) { + if (a.hi === (a.lo >> 31) && b.hi === (b.lo >> 31)) { return Long_fromNumber(a.lo + b.lo); } var a_lolo = a.lo & 0xFFFF; @@ -643,7 +643,7 @@ function Long_neg(a) { return Long_inc(new Long(a.lo ^ 0xFFFFFFFF, a.hi ^ 0xFFFFFFFF)); } function Long_sub(a, b) { - if (a.hi === 0 && a.lo >> 31 && b.hi === b.lo >> 31) { + if (a.hi === (a.lo >> 31) && b.hi === (b.lo >> 31)) { return Long_fromNumber(a.lo - b.lo); } var a_lolo = a.lo & 0xFFFF;