Fix bugs in propagating names via register allocator

This commit is contained in:
Alexey Andreev 2016-09-09 22:34:42 +03:00
parent 593dafdd73
commit 43b0700c10

View File

@ -72,7 +72,9 @@ public class RegisterAllocator {
String[] classNames = new String[maxClass]; String[] classNames = new String[maxClass];
for (int i = 0; i < categories.length; ++i) { for (int i = 0; i < categories.length; ++i) {
classCategories[classArray[i]] = categories[i]; classCategories[classArray[i]] = categories[i];
classNames[classArray[i]] = names[i]; if (names[i] != null) {
classNames[classArray[i]] = names[i];
}
} }
colorer.colorize(interferenceGraph, colors, classCategories, classNames); colorer.colorize(interferenceGraph, colors, classCategories, classNames);
@ -86,7 +88,7 @@ public class RegisterAllocator {
for (int i = 0; i < colors.length; ++i) { for (int i = 0; i < colors.length; ++i) {
Variable var = program.variableAt(i); Variable var = program.variableAt(i);
if (var.getDebugName() != null && var.getRegister() >= 0) { if (var.getDebugName() != null && var.getRegister() >= 0) {
namesByRegister[var.getRegister()] = var.getDebugName(); namesByRegister[var.getRegister()] = classNames[i];
} }
} }
for (int i = 0; i < colors.length; ++i) { for (int i = 0; i < colors.length; ++i) {