Skip to content

Commit 59fd5de

Browse files
committed
Properly call the GC runtime function with the state argument.
As we lower intrinsics after optimization, we should manually add the kernel state argument.
1 parent 67adf26 commit 59fd5de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/optim.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,14 @@ function lower_gc_frame!(fun::LLVM.Function)
257257
sz = ops[2]
258258

259259
# replace with PTX alloc_obj
260-
let builder = Builder(ctx)
260+
Builder(ctx) do builder
261+
# NOTE: this happens late during the pipeline, where we may have to
262+
# pass a kernel state arguments to the runtime function.
263+
state = kernel_state_type(job)
264+
261265
position!(builder, call)
262-
ptr = call!(builder, Runtime.get(:gc_pool_alloc), [sz])
266+
ptr = call!(builder, Runtime.get(:gc_pool_alloc), [sz]; state)
263267
replace_uses!(call, ptr)
264-
dispose(builder)
265268
end
266269

267270
unsafe_delete!(LLVM.parent(call), call)

0 commit comments

Comments
 (0)