Skip to content

Commit dce83c8

Browse files
committed
Don't fetch JIT info when --compile=no
1 parent 13e711a commit dce83c8

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

base/sysinfo.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ global CPU_NAME::String
134134
135135
A string representing the specific JIT compiler CPU target being utilized in the current runtime.
136136
137+
Set to an empty string if Julia was launched with `--compile=no`.
138+
137139
Note: Included in the output of `versioninfo()`.
138140
"""
139141
global JIT_CPU::String
@@ -143,6 +145,8 @@ global JIT_CPU::String
143145
144146
A string representing the specific JIT compiler target triple being utilized in the current runtime.
145147
148+
Set to an empty string if Julia was launched with `--compile=no`.
149+
146150
Note: Included in the output of `versioninfo()`.
147151
"""
148152
global JIT_TRIPLE::String
@@ -152,6 +156,8 @@ global JIT_TRIPLE::String
152156
153157
A string representing the specific Just-In-Time (JIT) compiler being utilized in the current runtime.
154158
159+
Set to an empty string if Julia was launched with `--compile=no`.
160+
155161
# Examples
156162
Currently, this equals `"ORCJIT"` for the LLVM "ORC" ("On-Request Compilation") JIT library:
157163
```jldoctest
@@ -197,10 +203,18 @@ function __init__()
197203
global EFFECTIVE_CPU_THREADS = min(CPU_THREADS, Int(ccall(:jl_effective_threads, Int32, ())))
198204
global SC_CLK_TCK = ccall(:jl_SC_CLK_TCK, Clong, ())
199205
global CPU_NAME = ccall(:jl_get_cpu_name, Ref{String}, ())
200-
global JIT = ccall(:jl_get_JIT, Ref{String}, ())
201-
_jit = ccall(:JLJITGetJuliaOJIT, Ptr{Cvoid}, ())
202-
global JIT_CPU = unsafe_string(ccall(:JLJITGetCPUString, Cstring, (Ptr{Cvoid},), _jit))
203-
global JIT_TRIPLE = unsafe_string(ccall(:JLJITGetTripleString, Cstring, (Ptr{Cvoid},), _jit))
206+
println(Base.JLOptions().compile_enabled)
207+
if Base.JLOptions().compile_enabled != 0
208+
global JIT = ccall(:jl_get_JIT, Ref{String}, ())
209+
_jit = ccall(:JLJITGetJuliaOJIT, Ptr{Cvoid}, ())
210+
global JIT_CPU = unsafe_string(ccall(:JLJITGetCPUString, Cstring, (Ptr{Cvoid},), _jit))
211+
global JIT_TRIPLE = unsafe_string(ccall(:JLJITGetTripleString, Cstring, (Ptr{Cvoid},), _jit))
212+
else
213+
global JIT = ""
214+
global JIT_CPU = ""
215+
global JIT_TRIPLE = ""
216+
end
217+
204218
global BASE_SYSIMG_TARGET = sysimage_target()
205219
global PAGESIZE = Int(Sys.isunix() ? ccall(:jl_getpagesize, Clong, ()) : ccall(:jl_getallocationgranularity, Clong, ()))
206220
__init_build()

stdlib/InteractiveUtils/src/InteractiveUtils.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function versioninfo(io::IO=stdout; verbose::Bool=false)
130130

131131
println(io, "Platform Info:")
132132
println(io, " OS: ", Sys.iswindows() ? "Windows" : Sys.isapple() ?
133-
"macOS" : Sys.KERNEL, " (", Sys.JIT_TRIPLE, ")")
133+
"macOS" : Sys.KERNEL)
134134

135135
if verbose
136136
lsb = ""
@@ -174,7 +174,12 @@ function versioninfo(io::IO=stdout; verbose::Bool=false)
174174

175175
println(io, " WORD_SIZE: ", Sys.WORD_SIZE)
176176
end
177-
println(io, " LLVM: libLLVM-", Base.libllvm_version, " (", Sys.JIT, ", ", Sys.JIT_CPU, ")")
177+
print(io, " LLVM: libLLVM-", Base.libllvm_version)
178+
if Sys.JIT == ""
179+
println(io, " (codegen disabled)")
180+
else
181+
println(io, " (", Sys.JIT, ": ", Sys.JIT_CPU, ", ", Sys.JIT_TRIPLE, ")")
182+
end
178183
println(io, """Threads: $(Threads.nthreads(:default)) default, $(Threads.nthreads(:interactive)) interactive, \
179184
$(Threads.ngcthreads()) GC (on $(Sys.CPU_THREADS) virtual cores)""")
180185

0 commit comments

Comments
 (0)