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 43d421e48..a065708fa 100644 --- a/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/dependency/DataFlowGraphBuilder.java @@ -62,15 +62,18 @@ public class DataFlowGraphBuilder implements InstructionReader { } IntegerArray startNodes = new IntegerArray(graph.size()); for (int i = paramCount; i < graph.size(); ++i) { - if (importantNodes.contains(i)) { - continue; - } - for (int pred : graph.incomingEdges(i)) { - classes.union(pred, i); - } if (graph.incomingEdgesCount(i) == 0) { startNodes.add(i); } + for (int pred : graph.incomingEdges(i)) { + if (importantNodes.contains(pred) && importantNodes.contains(i)) { + continue; + } + int newCls = classes.union(pred, i); + if (importantNodes.contains(pred)) { + importantNodes.add(newCls); + } + } } int[][] sccs = GraphUtils.findStronglyConnectedComponents(graph, startNodes.getAll()); diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java index 93820754c..cad81ed31 100644 --- a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java @@ -54,7 +54,11 @@ class DependencyGraphBuilder { resultNode = dep.getResult(); DependencyNode[] origNodes = dep.getVariables(); - int[] nodeMapping = new DataFlowGraphBuilder().buildMapping(program, dep.getParameterCount()); + DataFlowGraphBuilder dfgBuilder = new DataFlowGraphBuilder(); + for (int i = 0; i < dep.getParameterCount(); ++i) { + dfgBuilder.important(i); + } + int[] nodeMapping = dfgBuilder.buildMapping(program, dep.getParameterCount()); nodes = new DependencyNode[origNodes.length]; for (int i = 0; i < nodes.length; ++i) { nodes[i] = origNodes[nodeMapping[i]]; diff --git a/teavm-core/src/main/resources/org/teavm/tooling/test/res/junit-support.js b/teavm-core/src/main/resources/org/teavm/tooling/test/res/junit-support.js index 51c8b0d83..29e87ac6f 100644 --- a/teavm-core/src/main/resources/org/teavm/tooling/test/res/junit-support.js +++ b/teavm-core/src/main/resources/org/teavm/tooling/test/res/junit-support.js @@ -417,20 +417,14 @@ JUnitClient.run = function() { } JUnitClient.makeErrorMessage = function(message, e) { message.status = "exception"; - var stack = ""; - while (e instanceof TeaVMAsyncError) { - stack += e.message + "\n" + e.stack + "\n"; - e = e.cause; - } + var stack = e.stack; if (e.$javaException && e.$javaException.constructor.$meta) { message.exception = e.$javaException.constructor.$meta.name; message.stack = e.$javaException.constructor.$meta.name + ": "; var exceptionMessage = extractException(e.$javaException); message.stack += exceptionMessage ? $rt_ustr(exceptionMessage) : ""; - message.stack += e.stack + "\n" + stack; - } else { - message.stack = stack; } + message.stack += "\n" + stack; } JUnitClient.reportError = function(error) { var handler = window.addEventListener("message", function() {