mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
First correct local variable mapping
This commit is contained in:
parent
36d76885a7
commit
8d0432dd5e
|
@ -65,4 +65,17 @@ public class Variable implements VariableReader {
|
|||
public void setDebugName(String debugName) {
|
||||
this.debugName = debugName;
|
||||
}
|
||||
|
||||
public void mergeDebugName(String otherDebugName) {
|
||||
if (otherDebugName == null) {
|
||||
return;
|
||||
}
|
||||
String[] parts = debugName != null ? debugName.split("\\|") : new String[0];
|
||||
for (String part : parts) {
|
||||
if (otherDebugName.equals(part)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
debugName = debugName != null ? debugName + "|" + otherDebugName : otherDebugName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,6 +214,15 @@ public class RegisterAllocator {
|
|||
varMap[tryCatch.getExceptionVariable().getIndex()]));
|
||||
}
|
||||
}
|
||||
String[] originalNames = new String[program.variableCount()];
|
||||
for (int i = 0; i < program.variableCount(); ++i) {
|
||||
Variable var = program.variableAt(i);
|
||||
originalNames[i] = var.getDebugName();
|
||||
var.setDebugName(null);
|
||||
}
|
||||
for (int i = 0; i < program.variableCount(); ++i) {
|
||||
program.variableAt(varMap[i]).mergeDebugName(originalNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void renameInterferenceGraph(List<MutableGraphNode> graph, DisjointSet classes, final int[] varMap) {
|
||||
|
|
|
@ -112,6 +112,9 @@ public class GlobalValueNumbering implements MethodOptimization {
|
|||
|
||||
for (int i = 0; i < map.length; ++i) {
|
||||
if (map[i] != i) {
|
||||
Variable var = program.variableAt(i);
|
||||
Variable mapVar = program.variableAt(map[i]);
|
||||
mapVar.mergeDebugName(var.getDebugName());
|
||||
program.deleteVariable(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,12 +175,14 @@ public class SSATransformer {
|
|||
int[] phiIndexes = phiIndexMap[successor];
|
||||
List<Phi> phis = program.basicBlockAt(successor).getPhis();
|
||||
for (int j = 0; j < phis.size(); ++j) {
|
||||
Phi phi = phis.get(j);
|
||||
Variable var = variableMap[phiIndexes[j]];
|
||||
if (var != null) {
|
||||
Incoming incoming = new Incoming();
|
||||
incoming.setSource(currentBlock);
|
||||
incoming.setValue(var);
|
||||
phis.get(j).getIncomings().add(incoming);
|
||||
phi.getIncomings().add(incoming);
|
||||
phi.getReceiver().mergeDebugName(var.getDebugName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,6 +391,16 @@ function $rt_s(index) {
|
|||
return $rt_stringPool_instance[index];
|
||||
}
|
||||
|
||||
function $dbg_repr(obj) {
|
||||
return obj.toString();
|
||||
}
|
||||
function $dbg_class(obj) {
|
||||
if (obj instanceof Long) {
|
||||
return "long";
|
||||
}
|
||||
return obj.constructor.$meta.name;
|
||||
}
|
||||
|
||||
Long = function(lo, hi) {
|
||||
this.lo = lo | 0;
|
||||
this.hi = hi | 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user