aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMads Ager <ager@google.com>2017-08-17 11:45:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-08-17 11:45:26 +0000
commit30cdcb771dd839455be7415f5d4d0353e0e28146 (patch)
treee9330373001c40261e9f48d5212bf3f554cd0f69
parent23f3caa7a0c735be97aa61fb68eabf354362a3d3 (diff)
parent22ac34581e38b70ed3caac71c8081b50e0e6f985 (diff)
downloadr8-30cdcb771dd839455be7415f5d4d0353e0e28146.tar.gz
Merge "Allow Kotlin generated bytecode to be compiled."
-rw-r--r--src/main/java/com/android/tools/r8/ir/conversion/JarState.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/JarState.java b/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
index a6b1f2ce0..2a3e431e2 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
@@ -339,12 +339,19 @@ public class JarState {
}
private Local setLocalInfo(int index, Type type, DebugLocalInfo info) {
- return setLocalInfoForRegister(getLocalRegister(index, type), type, info);
+ return setLocalInfoForRegister(getLocalRegister(index, type), info);
}
- private Local setLocalInfoForRegister(int register, Type type, DebugLocalInfo info) {
+ private Local setLocalInfoForRegister(int register, DebugLocalInfo info) {
Local existingLocal = getLocalForRegister(register);
- Local local = new Local(existingLocal.slot, info);
+ // TODO(ager, zerny): Kotlin debug information contains locals that are not referenced.
+ // That seems broken and we currently do not retain that debug information because
+ // we do not let locals debug information influence code generation. Debug information can
+ // be completely malformed, so we shouldn't let it influence code generation. However, we
+ // need to deal with these unused locals in the debug information. For now we
+ // use a null type for the slot, but we should reconsider that.
+ Slot slot = existingLocal != null ? existingLocal.slot : new Slot(register, null);
+ Local local = new Local(slot, info);
locals[register] = local;
return local;
}