Skip to content

Commit bb6bb20

Browse files
mpiekutowskiSpace Team
authored andcommitted
[Test] Apply pre-processed inline functions handler to crossinlineLambdaAllocation test
^KT-80645
1 parent 897a628 commit bb6bb20

File tree

3 files changed

+161
-1
lines changed

3 files changed

+161
-1
lines changed

compiler/testData/codegen/box/inline/crossinlineLambdaAllocation.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// NO_COMMON_FILES
55
// DUMP_IR
66
// DUMP_IR_AFTER_INLINE
7+
// DUMP_IR_OF_PREPROCESSED_INLINE_FUNCTIONS
78

89
class Pair<T>(val first: T, val second: T)
910

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
Module: main
2+
// CallableId=/runTwice
3+
FUN name:runTwice visibility:public modality:FINAL returnType:<root>.Pair<kotlin.Any?> [inline]
4+
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
5+
VALUE_PARAMETER kind:Regular name:f index:0 type:kotlin.Function0<kotlin.Any?>
6+
BLOCK_BODY
7+
RETURN type=kotlin.Nothing from='public final fun runTwice <T> (f: kotlin.Function0<kotlin.Any?>): <root>.Pair<kotlin.Any?> [inline] declared in <root>'
8+
CONSTRUCTOR_CALL 'public constructor <init> (first: T of <root>.Pair, second: T of <root>.Pair) [primary] declared in <root>.Pair' type=<root>.Pair<kotlin.Any?> origin=null
9+
TYPE_ARG (of class) T: kotlin.Any?
10+
ARG first: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.Any? origin=INVOKE
11+
ARG <this>: GET_VAR 'f: kotlin.Function0<kotlin.Any?> declared in <root>.runTwice' type=kotlin.Function0<kotlin.Any?> origin=VARIABLE_AS_FUNCTION
12+
ARG second: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.Any? origin=INVOKE
13+
ARG <this>: GET_VAR 'f: kotlin.Function0<kotlin.Any?> declared in <root>.runTwice' type=kotlin.Function0<kotlin.Any?> origin=VARIABLE_AS_FUNCTION
14+
// CallableId=/bar
15+
FUN name:bar visibility:public modality:FINAL returnType:kotlin.Int [inline]
16+
VALUE_PARAMETER kind:Regular name:test index:0 type:kotlin.Function0<kotlin.Int> [crossinline]
17+
BLOCK_BODY
18+
VAR name:outsideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> [val]
19+
CONSTRUCTOR_CALL 'public constructor <init> (element: T of kotlin.internal.SharedVariableBox) [primary] declared in kotlin.internal.SharedVariableBox' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
20+
TYPE_ARG (of class) T: kotlin.Int
21+
ARG element: CONST Int type=kotlin.Int value=0
22+
VAR name:x type:<root>.Pair<<root>.bar.<no name provided>> [val]
23+
BLOCK type=<root>.Pair<<root>.bar.<no name provided>> origin=null
24+
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
25+
thisReceiver: VALUE_PARAMETER INSTANCE_RECEIVER kind:DispatchReceiver name:<this> type:<root>.bar.<no name provided>
26+
CONSTRUCTOR visibility:private returnType:<root>.bar.<no name provided> [primary]
27+
VALUE_PARAMETER BOUND_VALUE_PARAMETER kind:Regular name:$insideCounter index:0 type:kotlin.internal.SharedVariableBox<kotlin.Int>
28+
BLOCK_BODY
29+
SET_FIELD 'FIELD FIELD_FOR_CAPTURED_VALUE name:$insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> visibility:private [final] declared in <root>.bar.<no name provided>' type=kotlin.Unit origin=INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE
30+
receiver: GET_VAR '<this>: <root>.bar.<no name provided> declared in <root>.bar.<no name provided>' type=<root>.bar.<no name provided> origin=null
31+
value: GET_VAR '$insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> declared in <root>.bar.<no name provided>.<init>' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
32+
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
33+
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]' type=kotlin.Unit
34+
FUN name:count visibility:public modality:FINAL returnType:kotlin.Unit
35+
VALUE_PARAMETER kind:DispatchReceiver name:<this> index:0 type:<root>.bar.<no name provided>
36+
BLOCK_BODY
37+
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
38+
BLOCK type=kotlin.Int origin=POSTFIX_INCR
39+
VAR IR_TEMPORARY_VARIABLE name:<unary> type:kotlin.Int [val]
40+
CALL 'public final fun <get-globalCounter> (): kotlin.Int declared in <root>' type=kotlin.Int origin=POSTFIX_INCR
41+
CALL 'public final fun <set-globalCounter> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=POSTFIX_INCR
42+
ARG <set-?>: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=POSTFIX_INCR
43+
ARG <this>: GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
44+
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
45+
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
46+
BLOCK type=kotlin.Int origin=POSTFIX_INCR
47+
VAR IR_TEMPORARY_VARIABLE name:<unary> type:kotlin.Int [val]
48+
CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=POSTFIX_INCR
49+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
50+
CALL 'public final fun <set-element> (<set-?>: T of kotlin.internal.SharedVariableBox): kotlin.Unit declared in kotlin.internal.SharedVariableBox' type=kotlin.Unit origin=POSTFIX_INCR
51+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
52+
ARG <set-?>: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=POSTFIX_INCR
53+
ARG <this>: GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
54+
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
55+
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
56+
BLOCK type=kotlin.Int origin=POSTFIX_INCR
57+
VAR IR_TEMPORARY_VARIABLE name:<unary> type:kotlin.Int [val]
58+
CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=POSTFIX_INCR
59+
ARG <this>: GET_FIELD 'FIELD FIELD_FOR_CAPTURED_VALUE name:$insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> visibility:private [final] declared in <root>.bar.<no name provided>' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
60+
receiver: GET_VAR '<this>: <root>.bar.<no name provided> declared in <root>.bar.<no name provided>.count' type=<root>.bar.<no name provided> origin=null
61+
CALL 'public final fun <set-element> (<set-?>: T of kotlin.internal.SharedVariableBox): kotlin.Unit declared in kotlin.internal.SharedVariableBox' type=kotlin.Unit origin=POSTFIX_INCR
62+
ARG <this>: GET_FIELD 'FIELD FIELD_FOR_CAPTURED_VALUE name:$insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> visibility:private [final] declared in <root>.bar.<no name provided>' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
63+
receiver: GET_VAR '<this>: <root>.bar.<no name provided> declared in <root>.bar.<no name provided>.count' type=<root>.bar.<no name provided> origin=null
64+
ARG <set-?>: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=POSTFIX_INCR
65+
ARG <this>: GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
66+
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.bar.<no name provided>.count' type=kotlin.Int origin=null
67+
FUN name:foo visibility:public modality:FINAL returnType:kotlin.Int
68+
VALUE_PARAMETER kind:DispatchReceiver name:<this> index:0 type:<root>.bar.<no name provided>
69+
BLOCK_BODY
70+
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Int declared in <root>.bar.<no name provided>'
71+
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.Int origin=INVOKE
72+
ARG <this>: GET_VAR 'test: kotlin.Function0<kotlin.Int> [crossinline] declared in <root>.bar' type=kotlin.Function0<kotlin.Int> origin=VARIABLE_AS_FUNCTION
73+
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN returnType:kotlin.Boolean [fake_override,operator]
74+
VALUE_PARAMETER kind:DispatchReceiver name:<this> index:0 type:kotlin.Any
75+
VALUE_PARAMETER kind:Regular name:other index:1 type:kotlin.Any?
76+
overridden:
77+
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
78+
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN returnType:kotlin.Int [fake_override]
79+
VALUE_PARAMETER kind:DispatchReceiver name:<this> index:0 type:kotlin.Any
80+
overridden:
81+
public open fun hashCode (): kotlin.Int declared in kotlin.Any
82+
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN returnType:kotlin.String [fake_override]
83+
VALUE_PARAMETER kind:DispatchReceiver name:<this> index:0 type:kotlin.Any
84+
overridden:
85+
public open fun toString (): kotlin.String declared in kotlin.Any
86+
FIELD FIELD_FOR_CAPTURED_VALUE name:$insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> visibility:private [final]
87+
RETURNABLE_BLOCK type=<root>.Pair<<root>.bar.<no name provided>> origin=null
88+
INLINED_BLOCK type=<root>.Pair<<root>.bar.<no name provided>> origin=null
89+
inlinedFunctionSymbol: public final fun runTwice <T> (f: kotlin.Function0<T of <root>.runTwice>): <root>.Pair<T of <root>.runTwice> [inline] declared in <root>
90+
inlinedFunctionFileEntry: FILE_ENTRY path:crossinlineLambdaAllocation.kt
91+
RETURN type=kotlin.Nothing from='{IrReturnableBlockImpl}'
92+
TYPE_OP type=<root>.Pair<<root>.bar.<no name provided>> origin=IMPLICIT_CAST typeOperand=<root>.Pair<<root>.bar.<no name provided>>
93+
CONSTRUCTOR_CALL 'public constructor <init> (first: T of <root>.Pair, second: T of <root>.Pair) [primary] declared in <root>.Pair' type=<root>.Pair<kotlin.Any?> origin=null
94+
TYPE_ARG (of class) T: kotlin.Any?
95+
ARG first: RETURNABLE_BLOCK type=kotlin.Any? origin=null
96+
INLINED_BLOCK type=kotlin.Any? origin=null
97+
inlinedFunctionFileEntry: FILE_ENTRY path:crossinlineLambdaAllocation.kt
98+
VAR name:insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> [val]
99+
CONSTRUCTOR_CALL 'public constructor <init> (element: T of kotlin.internal.SharedVariableBox) [primary] declared in kotlin.internal.SharedVariableBox' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
100+
TYPE_ARG (of class) T: kotlin.Int
101+
ARG element: CONST Int type=kotlin.Int value=0
102+
VAR name:r type:<root>.bar.<no name provided> [val]
103+
BLOCK type=<root>.bar.<no name provided> origin=OBJECT_LITERAL
104+
COMPOSITE type=kotlin.Unit origin=null
105+
CONSTRUCTOR_CALL 'private constructor <init> ($insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int>) [primary] declared in <root>.bar.<no name provided>' type=<root>.bar.<no name provided> origin=OBJECT_LITERAL
106+
ARG $insideCounter: GET_VAR 'val insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
107+
CALL 'public final fun count (): kotlin.Unit declared in <root>.bar.<no name provided>' type=kotlin.Unit origin=null
108+
ARG <this>: GET_VAR 'val r: <root>.bar.<no name provided> [val] declared in <root>.bar' type=<root>.bar.<no name provided> origin=null
109+
CALL 'public final fun <set-element> (<set-?>: T of kotlin.internal.SharedVariableBox): kotlin.Unit declared in kotlin.internal.SharedVariableBox' type=kotlin.Unit origin=PLUSEQ
110+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
111+
ARG <set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
112+
ARG <this>: CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=PLUSEQ
113+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
114+
ARG other: CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=null
115+
ARG <this>: GET_VAR 'val insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
116+
RETURN type=kotlin.Nothing from='{IrReturnableBlockImpl}'
117+
TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
118+
GET_VAR 'val r: <root>.bar.<no name provided> [val] declared in <root>.bar' type=<root>.bar.<no name provided> origin=null
119+
ARG second: RETURNABLE_BLOCK type=kotlin.Any? origin=null
120+
INLINED_BLOCK type=kotlin.Any? origin=null
121+
inlinedFunctionFileEntry: FILE_ENTRY path:crossinlineLambdaAllocation.kt
122+
VAR name:insideCounter type:kotlin.internal.SharedVariableBox<kotlin.Int> [val]
123+
CONSTRUCTOR_CALL 'public constructor <init> (element: T of kotlin.internal.SharedVariableBox) [primary] declared in kotlin.internal.SharedVariableBox' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
124+
TYPE_ARG (of class) T: kotlin.Int
125+
ARG element: CONST Int type=kotlin.Int value=0
126+
VAR name:r type:<root>.bar.<no name provided> [val]
127+
BLOCK type=<root>.bar.<no name provided> origin=OBJECT_LITERAL
128+
COMPOSITE type=kotlin.Unit origin=null
129+
CONSTRUCTOR_CALL 'private constructor <init> ($insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int>) [primary] declared in <root>.bar.<no name provided>' type=<root>.bar.<no name provided> origin=OBJECT_LITERAL
130+
ARG $insideCounter: GET_VAR 'val insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
131+
CALL 'public final fun count (): kotlin.Unit declared in <root>.bar.<no name provided>' type=kotlin.Unit origin=null
132+
ARG <this>: GET_VAR 'val r: <root>.bar.<no name provided> [val] declared in <root>.bar' type=<root>.bar.<no name provided> origin=null
133+
CALL 'public final fun <set-element> (<set-?>: T of kotlin.internal.SharedVariableBox): kotlin.Unit declared in kotlin.internal.SharedVariableBox' type=kotlin.Unit origin=PLUSEQ
134+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
135+
ARG <set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
136+
ARG <this>: CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=PLUSEQ
137+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
138+
ARG other: CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=null
139+
ARG <this>: GET_VAR 'val insideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
140+
RETURN type=kotlin.Nothing from='{IrReturnableBlockImpl}'
141+
TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
142+
GET_VAR 'val r: <root>.bar.<no name provided> [val] declared in <root>.bar' type=<root>.bar.<no name provided> origin=null
143+
CALL 'public final fun <set-globalCounter> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
144+
ARG <set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
145+
ARG <this>: CALL 'public final fun <get-globalCounter> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
146+
ARG other: CALL 'public final fun <get-element> (): T of kotlin.internal.SharedVariableBox declared in kotlin.internal.SharedVariableBox' type=kotlin.Int origin=null
147+
ARG <this>: GET_VAR 'val outsideCounter: kotlin.internal.SharedVariableBox<kotlin.Int> [val] declared in <root>.bar' type=kotlin.internal.SharedVariableBox<kotlin.Int> origin=null
148+
RETURN type=kotlin.Nothing from='public final fun bar (test: kotlin.Function0<kotlin.Int>): kotlin.Int [inline] declared in <root>'
149+
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
150+
ARG <this>: CALL 'public final fun foo (): kotlin.Int declared in <root>.bar.<no name provided>' type=kotlin.Int origin=null
151+
ARG <this>: CALL 'public final fun <get-first> (): T of <root>.Pair declared in <root>.Pair' type=<root>.bar.<no name provided> origin=GET_PROPERTY
152+
ARG <this>: GET_VAR 'val x: <root>.Pair<<root>.bar.<no name provided>> [val] declared in <root>.bar' type=<root>.Pair<<root>.bar.<no name provided>> origin=null
153+
ARG other: CALL 'public final fun foo (): kotlin.Int declared in <root>.bar.<no name provided>' type=kotlin.Int origin=null
154+
ARG <this>: CALL 'public final fun <get-second> (): T of <root>.Pair declared in <root>.Pair' type=<root>.bar.<no name provided> origin=GET_PROPERTY
155+
ARG <this>: GET_VAR 'val x: <root>.Pair<<root>.bar.<no name provided>> [val] declared in <root>.bar' type=<root>.Pair<<root>.bar.<no name provided>> origin=null

0 commit comments

Comments
 (0)