Skip to content

Commit

Permalink
disable gcroot creation for a value with an existing root
Browse files Browse the repository at this point in the history
when loading a value from a struct that didn't need a local gcroot,
the loaded value also doesn't require a gcroot if the struct was immutable

fix #17342
  • Loading branch information
vtjnash committed Jul 11, 2016
1 parent a862723 commit 111532e
Showing 1 changed file with 2 additions and 2 deletions.
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);
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

0 comments on commit 111532e

Please sign in to comment.