Fix bug in DFG simplifier

This commit is contained in:
Alexey Andreev 2015-03-13 12:11:53 +04:00
parent cd0dd134cc
commit cc009ff9bd
3 changed files with 16 additions and 15 deletions

View File

@ -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());

View File

@ -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]];

View File

@ -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() {