Fix merging two reference values

In this case, make the result of value type Object instead of unknown.
This commit is contained in:
Ilmir Usmanov
2020-06-09 01:28:34 +02:00
parent 5567033b33
commit 85e2392fef
9 changed files with 76 additions and 4 deletions
@@ -37,10 +37,6 @@ internal open class SpilledVariableFieldTypeValue(open var type: Type?, val insn
private class MergedSpilledVariableFieldTypeValue(
val values: Set<SpilledVariableFieldTypeValue>
) : SpilledVariableFieldTypeValue(null, null) {
init {
require(values.none { it is MergedSpilledVariableFieldTypeValue })
}
override var type: Type?
get() = values.first().type
set(newType) {
@@ -159,6 +155,13 @@ private class SpilledVariableFieldTypesInterpreter(
v != null && v.type == null -> w
w != null && w.type == null -> v
v?.type == w?.type -> v
v?.type?.sort == Type.OBJECT && w?.type?.sort == Type.OBJECT -> {
when {
v.type == AsmTypes.OBJECT_TYPE -> v
w.type == AsmTypes.OBJECT_TYPE -> w
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, v.insn)
}
}
else -> SpilledVariableFieldTypeValue(null, v?.insn ?: w?.insn)
}