You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/driver.jl
+14-47Lines changed: 14 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -19,52 +19,22 @@ export JuliaContext
19
19
# unique context on all other versions. Once we only support Julia 1.9, we'll deprecate
20
20
# this helper to a regular `Context()` call.
21
21
functionJuliaContext(; opaque_pointers=nothing)
22
-
ifVERSION>=v"1.9.0-DEV.516"
23
-
# Julia 1.9 knows how to deal with arbitrary contexts,
24
-
# and uses ORC's thread safe versions.
25
-
ctx =ThreadSafeContext(; opaque_pointers)
26
-
elseifVERSION>=v"1.9.0-DEV.115"
27
-
# Julia 1.9 knows how to deal with arbitrary contexts
28
-
ctx =Context(; opaque_pointers)
29
-
else
30
-
# earlier versions of Julia claim so, but actually use a global context
31
-
isboxed_ref =Ref{Bool}()
32
-
typ =LLVMType(ccall(:jl_type_to_llvm, LLVM.API.LLVMTypeRef,
33
-
(Any, Ptr{Bool}), Any, isboxed_ref))
34
-
ctx =context(typ)
35
-
if opaque_pointers !==nothing&&supports_typed_pointers(ctx) !==!opaque_pointers
36
-
error("Cannot use $(opaque_pointers ?"opaque":"typed") pointers, as the context has already been configured to use $(supports_typed_pointers(ctx) ?"typed":"opaque") pointers, and this version of Julia does not support changing that.")
37
-
end
38
-
end
39
-
40
-
ctx
22
+
#XXX: remove
23
+
ThreadSafeContext(; opaque_pointers)
41
24
end
42
25
functionJuliaContext(f; kwargs...)
43
-
ifVERSION>=v"1.9.0-DEV.516"
44
-
ts_ctx =JuliaContext(; kwargs...)
45
-
# for now, also activate the underlying context
46
-
#XXX: this is wrong; we can't expose the underlying LLVM context, but should
47
-
# instead always go through the callback in order to unlock it properly.
48
-
# rework this once we depend on Julia 1.9 or later.
49
-
ctx =context(ts_ctx)
50
-
activate(ctx)
51
-
try
52
-
f(ctx)
53
-
finally
54
-
deactivate(ctx)
55
-
dispose(ts_ctx)
56
-
end
57
-
elseifVERSION>=v"1.9.0-DEV.115"
58
-
Context(f)
59
-
else
60
-
ctx =JuliaContext()
61
-
activate(ctx)
62
-
try
63
-
f(ctx)
64
-
finally
65
-
deactivate(ctx)
66
-
# we cannot dispose of the global unique context
67
-
end
26
+
ts_ctx =JuliaContext(; kwargs...)
27
+
# for now, also activate the underlying context
28
+
#XXX: this is wrong; we can't expose the underlying LLVM context, but should
29
+
# instead always go through the callback in order to unlock it properly.
30
+
# rework this once we depend on Julia 1.9 or later.
31
+
ctx =context(ts_ctx)
32
+
activate(ctx)
33
+
try
34
+
f(ctx)
35
+
finally
36
+
deactivate(ctx)
37
+
dispose(ts_ctx)
68
38
end
69
39
end
70
40
@@ -118,9 +88,6 @@ function codegen(output::Symbol, @nospecialize(job::CompilerJob);
0 commit comments