Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

Commit 8d223dc

Browse files
committed
Thwart optimizer in bump allocator example
1 parent e32ff30 commit 8d223dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/bump-allocator.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ mutable struct Box{T}
77
value::T
88
end
99

10+
@noinline function escape(obj)
11+
Base.pointer_from_objref(obj)
12+
end
13+
1014
function vcopy(a, b)
1115
i = (blockIdx().x-1) * blockDim().x + threadIdx().x
1216
box = Box(a[i])
17+
escape(box)
1318
b[i] = box.value
1419
return
1520
end

0 commit comments

Comments
 (0)