Inline rematerializable safe call receivers.
This commit is contained in:
committed by
Dmitry Petrov
parent
1ff12b4cb6
commit
8bef05703e
+8
-11
@@ -6,17 +6,14 @@ IrFile /chainOfSafeCalls.kt
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=C? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp2_safe_receiver: C?
|
||||
BLOCK type=C? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: C?
|
||||
GET_VAR nc type=C? operator=null
|
||||
WHEN type=C? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .bar type=C? operator=null
|
||||
$this: CALL .foo type=C operator=null
|
||||
$this: GET_VAR tmp0_safe_receiver type=C? operator=null
|
||||
WHEN type=C? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .bar type=C? operator=null
|
||||
$this: CALL .foo type=C operator=null
|
||||
$this: GET_VAR nc type=C? operator=null
|
||||
WHEN type=C? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp2_safe_receiver type=C? operator=null
|
||||
|
||||
+7
-10
@@ -9,13 +9,10 @@ IrFile /dotQualified.kt
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR s type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR s type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR s type=kotlin.String? operator=null
|
||||
|
||||
+28
-37
@@ -13,16 +13,13 @@ IrFile /safeCallWithIncrementDecrement.kt
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.Int?
|
||||
$RECEIVER of: inc type=kotlin.Int?
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.Int? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .inc type=kotlin.Int operator=null
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.Int? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: $RECEIVER of: inc type=kotlin.Int?
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .inc type=kotlin.Int operator=null
|
||||
$this: $RECEIVER of: inc type=kotlin.Int?
|
||||
IrFunction public operator fun kotlin.Int?.get(/*0*/ index: kotlin.Int): kotlin.Int
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
@@ -34,38 +31,32 @@ IrFile /safeCallWithIncrementDecrement.kt
|
||||
IrFunction public fun testProperty(/*0*/ nc: test.C?): kotlin.Unit
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: test.C?
|
||||
GET_VAR nc type=test.C? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .<get-p> type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_safe_receiver type=test.C? operator=null
|
||||
CALL .<set-p> type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_safe_receiver type=test.C? operator=null
|
||||
value: CALL .inc type=kotlin.Int? operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .<get-p> type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
CALL .<set-p> type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
value: CALL .inc type=kotlin.Int? operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
IrFunction public fun testArrayAccess(/*0*/ nc: test.C?): kotlin.Unit
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
BLOCK type=kotlin.Int hasResult=true operator=POSTFIX_INCR
|
||||
VAR val tmp3_array: kotlin.Int?
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: test.C?
|
||||
GET_VAR nc type=test.C? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR tmp0_safe_receiver type=test.C? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
VAR val tmp4: kotlin.Int
|
||||
CALL .get type=kotlin.Int operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp3_array type=kotlin.Int? operator=null
|
||||
|
||||
+38
-53
@@ -5,71 +5,56 @@ IrFile /safeCalls.kt
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR x type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
IrFunction public fun test2(/*0*/ x: kotlin.String?): kotlin.Int?
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR x type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .hashCode type=kotlin.Int operator=null
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .hashCode type=kotlin.Int operator=null
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
IrFunction public fun test3(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.Any?): kotlin.Boolean?
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Boolean? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR x type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Boolean? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .equals type=kotlin.Boolean operator=null
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
other: GET_VAR y type=kotlin.Any? operator=null
|
||||
WHEN type=kotlin.Boolean? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .equals type=kotlin.Boolean operator=null
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
other: GET_VAR y type=kotlin.Any? operator=null
|
||||
IrFunction public fun test4(/*0*/ x: Ref?): kotlin.Unit
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
BLOCK type=kotlin.Unit? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: Ref?
|
||||
GET_VAR x type=Ref? operator=null
|
||||
WHEN type=kotlin.Unit? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=Ref? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<set-value> type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR tmp0_safe_receiver type=Ref? operator=null
|
||||
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||
WHEN type=kotlin.Unit? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=Ref? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<set-value> type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR x type=Ref? operator=null
|
||||
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||
IrFunction public fun IHost.test5(/*0*/ s: kotlin.String?): kotlin.Int?
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.Int? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR s type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .extLength type=kotlin.Int operator=null
|
||||
$this: $RECEIVER of: test5 type=IHost
|
||||
$receiver: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR s type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .extLength type=kotlin.Int operator=null
|
||||
$this: $RECEIVER of: test5 type=IHost
|
||||
$receiver: GET_VAR s type=kotlin.String? operator=null
|
||||
|
||||
+8
-11
@@ -28,14 +28,11 @@ IrFile /variableAsFunctionCall.kt
|
||||
IrExpressionBody
|
||||
BLOCK type=<no-type> hasResult=false operator=null
|
||||
RETURN type=<no-type>
|
||||
BLOCK type=kotlin.String? hasResult=true operator=SAFE_CALL
|
||||
VAR val tmp0_safe_receiver: kotlin.String?
|
||||
GET_VAR ns type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.String? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .invoke type=kotlin.String operator=null
|
||||
$this: CALL .k type=() -> kotlin.String operator=null
|
||||
$this: GET_VAR tmp0_safe_receiver type=kotlin.String? operator=null
|
||||
WHEN type=kotlin.String? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR ns type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .invoke type=kotlin.String operator=null
|
||||
$this: CALL .k type=() -> kotlin.String operator=null
|
||||
$this: GET_VAR ns type=kotlin.String? operator=null
|
||||
|
||||
Reference in New Issue
Block a user