Skip to content

WIP: enable GC sooner when loading precompiled modules#21185

Closed
JeffBezanson wants to merge 1 commit intomasterfrom
jb/gcprecompiled
Closed

WIP: enable GC sooner when loading precompiled modules#21185
JeffBezanson wants to merge 1 commit intomasterfrom
jb/gcprecompiled

Conversation

@JeffBezanson
Copy link
Copy Markdown
Member

part of #20671

Loading the module still takes a long time, but now it actually completes instead of using a huge amount of memory (and, on my laptop at least, getting OOMkilled).

@ararslan ararslan added GC Garbage collector modules labels Mar 27, 2017
@ararslan
Copy link
Copy Markdown
Member

Dunno if this affects any of Nanosoldier's benchmarks, but...

@nanosoldier runbenchmarks(ALL, vs=":master")

@yuyichao
Copy link
Copy Markdown
Contributor

I thought @vtjnash has something that doesn't require creating the array eagerly. (It's almost the same format as gc frames...) Why can't that be added to jl_gc_mark_deserializer_state?

jl_gc_enable(en);

jl_insert_methods(&external_methods); // hook up methods of external generic functions (needs to be after recache types)
jl_recache_other(); // make all of the other objects identities correct (needs to be after insert methods)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After this step, some new objects (from the flagref list) may be only accessible from old objects. I think we'll either need to update the flagref to track the parent so we can add the gc_wb in here, or prevent promotion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This call also re-writes the contents of the external_methods linked list (which is why it isn't stored in an array in the first place, since we need to ensure that the memory doesn't move during push). A better alternative strategy here is perhaps to build the deserialization state directly into extmeths. We probably just will need to pre-allocate the length (probably by calculating it during the serialization step – perhaps just collect them into an array and serializing that would work).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, yeah, I now remember that was the issue....

}
for (i=0; i < backref_list.len; i++) {
jl_gc_push_root(ptls, (jl_value_t*)backref_list.items[i]);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should never revisit the backref list after this point, so there's no need to root it

if (loc)
jl_gc_push_root(ptls, *loc);
i += 2;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the flagref_list should only ever point to things that are part of the referenced elsewhere, so there's no need to root it

Copy link
Copy Markdown
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

needs a rewrite

@JeffBezanson JeffBezanson changed the title enable GC sooner when loading precompiled modules WIP: enable GC sooner when loading precompiled modules Mar 27, 2017
@nanosoldier
Copy link
Copy Markdown
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@JeffBezanson JeffBezanson added compiler:precompilation Precompilation of modules and removed modules labels Mar 28, 2017
@vtjnash vtjnash closed this Jun 12, 2017
@ararslan ararslan deleted the jb/gcprecompiled branch June 12, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:precompilation Precompilation of modules GC Garbage collector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants