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

disable gcroot creation for a value with an existing root #17379

Merged
merged 1 commit into from
Jul 12, 2016
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
4 changes: 2 additions & 2 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ static bool emit_getfield_unknownidx(jl_cgval_t *ret, const jl_cgval_t &strct, V
builder.CreateGEP(data_pointer(strct, ctx), idx)));
if ((unsigned)stt->ninitialized != nfields)
null_pointer_check(fld, ctx);
*ret = mark_julia_type(fld, true, jl_any_type, ctx, true);
*ret = mark_julia_type(fld, true, jl_any_type, ctx, strct.gcroot || !strct.isimmutable);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure, can this handle strct being reassigned later?

e.g.

for i in rng
    x = return_immutable()
    cond && y = x.field
end
use(y)

Copy link
Member Author

Choose a reason for hiding this comment

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

cgval (and thus this gcroot field) should be ssa. in your example above, the gcroot should have been created for x, and thus non-null, no?

return true;
}
else if (is_tupletype_homogeneous(stt->types)) {
Expand Down Expand Up @@ -1110,7 +1110,7 @@ static jl_cgval_t emit_getfield_knownidx(const jl_cgval_t &strct, unsigned idx,
Value *fldv = tbaa_decorate(tbaa, builder.CreateLoad(emit_bitcast(addr, T_ppjlvalue)));
if (idx >= (unsigned)jt->ninitialized)
null_pointer_check(fldv, ctx);
jl_cgval_t ret = mark_julia_type(fldv, true, jfty, ctx, true);
jl_cgval_t ret = mark_julia_type(fldv, true, jfty, ctx, strct.gcroot || !strct.isimmutable);
return ret;
}
else {
Expand Down