Skip to content

fix #31965, bug in interpreter stacktraces and jl_code_requires_compiler #31967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ using Base.Meta
is_loc_meta(expr, kind) = isexpr(expr, :meta) && length(expr.args) >= 1 && expr.args[1] === kind
function lookup(ip::Base.InterpreterIP)
if ip.code isa Core.MethodInstance && ip.code.def isa Method
codeinfo = ip.code.inferred
codeinfo = ip.code.uninferred
func = ip.code.def.name
file = ip.code.def.file
line = ip.code.def.line
Expand Down
2 changes: 1 addition & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static void expr_attributes(jl_value_t *v, int *has_intrinsics, int *has_defs) J
jl_module_t *mod = jl_globalref_mod(f);
jl_sym_t *name = jl_globalref_name(f);
if (jl_binding_resolved_p(mod, name)) {
jl_binding_t *b = jl_get_module_binding(mod, name);
jl_binding_t *b = jl_get_binding(mod, name);
if (b && b->value && b->constp)
called = b->value;
}
Expand Down
2 changes: 1 addition & 1 deletion test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function choosetests(choices = [])
"errorshow", "sets", "goto", "llvmcall", "llvmcall2", "grisu",
"some", "meta", "stacktraces", "docs",
"misc", "threads", "stress",
"enums", "cmdlineargs", "int",
"enums", "cmdlineargs", "int", "interpreter",
"checked", "bitset", "floatfuncs", "precompile",
"boundscheck", "error", "ambiguous", "cartesian", "osutils",
"channels", "iostream", "secretbuffer", "specificity",
Expand Down
16 changes: 0 additions & 16 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6835,22 +6835,6 @@ struct T29145{A,B}
end
@test_throws TypeError T29145()

# interpreted but inferred/optimized top-level expressions with vars
let code = """
while true
try
this_is_undefined_29213
ed = 0
break
finally
break
end
end
print(42)
"""
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "42"
end

# issue #29175
function f29175(tuple::T) where {T<:Tuple}
prefix::Tuple{T.parameters[1:end-1]...} = tuple[1:length(T.parameters)-1]
Expand Down
32 changes: 32 additions & 0 deletions test/interpreter.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test

# interpreted but inferred/optimized top-level expressions with vars
let code = """
while true
try
this_is_undefined_29213
ed = 0
break
finally
break
end
end
print(42)
"""
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "42"
end

let code = "Threads.atomic_add!(Threads.Atomic{Int}(40), 2)"
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -E $code`, String) == "40\n"
end

let p = Pipe(),
c = pipeline(`$(Base.julia_cmd()) --startup-file=no --compile=min -E 'error()'`, stderr=p)
proc = run(c, wait=false)
readline(p)
@test readline(p) == "Stacktrace:"
wait(proc)
close(p)
end