From 43b0700c1019db0b55f534b8ee1abdc9c201d09b Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 9 Sep 2016 22:34:42 +0300 Subject: [PATCH] Fix bugs in propagating names via register allocator --- .../main/java/org/teavm/model/util/RegisterAllocator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/teavm/model/util/RegisterAllocator.java b/core/src/main/java/org/teavm/model/util/RegisterAllocator.java index ef2754bef..5203418f7 100644 --- a/core/src/main/java/org/teavm/model/util/RegisterAllocator.java +++ b/core/src/main/java/org/teavm/model/util/RegisterAllocator.java @@ -72,7 +72,9 @@ public class RegisterAllocator { String[] classNames = new String[maxClass]; for (int i = 0; i < categories.length; ++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); @@ -86,7 +88,7 @@ public class RegisterAllocator { for (int i = 0; i < colors.length; ++i) { Variable var = program.variableAt(i); 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) {