summary refs log tree commit diff stats
path: root/tests/assign
diff options
context:
space:
mode:
authorzah <zahary@gmail.com>2021-04-14 13:10:01 +0300
committerGitHub <noreply@github.com>2021-04-14 12:10:01 +0200
commit3b47a689cfa56d9b54cd1b92dc1b57d3e4094937 (patch)
tree23dff05345e436c1a2d16e78ddf241e96be61ef3 /tests/assign
parent25b4a0ab0a03f35c58bc0dbfff51a344e108bfe3 (diff)
downloadNim-3b47a689cfa56d9b54cd1b92dc1b57d3e4094937.tar.gz
Remove the use of usrToCell in gcMark [backport:1.2] (#17709)
* Remove the use of usrToCell in gcMark [backport:1.2]

Recently, we've discovered a GC crash resulting from inlining of
the memory allocation procs that allowed the compiler to avoid
maintaining any references to the "user pointer" on the stack.
Instead, a "cell pointer" appeared there and all field accesses
were performed with adjusted offsets. This interfered with the
ability of the GC to mark the correct cell in the conservative
stack scans which lead to premature collection of objects.

More details here:
https://github.com/status-im/Nim/commit/af69b3ceae16281efd45cbee4ce1bedd14282304

This commit closes another theoretical loophole that may lead to
the same problem. If a short proc is accessing both the object and
its reference count in a short sequence of instructions, the compiler
may be enticed to reduce the number of registers being used by storing
only a single pointer to the object and using offsets when reading
and writing fields. A perfectly good strategy would be to store only
the cell pointer, so the reference count updates can be performed
without applying offsets. Accessing the fields of the object requires
offsets anyway, but these can be adjusted at compile-time without any
loss. Following this strategy will lead to the same problem of marking
a wrong cell during the conservative stack scan, leading to premature
collection.

The problem is avoided by not using `usrToCell` in `gcMark`. Since
the cell discovery logic can already handle interior pointers, the
user pointers don't need to be adjusted for the GC to function correctly.
Diffstat (limited to 'tests/assign')
0 files changed, 0 insertions, 0 deletions
83d'>^
8e0d8d2a ^

439e6486 ^

fe519410 ^
d28930ea ^

57f9e435 ^

8e0d8d2a ^
dd9f6f82 ^
134da4d0 ^
ec75b5e0 ^
a234ba0c ^
1d3739bb ^
4d190a9c ^
11125561 ^
17a284b2 ^
a6859354 ^
7fe8f61b ^
b83b262d ^
a6859354 ^
1046a004 ^
5a5b1340 ^

bc3c4e09 ^
5a5b1340 ^

2101f29e ^
5a5b1340 ^

7d6ce4da ^
b19b881b ^
5a5b1340 ^

84c7fc9a ^
462e84ea ^
a3217bcf ^
462e84ea ^

84c7fc9a ^
a077d200 ^

2bc19f46 ^
84c7fc9a ^
84c7fc9a ^


1e4fc2ce ^


5a5b1340 ^


5a5b1340 ^
5a5b1340 ^



1046a004 ^

5a5b1340 ^



9daefe17 ^

5a5b1340 ^

82ad0cd3 ^
5a5b1340 ^
5a5b1340 ^
eaa19598 ^


5a5b1340 ^





1046a004 ^
bf185d99 ^

1046a004 ^
5a5b1340 ^

1046a004 ^
5a5b1340 ^


1046a004 ^
2c15aba9 ^
5a5b1340 ^

1046a004 ^
5a5b1340 ^
1046a004 ^
5a5b1340 ^
1046a004 ^
57effcd5 ^
64521eb1 ^
5a5b1340 ^
1046a004 ^
5a5b1340 ^

1046a004 ^
5a5b1340 ^
1046a004 ^
5a5b1340 ^

1046a004 ^
5a5b1340 ^





3f0addbc ^

1a300ce7 ^
27293ebb ^

95c08166 ^
2c15aba9 ^
1046a004 ^

5a5b1340 ^
c65b43f0 ^
5a5b1340 ^
1925cb80 ^
5a5b1340 ^
1925cb80 ^
7aa1d931 ^
5a5b1340 ^




90ac69be ^
5a5b1340 ^

547b6cf4 ^
905571bf ^
fc406377 ^





f0f0dbfd ^

fc406377 ^
9aa282f6 ^



a7190ed7 ^
b9aac28c ^

e6e0a13e ^



02f5df5b ^
d56f6dc3 ^
5a5b1340 ^









01578066 ^
5a5b1340 ^












8dbe300d ^
5a5b1340 ^

e955df88 ^
bced3d4b ^
5a5b1340 ^





b6095ca9 ^
5a5b1340 ^





























3f0addbc ^

02f5df5b ^
107fdd35 ^
5a5b1340 ^
107fdd35 ^
5a5b1340 ^
b36fbe41 ^
5a5b1340 ^
b36fbe41 ^
5a5b1340 ^

107fdd35 ^
5a5b1340 ^
107fdd35 ^
134e5d17 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285