Skip to content

Commit

Permalink
more adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jan 5, 2024
1 parent 42194af commit 39cf335
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function lookup_expr(frame, e::Expr)
error("invalid lookup expr ", e)

Check warning on line 77 in src/interpret.jl

View check run for this annotation

Codecov / codecov/patch

src/interpret.jl#L77

Added line #L77 was not covered by tests
end


# This is used only for new struct/abstract/primitive nodes.
# The most important issue is that in these expressions, :call Exprs can be nested,
# and hence our re-use of the `callargs` field of Frame would introduce
Expand All @@ -103,18 +102,20 @@ function lookup_or_eval(@nospecialize(recurse), frame, @nospecialize(node))
f = ex.args[1]
if f === Core.svec
popfirst!(ex.args)
return f(ex.args...)
return Core.svec(ex.args...)
elseif f === Core.apply_type
popfirst!(ex.args)
return f(ex.args...)
elseif f === Core.typeof && length(ex.args) == 2
return f(ex.args[2])
return Core.apply_type(ex.args...)
elseif f === typeof && length(ex.args) == 2
return typeof(ex.args[2])

Check warning on line 110 in src/interpret.jl

View check run for this annotation

Codecov / codecov/patch

src/interpret.jl#L110

Added line #L110 was not covered by tests
elseif f === typeassert && length(ex.args) == 3
return typeassert(ex.args[2], ex.args[3])
elseif f === Base.getproperty && length(ex.args) == 3
return f(ex.args[2], ex.args[3])
return Base.getproperty(ex.args[2], ex.args[3])
elseif f === Core.Compiler.Val && length(ex.args) == 2
return f(ex.args[2])
return Core.Compiler.Val(ex.args[2])
elseif f === Val && length(ex.args) == 2
return f(ex.args[2])
return Val(ex.args[2])
else
Base.invokelatest(error, "unknown call f introduced by ccall lowering ", f)

Check warning on line 120 in src/interpret.jl

View check run for this annotation

Codecov / codecov/patch

src/interpret.jl#L120

Added line #L120 was not covered by tests
end
Expand Down
4 changes: 4 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ function scan_ssa_use!(used::BitSet, @nospecialize(stmt))
while iterval !== nothing
useref, state = iterval
val = Core.Compiler.getindex(useref)
if isexpr(val, :call)
# work around for a linearization bug in Julia (https://github.com/JuliaLang/julia/pull/52497)
scan_ssa_use!(used, val)
end
if isa(val, SSAValue)
push!(used, val.id)
end
Expand Down

0 comments on commit 39cf335

Please sign in to comment.