@@ -356,13 +356,13 @@ for typ in atomictypes
356356 rt = " $lt , $lt *"
357357 irt = " $ilt , $ilt *"
358358 @eval getindex (x:: Atomic{$typ} ) =
359- llvmcall ($ """
359+ GC . @preserve x llvmcall ($ """
360360 %ptr = inttoptr i$WORD_SIZE %0 to $lt *
361361 %rv = load atomic $rt %ptr acquire, align $(gc_alignment (typ))
362362 ret $lt %rv
363363 """ , $ typ, Tuple{Ptr{$ typ}}, unsafe_convert (Ptr{$ typ}, x))
364364 @eval setindex! (x:: Atomic{$typ} , v:: $typ ) =
365- llvmcall ($ """
365+ GC . @preserve x llvmcall ($ """
366366 %ptr = inttoptr i$WORD_SIZE %0 to $lt *
367367 store atomic $lt %1, $lt * %ptr release, align $(gc_alignment (typ))
368368 ret void
@@ -371,7 +371,7 @@ for typ in atomictypes
371371 # Note: atomic_cas! succeeded (i.e. it stored "new") if and only if the result is "cmp"
372372 if typ <: Integer
373373 @eval atomic_cas! (x:: Atomic{$typ} , cmp:: $typ , new:: $typ ) =
374- llvmcall ($ """
374+ GC . @preserve x llvmcall ($ """
375375 %ptr = inttoptr i$WORD_SIZE %0 to $lt *
376376 %rs = cmpxchg $lt * %ptr, $lt %1, $lt %2 acq_rel acquire
377377 %rv = extractvalue { $lt , i1 } %rs, 0
@@ -380,7 +380,7 @@ for typ in atomictypes
380380 unsafe_convert (Ptr{$ typ}, x), cmp, new)
381381 else
382382 @eval atomic_cas! (x:: Atomic{$typ} , cmp:: $typ , new:: $typ ) =
383- llvmcall ($ """
383+ GC . @preserve x llvmcall ($ """
384384 %iptr = inttoptr i$WORD_SIZE %0 to $ilt *
385385 %icmp = bitcast $lt %1 to $ilt
386386 %inew = bitcast $lt %2 to $ilt
@@ -403,15 +403,15 @@ for typ in atomictypes
403403 if rmwop in arithmetic_ops && ! (typ <: ArithmeticTypes ) continue end
404404 if typ <: Integer
405405 @eval $ fn (x:: Atomic{$typ} , v:: $typ ) =
406- llvmcall ($ """
406+ GC . @preserve x llvmcall ($ """
407407 %ptr = inttoptr i$WORD_SIZE %0 to $lt *
408408 %rv = atomicrmw $rmw $lt * %ptr, $lt %1 acq_rel
409409 ret $lt %rv
410410 """ , $ typ, Tuple{Ptr{$ typ}, $ typ}, unsafe_convert (Ptr{$ typ}, x), v)
411411 else
412412 rmwop === :xchg || continue
413413 @eval $ fn (x:: Atomic{$typ} , v:: $typ ) =
414- llvmcall ($ """
414+ GC . @preserve x llvmcall ($ """
415415 %iptr = inttoptr i$WORD_SIZE %0 to $ilt *
416416 %ival = bitcast $lt %1 to $ilt
417417 %irv = atomicrmw $rmw $ilt * %iptr, $ilt %ival acq_rel
0 commit comments