Commit bdcf3ef
[release/9.0-preview7] JIT: Fix placement of
* JIT: Fix placement of `GT_START_NOGC` for tailcalls in face of bulk copy with write barrier calls
When the JIT generates code for a tailcall it must generate code to
write the arguments into the incoming parameter area. Since the GC ness
of the arguments of the tailcall may not match the GC ness of the
parameters, we have to disable GC before we start writing these. This is
done by finding the earliest `GT_PUTARG_STK` node and placing the start
of the NOGC region right before it.
In addition, there is logic to take care of potential overlap between
the arguments and parameters. For example, if the call has an operand
that uses one of the parameters, then we must take care that we do not
override that parameter with the tailcall argument before the use of it.
To do so, we sometimes may need to introduce copies from the parameter
locals to locals on the stack frame.
This used to work fine, however, with #101761 we started transforming
block copies into managed calls in certain scenarios. It was possible
for the JIT to decide to introduce a copy to a local and for this
transformation to then kick in. This would cause us to end up with the
managed helper call after starting the nogc region. In checked builds
this would hit an assert during GC scan; in release builds, it would end
up with corrupted data.
The fix here is to make sure we insert the `GT_START_NOGC` after all the
potential temporary copies we may introduce as part of the tailcat stll
logic.
There was an additional assumption that the first `PUTARG_STK` operand
was the earliest one in execution order. That is not guaranteed, so this
change stops relying on that as well by introducing a new
`LIR::FirstNode` and using that to determine the earliest `PUTARG_STK`
node.
Fix #102370
Fix #104123
Fix #105441
---------
Co-authored-by: Jakob Botsch Nielsen <[email protected]>GT_START_NOGC for tailcalls in face of bulk copy with write barrier calls (#105572)1 parent bb63da9 commit bdcf3ef
3 files changed
+49
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1872 | 1872 | | |
1873 | 1873 | | |
1874 | 1874 | | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1875 | 1891 | | |
1876 | 1892 | | |
1877 | 1893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3057 | 3057 | | |
3058 | 3058 | | |
3059 | 3059 | | |
3060 | | - | |
3061 | | - | |
3062 | | - | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
3066 | | - | |
3067 | | - | |
3068 | | - | |
| 3060 | + | |
3069 | 3061 | | |
3070 | | - | |
| 3062 | + | |
3071 | 3063 | | |
3072 | | - | |
| 3064 | + | |
3073 | 3065 | | |
3074 | 3066 | | |
3075 | 3067 | | |
3076 | 3068 | | |
3077 | 3069 | | |
3078 | 3070 | | |
3079 | | - | |
3080 | | - | |
3081 | | - | |
3082 | | - | |
3083 | | - | |
3084 | | - | |
3085 | | - | |
3086 | | - | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
3090 | | - | |
3091 | | - | |
3092 | | - | |
3093 | | - | |
3094 | | - | |
3095 | | - | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
| 3071 | + | |
| 3072 | + | |
3100 | 3073 | | |
3101 | | - | |
3102 | | - | |
3103 | | - | |
| 3074 | + | |
3104 | 3075 | | |
3105 | | - | |
3106 | 3076 | | |
3107 | 3077 | | |
3108 | 3078 | | |
| |||
3172 | 3142 | | |
3173 | 3143 | | |
3174 | 3144 | | |
3175 | | - | |
| 3145 | + | |
3176 | 3146 | | |
3177 | 3147 | | |
3178 | | - | |
| 3148 | + | |
3179 | 3149 | | |
3180 | 3150 | | |
3181 | 3151 | | |
| |||
3189 | 3159 | | |
3190 | 3160 | | |
3191 | 3161 | | |
3192 | | - | |
| 3162 | + | |
3193 | 3163 | | |
3194 | 3164 | | |
3195 | 3165 | | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
3196 | 3189 | | |
3197 | 3190 | | |
3198 | 3191 | | |
| |||
0 commit comments