@@ -166,6 +166,11 @@ function test_atomic_read(commbuf::CommBuf, n::Int)
166
166
var1 = commbuf. var1[]
167
167
correct &= var1 >= var2
168
168
var1 == n && break
169
+ # Temporary solution before we have gc transition support in codegen.
170
+ # This could mess up gc state when we add codegen support.
171
+ # Use these as a safe point
172
+ gc_state = ccall (:jl_gc_safe_enter , Int8, ())
173
+ ccall (:jl_gc_safe_leave , Void, (Int8,), gc_state)
169
174
end
170
175
commbuf. correct_read = correct
171
176
end
@@ -208,6 +213,11 @@ function test_fence(p::Peterson, id::Int, n::Int)
208
213
p. turn[] = otherid
209
214
atomic_fence ()
210
215
while p. flag[otherid][] != 0 && p. turn[] == otherid
216
+ # Temporary solution before we have gc transition support in codegen.
217
+ # This could mess up gc state when we add codegen support.
218
+ # Use these as a safe point
219
+ gc_state = ccall (:jl_gc_safe_enter , Int8, ())
220
+ ccall (:jl_gc_safe_leave , Void, (Int8,), gc_state)
211
221
# busy wait
212
222
end
213
223
# critical section
@@ -260,6 +270,11 @@ function test_atomic_cas!{T}(var::Atomic{T}, range::StepRange{Int,Int})
260
270
while true
261
271
old = atomic_cas! (var, T (i- 1 ), T (i))
262
272
old == T (i- 1 ) && break
273
+ # Temporary solution before we have gc transition support in codegen.
274
+ # This could mess up gc state when we add codegen support.
275
+ # Use these as a safe point
276
+ gc_state = ccall (:jl_gc_safe_enter , Int8, ())
277
+ ccall (:jl_gc_safe_leave , Void, (Int8,), gc_state)
263
278
end
264
279
end
265
280
end
0 commit comments