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

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jul 11, 2016

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

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
@JeffBezanson
Copy link
Member

Thank you!!

@@ -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?

@vtjnash vtjnash merged commit badd905 into master Jul 12, 2016
@vtjnash vtjnash deleted the jn/17342 branch July 12, 2016 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Another unnecessary GC root
3 participants