@@ -356,13 +356,13 @@ for typ in atomictypes
356
356
rt = " $lt , $lt *"
357
357
irt = " $ilt , $ilt *"
358
358
@eval getindex (x:: Atomic{$typ} ) =
359
- llvmcall ($ """
359
+ GC . @preserve x llvmcall ($ """
360
360
%ptr = inttoptr i$WORD_SIZE %0 to $lt *
361
361
%rv = load atomic $rt %ptr acquire, align $(gc_alignment (typ))
362
362
ret $lt %rv
363
363
""" , $ typ, Tuple{Ptr{$ typ}}, unsafe_convert (Ptr{$ typ}, x))
364
364
@eval setindex! (x:: Atomic{$typ} , v:: $typ ) =
365
- llvmcall ($ """
365
+ GC . @preserve x llvmcall ($ """
366
366
%ptr = inttoptr i$WORD_SIZE %0 to $lt *
367
367
store atomic $lt %1, $lt * %ptr release, align $(gc_alignment (typ))
368
368
ret void
@@ -371,7 +371,7 @@ for typ in atomictypes
371
371
# Note: atomic_cas! succeeded (i.e. it stored "new") if and only if the result is "cmp"
372
372
if typ <: Integer
373
373
@eval atomic_cas! (x:: Atomic{$typ} , cmp:: $typ , new:: $typ ) =
374
- llvmcall ($ """
374
+ GC . @preserve x llvmcall ($ """
375
375
%ptr = inttoptr i$WORD_SIZE %0 to $lt *
376
376
%rs = cmpxchg $lt * %ptr, $lt %1, $lt %2 acq_rel acquire
377
377
%rv = extractvalue { $lt , i1 } %rs, 0
@@ -380,7 +380,7 @@ for typ in atomictypes
380
380
unsafe_convert (Ptr{$ typ}, x), cmp, new)
381
381
else
382
382
@eval atomic_cas! (x:: Atomic{$typ} , cmp:: $typ , new:: $typ ) =
383
- llvmcall ($ """
383
+ GC . @preserve x llvmcall ($ """
384
384
%iptr = inttoptr i$WORD_SIZE %0 to $ilt *
385
385
%icmp = bitcast $lt %1 to $ilt
386
386
%inew = bitcast $lt %2 to $ilt
@@ -403,15 +403,15 @@ for typ in atomictypes
403
403
if rmwop in arithmetic_ops && ! (typ <: ArithmeticTypes ) continue end
404
404
if typ <: Integer
405
405
@eval $ fn (x:: Atomic{$typ} , v:: $typ ) =
406
- llvmcall ($ """
406
+ GC . @preserve x llvmcall ($ """
407
407
%ptr = inttoptr i$WORD_SIZE %0 to $lt *
408
408
%rv = atomicrmw $rmw $lt * %ptr, $lt %1 acq_rel
409
409
ret $lt %rv
410
410
""" , $ typ, Tuple{Ptr{$ typ}, $ typ}, unsafe_convert (Ptr{$ typ}, x), v)
411
411
else
412
412
rmwop === :xchg || continue
413
413
@eval $ fn (x:: Atomic{$typ} , v:: $typ ) =
414
- llvmcall ($ """
414
+ GC . @preserve x llvmcall ($ """
415
415
%iptr = inttoptr i$WORD_SIZE %0 to $ilt *
416
416
%ival = bitcast $lt %1 to $ilt
417
417
%irv = atomicrmw $rmw $ilt * %iptr, $ilt %ival acq_rel
0 commit comments