Skip to content

Commit ba242f1

Browse files
committed
Update to julia#57828
1 parent 04b53cd commit ba242f1

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/workloads.jl

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const newly_inferred = Core.CodeInstance[]
1+
const newly_inferred = Core.CodeInstance[] # only used to support verbose[]
22

33
function workload_enabled(mod::Module)
44
try
@@ -12,16 +12,23 @@ function workload_enabled(mod::Module)
1212
end
1313
end
1414

15-
cache_newly_inferred() = ccall(:jl_set_newly_inferred, Cvoid, (Any,), newly_inferred)
16-
17-
@noinline function precompile_newly_inferred()
18-
ccall(:jl_set_newly_inferred, Cvoid, (Any,), nothing) # ensure we drop internally references to both newly_inferred arrays so that it is safe to access them here
19-
for child in newly_inferred # set the must-precompile bit on all new code
20-
precompile_mi((child::Base.CodeInstance).def)
15+
function tag_newly_inferred_enable()
16+
ccall(:jl_tag_newly_inferred_enable, Cvoid, ())
17+
if !Base.generating_output() # for verbose[]
18+
ccall(:jl_set_newly_inferred, Cvoid, (Any,), newly_inferred)
19+
end
20+
end
21+
function tag_newly_inferred_disable()
22+
ccall(:jl_tag_newly_inferred_disable, Cvoid, ())
23+
if !Base.generating_output() # for verbose[]
24+
ccall(:jl_set_newly_inferred, Cvoid, (Any,), nothing)
25+
end
26+
if verbose[]
27+
for ci in newly_inferred
28+
println(ci.def)
29+
end
2130
end
22-
append!(Base.newly_inferred, newly_inferred) # request the new code be included in the serialized file
23-
empty!(newly_inferred)
24-
nothing
31+
return nothing
2532
end
2633

2734
"""
@@ -61,11 +68,11 @@ macro compile_workload(ex::Expr)
6168
end
6269
end
6370
ex = quote
64-
$PrecompileTools.cache_newly_inferred()
71+
$PrecompileTools.tag_newly_inferred_enable()
6572
try
6673
$ex
6774
finally
68-
$PrecompileTools.precompile_newly_inferred()
75+
$PrecompileTools.tag_newly_inferred_disable()
6976
end
7077
end
7178
return quote

0 commit comments

Comments
 (0)