Skip to content

Commit

Permalink
Fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Feb 26, 2019
1 parent 8f55669 commit b492ee5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/JuliaInterpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,17 @@ macro interpret(arg)
end
end

function set_compiled_methods()
# Work around #28 by preventing interpretation of all Base methods that have a ccall to memcpy
push!(compiled_methods, which(vcat, (Vector,)))
push!(compiled_methods, first(methods(Base._getindex_ra)))
push!(compiled_methods, first(methods(Base._setindex_ra!)))
end

function __init__()
set_compiled_methods()
end

include("precompile.jl")
_precompile_()

Expand Down
5 changes: 5 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ frame = JuliaInterpreter.enter_call(f, 3)
@test JuliaInterpreter.linenumber(frame, JuliaInterpreter.JuliaProgramCounter(3)) == defline + 4
@test JuliaInterpreter.linenumber(frame, JuliaInterpreter.JuliaProgramCounter(5)) == defline + 6

# issue #28
let a = ['0'], b = ['a']
@test @interpret(vcat(a, b)) == vcat(a, b)
end

# issue #51
if isdefined(Core.Compiler, :SNCA)
ci = @code_lowered gcd(10, 20)
Expand Down
1 change: 1 addition & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function configure_test()
# in particular those that are used by the Test infrastructure
cm = JuliaInterpreter.compiled_methods
empty!(cm)
JuliaInterpreter.set_compiled_methods()
push!(cm, which(Test.eval_test, Tuple{Expr, Expr, LineNumberNode}))
push!(cm, which(Test.get_testset, Tuple{}))
push!(cm, which(Test.push_testset, Tuple{Test.AbstractTestSet}))
Expand Down

0 comments on commit b492ee5

Please sign in to comment.