Skip to content

Commit

Permalink
fix test and gcroot that was broken by jb/functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Feb 11, 2016
1 parent 2fbfd0e commit f6e9f8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/codegen.cpp
Expand Up @@ -3031,6 +3031,7 @@ static jl_cgval_t emit_call(jl_value_t **args, size_t arglen, jl_codectx_t *ctx,
else {
fval = emit_expr(args[0], ctx);
}
jl_add_linfo_root(ctx->linfo, (jl_value_t*)li);
result = emit_call_function_object(li, fval, theFptr, args, nargs, expr, ctx);
ctx->gc.argDepth = argStart;
JL_GC_POP();
Expand Down
4 changes: 2 additions & 2 deletions test/core.jl
Expand Up @@ -3547,7 +3547,7 @@ let i = Any[[1.23], [2.34]]
# f() with capture variables
# Intentionally type unstable so that the dynamic dispatch will
# read the corrupted tag if the object is incorrectly GC'd.
global f() = i[1][1] * i[2][1]
global @noinline f() = i[1][1] * i[2][1]
end

# Another function that use f()
Expand All @@ -3557,7 +3557,7 @@ g()

let i = 9.0
# Override f()
global f() = i + 1
global @noinline f() = i + 1
end

# Make sure the old f() method is GC'd if it was not rooted properly
Expand Down

3 comments on commit f6e9f8d

@yuyichao
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

............. The tests passed because it was inlined?...............

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course – it's a simple one-liner function :)

@carnaval
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you say that like the inlining pass has some kind of rational behavior

Please sign in to comment.