Skip to content
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

Evaluating %new expressions: prepare args and ccall jl_new_structv #358

Merged
merged 1 commit into from
Dec 29, 2019
Merged
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
7 changes: 3 additions & 4 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,9 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
head = node.head
if head == :new
mod = moduleof(frame)
rhs = ccall(:jl_new_struct_uninit, Any, (Any,), @lookup(mod, frame, node.args[1]))
for i = 1:length(node.args) - 1
ccall(:jl_set_nth_field, Cvoid, (Any, Csize_t, Any), rhs, i-1, @lookup(mod, frame, node.args[i+1]))
end
args = [@lookup(mod, frame, arg) for arg in node.args]
T = popfirst!(args)
rhs = ccall(:jl_new_structv, Any, (Any, Ptr{Any}, UInt32), T, args, length(args))
return rhs
elseif head == :splatnew # Julia 1.2+
mod = moduleof(frame)
Expand Down