Skip to content

Instantly share code, notes, and snippets.

@JohnTortugo
Created January 29, 2024 18:13
Show Gist options
  • Save JohnTortugo/2e6f183b0bf1e465dc871246b410ef4c to your computer and use it in GitHub Desktop.
Save JohnTortugo/2e6f183b0bf1e465dc871246b410ef4c to your computer and use it in GitHub Desktop.
@only 169 156 273 260 258 204 203 251 200 190 99 97 53 42 40 39 27
@only 158 207 202 44 39
0 Root === 0 113 125 136 147 173 271 272 [[ 0 1 3 23 24 25 47 186 185 181 161 142 87 108 115 120 131 275 ]]
1 Con === 0 [[ ]] #top
3 Start === 3 0 [[ 3 5 6 7 8 9 10 11 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:int, 6:int}
23 ConI === 0 [[ 190 27 27 143 157 132 121 121 101 183 190 143 143 132 132 121 ]] #int:0
24 ConP === 0 [[ 27 190 ]] #precise TestIncorrectRemat$MyClass: 0x00007ffff04f1578:Constant:exact * Klass:precise TestIncorrectRemat$MyClass: 0x00007ffff04f1578:Constant:exact *
25 ConL === 0 [[ 27 190 ]] #long:16
47 ConI === 0 [[ 251 90 ]] #int:42
186 ConL === 0 [[ 187 ]] #long:1184
185 ThreadLocal === 0 [[ 187 ]] !jvms: TestIncorrectRemat::test @ bci:34 (line 12)
181 ConP === 0 [[ 271 ]] #null
161 ConI === 0 [[ 169 162 ]] #int:10
142 ConI === 0 [[ 143 ]] #int:-146
87 ConL === 0 [[ 252 91 ]] #long:12
108 ConI === 0 [[ 109 169 ]] #int:-187
115 ConI === 0 [[ 116 127 138 182 ]] #int:1
120 ConI === 0 [[ 121 ]] #int:-138
131 ConI === 0 [[ 132 ]] #int:-66
275 ConN === 0 [[ ]] #narrowoop: null
5 Parm === 3 [[ 27 ]] Control !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
6 Parm === 3 [[ 27 ]] I_O !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
7 Parm === 3 [[ 53 43 212 27 43 43 43 43 276 278 280 282 283 284 285 286 287 ]] Memory Memory: @BotPTR *+bot, idx=Bot; !orig=[52] !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
8 Parm === 3 [[ 272 271 190 169 27 173 143 147 132 136 121 113 109 125 ]] FramePtr !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
9 Parm === 3 [[ 272 271 169 143 132 121 109 ]] ReturnAdr !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
10 Parm === 3 [[ 109 101 27 ]] Parm0: int !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
11 Parm === 3 [[ 190 183 174 27 121 143 132 ]] Parm1: int !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
190 Allocate === 183 155 156 8 1 (25 24 23 1 1 23 11 182 1 ) [[ 191 192 193 200 201 202 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top, bool ) TestIncorrectRemat::test @ bci:2 (line 13) !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
27 Allocate === 5 6 7 8 1 (25 24 23 1 1 10 11 23 1 ) [[ 28 29 30 37 38 39 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top, bool ) TestIncorrectRemat::test @ bci:2 (line 13) !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
143 CallStaticJava === 139 38 99 8 9 (142 23 11 23 44 23 ) [[ 144 ]] # Static uncommon_trap(reason='loop_limit_check' action='maybe_recompile' debug_id='0') void ( int ) C=0.000100 TestIncorrectRemat::test @ bci:13 (line 14) reexecute !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
157 Phi === 273 23 182 [[ 182 169 174 162 ]] #int !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
132 CallStaticJava === 128 38 99 8 9 (131 23 11 23 44 23 ) [[ 133 ]] # Static uncommon_trap(reason='profile_predicate' action='maybe_recompile' debug_id='0') void ( int ) C=0.000100 TestIncorrectRemat::test @ bci:13 (line 14) reexecute !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
121 CallStaticJava === 117 38 99 8 9 (120 23 11 23 44 23 ) [[ 122 ]] # Static uncommon_trap(reason='predicate' action='maybe_recompile' debug_id='0') void ( int ) C=0.000100 TestIncorrectRemat::test @ bci:13 (line 14) reexecute !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
101 CmpI === _ 10 23 [[ 102 ]] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
183 SafePoint === 177 1 156 1 1 188 23 11 182 1 [[ 190 ]] SafePoint !jvms: TestIncorrectRemat::test @ bci:34 (line 12)
251 StoreI === 195 200 252 47 [[ 203 ]] @TestIncorrectRemat$MyClass+12 *, name=val, idx=6; Memory: @rawptr:NotNull, idx=Raw; !orig=250 !jvms: TestIncorrectRemat$MyClass::<init> @ bci:6 (line 7) TestIncorrectRemat::test @ bci:8 (line 13)
90 StoreI === 32 37 91 47 [[ 40 ]] @TestIncorrectRemat$MyClass+12 *, name=val, idx=6; Memory: @rawptr:NotNull, idx=Raw; !orig=89 !jvms: TestIncorrectRemat$MyClass::<init> @ bci:6 (line 7) TestIncorrectRemat::test @ bci:8 (line 13)
187 AddP === _ 1 185 186 [[ 188 ]] !jvms: TestIncorrectRemat::test @ bci:34 (line 12)
271 Return === 178 155 156 8 9 returns 181 [[ 0 ]]
169 CallStaticJava === 166 155 156 8 9 (108 1 1 1 158 157 161 ) [[ 170 ]] # Static uncommon_trap(reason='unstable_if' action='reinterpret' debug_id='0') void ( int ) C=0.000100 TestIncorrectRemat::test @ bci:19 (line 14) reexecute !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
162 CmpI === _ 157 161 [[ 163 ]] !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
252 AddP === _ 1 202 87 [[ 251 ]] !jvms: TestIncorrectRemat$MyClass::<init> @ bci:6 (line 7) TestIncorrectRemat::test @ bci:8 (line 13)
91 AddP === _ 1 39 87 [[ 90 ]] !jvms: TestIncorrectRemat$MyClass::<init> @ bci:6 (line 7) TestIncorrectRemat::test @ bci:8 (line 13)
109 CallStaticJava === 104 38 99 8 9 (108 1 1 1 44 10 ) [[ 110 ]] # Static uncommon_trap(reason='unstable_if' action='reinterpret' debug_id='0') void ( int ) C=0.000100 TestIncorrectRemat::test @ bci:13 (line 14) reexecute !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
116 ParsePredicate === 105 115 [[ 117 126 ]] #Loop !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
127 ParsePredicate === 126 115 [[ 128 137 ]] #Profiled_Loop !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
138 ParsePredicate === 137 115 [[ 139 148 ]] #Loop_Limit_Check !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
182 AddI === _ 157 115 [[ 190 183 157 ]] !jvms: TestIncorrectRemat::test @ bci:31 (line 12)
53 MergeMem === _ 1 7 42 42 42 42 1 42 42 42 [[ 97 ]] { N42:rawptr:BotPTR N42:java/lang/Object * N42:java/lang/Object+8 * [narrowklass] N42:TestIncorrectRemat$MyClass+12 * - N42:TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 N42:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass] N42:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27 } Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:8 (line 13)
43 MergeMem === _ 1 37 1 1 1 7 1 1 1 7 7 7 7 [[ 40 ]] { - - - N7:TestIncorrectRemat$MyClass+12 * - - - N7:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27 N7:TestIncorrectRemat$MyClass:NotNull:exact *,iid=190 N7:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=190 [narrowklass] N7:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190 } Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
212 Phi === 210 7 156 [[ 269 ]] #memory Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
276 Phi === 210 7 277 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact *,iid=27, idx=8; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
278 Phi === 210 7 279 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass], idx=9; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
280 Phi === 210 7 281 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27, name=val, idx=10; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
282 Phi === 210 7 283 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact *,iid=190, idx=11; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
283 Phi === 273 7 205 [[ 282 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact *,iid=190, idx=11; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
284 Phi === 210 7 285 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=190 [narrowklass], idx=12; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
285 Phi === 273 7 205 [[ 284 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=190 [narrowklass], idx=12; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
286 Phi === 210 7 287 [[ 269 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190, name=val, idx=13; !orig=212 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
287 Phi === 273 7 205 [[ 286 206 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190, name=val, idx=13; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
272 Rethrow === 210 211 269 8 9 exception 214 [[ 0 ]]
173 Halt === 170 1 1 8 1 [[ 0 ]] !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
147 Halt === 144 1 1 8 1 [[ 0 ]] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
136 Halt === 133 1 1 8 1 [[ 0 ]] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
113 Halt === 110 1 1 8 1 [[ 0 ]] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
125 Halt === 122 1 1 8 1 [[ 0 ]] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
174 CmpI === _ 157 11 [[ 175 ]] !jvms: TestIncorrectRemat::test @ bci:26 (line 17)
191 Proj === 190 [[ 194 ]] #0 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
192 Proj === 190 [[ 213 ]] #2 (i_o_use) Memory: @rawptr:BotPTR, idx=Raw; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
193 Proj === 190 [[ 194 211 199 ]] #1 (i_o_use) !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
200 Proj === 190 [[ 206 251 ]] #2 Memory: @rawptr:BotPTR, idx=Raw; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
201 Proj === 190 [[ 155 ]] #1 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
202 Proj === 190 [[ 203 207 252 ]] #5 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
28 Proj === 27 [[ 31 ]] #0 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
29 Proj === 27 [[ 213 ]] #2 (i_o_use) Memory: @rawptr:BotPTR, idx=Raw; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
30 Proj === 27 [[ 31 211 36 ]] #1 (i_o_use) !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
37 Proj === 27 [[ 43 90 ]] #2 Memory: @rawptr:BotPTR, idx=Raw; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
38 Proj === 27 [[ 143 132 121 109 155 ]] #1 !orig=150 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
39 Proj === 27 [[ 40 44 91 ]] #5 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
144 Proj === 143 [[ 147 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
133 Proj === 132 [[ 136 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
122 Proj === 121 [[ 125 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
102 Bool === _ 101 [[ 103 ]] [ne] !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
203 Initialize === 195 1 206 1 1 202 251 [[ 204 205 ]] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
40 Initialize === 32 1 43 1 1 39 90 [[ 41 42 ]] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
188 LoadP === 177 156 187 [[ 183 ]] @rawptr:BotPTR, idx=Raw; #rawptr:BotPTR (does not depend only on test, raw access) !jvms: TestIncorrectRemat::test @ bci:34 (line 12)
170 Proj === 169 [[ 173 ]] #0 !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
163 Bool === _ 162 [[ 164 ]] [le] !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
110 Proj === 109 [[ 113 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
117 IfFalse === 116 [[ 121 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
126 IfTrue === 116 [[ 127 ]] #1 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
128 IfFalse === 127 [[ 132 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
137 IfTrue === 127 [[ 138 ]] #1 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
139 IfFalse === 138 [[ 143 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
148 IfTrue === 138 [[ 273 ]] #1 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
97 MemBarRelease === 41 1 53 1 1 44 [[ 98 99 ]] !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
269 MergeMem === _ 1 212 213 1 1 1 1 276 278 280 282 284 286 [[ 272 ]] { N213:rawptr:BotPTR - - - - N276:TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 N278:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass] N280:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27 N282:TestIncorrectRemat$MyClass:NotNull:exact *,iid=190 N284:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=190 [narrowklass] N286:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190 } Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:-1 (line 12)
206 MergeMem === _ 1 200 1 1 1 156 1 277 279 281 1 1 287 [[ 203 ]] { - - - N156:TestIncorrectRemat$MyClass+12 * - N277:TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 N279:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass] N281:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27 - - N287:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190 } Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
175 Bool === _ 174 [[ 176 ]] [ne] !jvms: TestIncorrectRemat::test @ bci:26 (line 17)
194 Catch === 191 193 [[ 195 196 ]] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
213 Phi === 210 29 192 [[ 269 ]] #memory Memory: @rawptr:BotPTR, idx=Raw; !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
211 Phi === 210 30 193 [[ 272 ]] #abIO !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
199 CreateEx === 196 193 [[ 214 ]] #java/lang/Throwable (java/io/Serializable):NotNull * Oop:java/lang/Throwable (java/io/Serializable):NotNull * !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
155 Phi === 273 38 201 [[ 190 169 271 ]] #abIO !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
207 CheckCastPP === 204 202 [[ 258 158 ]] #TestIncorrectRemat$MyClass:NotNull:exact *,iid=190 Oop:TestIncorrectRemat$MyClass:NotNull:exact *,iid=190 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
31 Catch === 28 30 [[ 32 33 ]] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
36 CreateEx === 33 30 [[ 214 ]] #java/lang/Throwable (java/io/Serializable):NotNull * Oop:java/lang/Throwable (java/io/Serializable):NotNull * !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
44 CheckCastPP === 41 39 [[ 143 132 158 121 109 97 ]] #TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 Oop:TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 !orig=153 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
103 If === 98 102 [[ 104 105 ]] P=0.000000, C=13527.000000 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
204 Proj === 203 [[ 258 207 ]] #0 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
205 Proj === 203 [[ 220 220 220 220 220 283 220 285 287 220 ]] #2 Memory: @rawptr:BotPTR, idx=Raw; !orig=[254],[219] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
41 Proj === 40 [[ 97 44 ]] #0 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
42 Proj === 40 [[ 53 53 53 53 53 53 53 277 279 281 ]] #2 Memory: @rawptr:BotPTR, idx=Raw; !orig=[93],[52] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
164 If === 273 163 [[ 165 166 ]] P=1.000000, C=13527.000000 !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
273 Loop === 273 148 259 [[ 273 158 157 156 155 164 277 279 281 283 285 287 ]] inner !orig=[154] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
98 Proj === 97 [[ 103 ]] #0 !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
99 Proj === 97 [[ 156 143 109 132 121 ]] #2 Memory: @BotPTR *+bot, idx=Bot; !orig=[151] !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
176 If === 165 175 [[ 177 178 ]] P=0.909145, C=13527.000000 !jvms: TestIncorrectRemat::test @ bci:26 (line 17)
195 CatchProj === 194 [[ 203 251 ]] #0@bci -1 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
196 CatchProj === 194 [[ 210 199 ]] #1@bci -1 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
214 Phi === 210 36 199 [[ 272 ]] #java/lang/Throwable (java/io/Serializable):NotNull * Oop:java/lang/Throwable (java/io/Serializable):NotNull * !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
258 MemBarRelease === 204 1 220 1 1 207 [[ 259 260 ]] !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
158 Phi === 273 44 207 [[ 169 ]] #TestIncorrectRemat$MyClass:NotNull:exact * Oop:TestIncorrectRemat$MyClass:NotNull:exact * !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
32 CatchProj === 31 [[ 40 90 ]] #0@bci -1 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
33 CatchProj === 31 [[ 210 36 ]] #1@bci -1 !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
104 IfTrue === 103 [[ 109 ]] #1 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
105 IfFalse === 103 [[ 116 ]] #0 !jvms: TestIncorrectRemat::test @ bci:13 (line 14)
220 MergeMem === _ 1 156 205 205 205 205 1 277 279 281 205 205 205 [[ 258 ]] { N205:rawptr:BotPTR N205:java/lang/Object * N205:java/lang/Object+8 * [narrowklass] N205:TestIncorrectRemat$MyClass+12 * - N277:TestIncorrectRemat$MyClass:NotNull:exact *,iid=27 N279:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass] N281:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27 N205:TestIncorrectRemat$MyClass:NotNull:exact *,iid=190 N205:TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=190 [narrowklass] N205:TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=190 } Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat::test @ bci:8 (line 13)
277 Phi === 273 42 277 [[ 206 220 277 276 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact *,iid=27, idx=8; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
279 Phi === 273 42 279 [[ 206 220 279 278 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+8 *,iid=27 [narrowklass], idx=9; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
281 Phi === 273 42 281 [[ 206 220 281 280 ]] #memory Memory: @TestIncorrectRemat$MyClass:NotNull:exact+12 *,iid=27, name=val, idx=10; !orig=156,[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
165 IfTrue === 164 [[ 176 ]] #1 !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
166 IfFalse === 164 [[ 169 ]] #0 !jvms: TestIncorrectRemat::test @ bci:19 (line 14)
156 Phi === 273 99 260 [[ 220 271 212 169 183 190 188 206 ]] #memory Memory: @BotPTR *+bot, idx=Bot; !orig=[219] !jvms: TestIncorrectRemat::test @ bci:16 (line 14)
177 IfTrue === 176 [[ 188 183 ]] #1 !jvms: TestIncorrectRemat::test @ bci:26 (line 17)
178 IfFalse === 176 [[ 271 ]] #0 !jvms: TestIncorrectRemat::test @ bci:26 (line 17)
210 Region === 210 33 196 [[ 210 211 212 213 214 272 276 278 280 282 284 286 ]] !jvms: TestIncorrectRemat::test @ bci:2 (line 13)
259 Proj === 258 [[ 273 ]] #0 !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
260 Proj === 258 [[ 156 ]] #2 Memory: @BotPTR *+bot, idx=Bot; !jvms: TestIncorrectRemat$MyClass::<init> @ bci:-1 (line 6) TestIncorrectRemat::test @ bci:8 (line 13)
@JohnTortugo
Copy link
Author

JohnTortugo commented Jan 29, 2024

The IR printout in the previous message is from just before running the RAM optimization (called from inside split_unique_types).

When the following call happens the sfpt_mem parameter points to node 156 Phi:

libjvm.so!PhaseMacroExpand::value_from_mem(PhaseMacroExpand * const this, Node * sfpt_mem, Node * sfpt_ctl, BasicType ft, const Type * ftype, const TypeOopPtr * adr_t, AllocateNode * alloc) (/wf/tortugo-jdk/src/hotspot/share/opto/macro.cpp:451)
libjvm.so!PhaseMacroExpand::create_scalarized_object_description(PhaseMacroExpand * const this, AllocateNode * alloc, SafePointNode * sfpt) (/wf/tortugo-jdk/src/hotspot/share/opto/macro.cpp:809)
libjvm.so!ConnectionGraph::reduce_phi_on_safepoints(ConnectionGraph * const this, PhiNode * ophi, Unique_Node_List * safepoints) (/wf/tortugo-jdk/src/hotspot/share/opto/escape.cpp:696)
libjvm.so!ConnectionGraph::reduce_phi(ConnectionGraph * const this, PhiNode * ophi) (/wf/tortugo-jdk/src/hotspot/share/opto/escape.cpp:764)
libjvm.so!ConnectionGraph::compute_escape(ConnectionGraph * const this) (/wf/tortugo-jdk/src/hotspot/share/opto/escape.cpp:418)
libjvm.so!ConnectionGraph::do_analysis(Compile * C, PhaseIterGVN * igvn) (/wf/tortugo-jdk/src/hotspot/share/opto/escape.cpp:116)
libjvm.so!Compile::Optimize(Compile * const this) (/wf/tortugo-jdk/src/hotspot/share/opto/compile.cpp:2342)
...

and then alloc_mem is set to 156 Phi as well and, because of that, done is set to true which leads to the while loop on line 464 not being executed. A similar problem happens when we later call value_from_mem_phi.

@JohnTortugo
Copy link
Author

BTW, this is the Java code used to reproduce the problem:

// -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,TestIncorrectRemat::test* -XX:-TieredCompilation -Xbatch 
public class TestIncorrectRemat {
    static class MyClass {
        final int val;

        public MyClass(int val) {
            this.val = val;
        }
    }

    public static MyClass test(boolean alwaysFalse, int limit) {
        for (int i = 0; ; ++i) {
            MyClass obj = new MyClass(42);
            if (alwaysFalse || i > 10) {
                return obj;
            }
            if (i == limit) {
              return null;
            }
        }
    }

    public static void main(String[] args) {
        // Warmup
        for (int i = 0; i < 50_000; ++i) {
            test(false, 10);
        }

        // Trigger deoptimization
        MyClass obj = test(false, 11);
        if (obj.val != 42) {
            throw new RuntimeException("Test failed, val = " + obj.val);
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment