Revert "Revert "Fix merging two reference values""

This reverts commit 1cccceabb9.
This commit is contained in:
Ilmir Usmanov
2020-06-23 22:11:28 +02:00
parent a6f14c206b
commit c21820c615
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)
}