Simplify generated code for rangeTo/concat intrinsics
The main reason is avoiding complicated operations like dup + dup_x2 + pop2 for instances obtained by NEW instruction. Otherwise it leads to problems in performRefinedTypeAnalysis because code there has a sensible assumption that NEW instances can be only dupped or stored into a local (rare cases) #KT-17457 Fixed
This commit is contained in:
@@ -116,10 +116,8 @@ class Concat : IntrinsicMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterReceiverGeneration(v: InstructionAdapter) {
|
||||
v.visitTypeInsn(Opcodes.NEW, "java/lang/StringBuilder")
|
||||
v.dupX1()
|
||||
v.swap()
|
||||
override fun afterReceiverGeneration(v: InstructionAdapter, frameMap: FrameMap) {
|
||||
v.generateNewInstanceDupAndPlaceBeforeStackTop(frameMap, AsmTypes.JAVA_STRING_TYPE, "java/lang/StringBuilder")
|
||||
v.invokespecial("java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V", false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user