Skip to content

Commit 2538b85

Browse files
authored
Merge branch 'master' into Base_arrays_append_vector_typeassert
2 parents 9135be5 + 1e03ed6 commit 2538b85

File tree

6 files changed

+42
-17
lines changed

6 files changed

+42
-17
lines changed

base/expr.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ Give a hint to the compiler that calls within `block` are worth inlining.
256256
end
257257
```
258258
259+
!!! note
260+
The callsite annotation applies to all calls in the block, including function arguments
261+
that are themselves calls:
262+
```julia
263+
# The compiler will not inline `getproperty`, `g` or `f`
264+
@noinline f(x.inner, g(y))
265+
```
266+
259267
!!! note
260268
When there are nested callsite annotations, the innermost annotation has the precedence:
261269
```julia

base/precompilation.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,16 @@ function ExplicitEnv(envpath::String=Base.active_project())
143143

144144
# Extensions
145145
deps_pkg = get(Dict{String, Any}, pkg_info, "extensions")::Dict{String, Any}
146+
deps_pkg_concrete = Dict{String, Vector{String}}()
146147
for (ext, triggers) in deps_pkg
147148
if triggers isa String
148149
triggers = [triggers]
149150
else
150151
triggers = triggers::Vector{String}
151152
end
152-
deps_pkg[ext] = triggers
153+
deps_pkg_concrete[ext] = triggers
153154
end
154-
extensions[m_uuid] = deps_pkg
155+
extensions[m_uuid] = deps_pkg_concrete
155156

156157
# Determine strategy to find package
157158
lookup_strat = begin

src/julia-syntax.scm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,9 @@
11851185
(cond ((and (length= e 2) (or (symbol? name) (globalref? name)))
11861186
(if (not (valid-name? name))
11871187
(error (string "invalid function name \"" name "\"")))
1188-
`(method ,name))
1188+
(if (globalref? name)
1189+
`(block (global ,name) (method ,name))
1190+
`(block (global-if-global ,name) (method ,name))))
11891191
((not (pair? name)) e)
11901192
((eq? (car name) 'call)
11911193
(let* ((raw-typevars (or where '()))
@@ -3131,6 +3133,10 @@
31313133
(if (eq? (var-kind (cadr e) scope) 'local)
31323134
(if (length= e 2) (null) `(= ,@(cdr e)))
31333135
`(const ,@(cdr e))))
3136+
((eq? (car e) 'global-if-global)
3137+
(if (eq? (var-kind (cadr e) scope) 'local)
3138+
'(null)
3139+
`(global ,@(cdr e))))
31343140
((memq (car e) '(local local-def))
31353141
(check-valid-name (cadr e))
31363142
;; remove local decls
@@ -3763,7 +3769,7 @@ f(x) = yt(x)
37633769
(Set '(quote top core lineinfo line inert local-def unnecessary copyast
37643770
meta inbounds boundscheck loopinfo decl aliasscope popaliasscope
37653771
thunk with-static-parameters toplevel-only
3766-
global globalref assign-const-if-global isglobal thismodule
3772+
global globalref global-if-global assign-const-if-global isglobal thismodule
37673773
const atomic null true false ssavalue isdefined toplevel module lambda
37683774
error gc_preserve_begin gc_preserve_end import using export public inline noinline purity)))
37693775

src/safepoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void jl_gc_wait_for_the_world(jl_ptls_t* gc_all_tls_states, int gc_n_threads)
157157
uv_mutex_unlock(&safepoint_lock);
158158
}
159159
else {
160-
const int64_t timeout = jl_options.timeout_for_safepoint_straggler_s * 1000000000; // convert to nanoseconds
160+
const int64_t timeout = jl_options.timeout_for_safepoint_straggler_s * 1000000000LL; // convert to nanoseconds
161161
int ret = 0;
162162
uv_mutex_lock(&safepoint_lock);
163163
if (!jl_atomic_load_relaxed(&ptls2->gc_state)) {

test/syntax.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,3 +4119,11 @@ end
41194119
# Issue #56904 - lambda linearized twice
41204120
@test (let; try 3; finally try 1; f(() -> x); catch x; end; end; x = 7; end) === 7
41214121
@test (let; try 3; finally try 4; finally try 1; f(() -> x); catch x; end; end; end; x = 7; end) === 7
4122+
4123+
# Issue #57546 - explicit function declaration should create new global
4124+
module FuncDecl57546
4125+
using Test
4126+
@test_nowarn @eval function Any end
4127+
@test isa(Any, Function)
4128+
@test isempty(methods(Any))
4129+
end

test/threads_exec.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,25 +1630,27 @@ end
16301630
program = "
16311631
function main()
16321632
t = Threads.@spawn begin
1633-
ccall(:uv_sleep, Cvoid, (Cuint,), 5000)
1633+
ccall(:uv_sleep, Cvoid, (Cuint,), 20_000)
16341634
end
16351635
# Force a GC
1636-
ccall(:uv_sleep, Cvoid, (Cuint,), 1000)
1636+
ccall(:uv_sleep, Cvoid, (Cuint,), 1_000)
16371637
GC.gc()
16381638
wait(t)
16391639
end
16401640
main()
16411641
"
1642-
tmp_output_filename = tempname()
1643-
tmp_output_file = open(tmp_output_filename, "w")
1644-
if isnothing(tmp_output_file)
1645-
error("Failed to open file $tmp_output_filename")
1646-
end
1647-
run(pipeline(`$(Base.julia_cmd()) --threads=4 --timeout-for-safepoint-straggler=1 -e $program`, stderr=tmp_output_file))
1648-
# Check whether we printed the straggler's backtrace
1649-
@test !isempty(read(tmp_output_filename, String))
1650-
close(tmp_output_file)
1651-
rm(tmp_output_filename)
1642+
for timeout in ("1", "4", "16")
1643+
tmp_output_filename = tempname()
1644+
tmp_output_file = open(tmp_output_filename, "w")
1645+
if isnothing(tmp_output_file)
1646+
error("Failed to open file $tmp_output_filename")
1647+
end
1648+
run(pipeline(`$(Base.julia_cmd()) --threads=4 --timeout-for-safepoint-straggler=$(timeout) -e $program`, stderr=tmp_output_file))
1649+
# Check whether we printed the straggler's backtrace
1650+
@test !isempty(read(tmp_output_filename, String))
1651+
close(tmp_output_file)
1652+
rm(tmp_output_filename)
1653+
end
16521654
end
16531655

16541656
end # main testset

0 commit comments

Comments
 (0)