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
8276098: Do precise BOT updates in G1 evacuation phase #6166
Changes from 7 commits
e48ea28
33b044b
1fba102
98e9244
98fd1e2
6628314
e6ec3bd
df900c6
83049e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -145,6 +145,22 @@ class G1Allocator : public CHeapObj<mtGC> { | ||||||||||
uint node_index); | ||||||||||
}; | ||||||||||
|
||||||||||
// Specialized PLAB for old generation promotions. For old regions the | ||||||||||
// BOT needs to be updated and the relevant data to do this efficiently | ||||||||||
// is stored in the PLAB. | ||||||||||
class G1BotUpdatingPLAB : public PLAB { | ||||||||||
// An object spanning this threshold will cause a BOT update. | ||||||||||
HeapWord* _next_bot_threshold; | ||||||||||
// The region in which the PLAB resides. | ||||||||||
HeapRegion* _region; | ||||||||||
public: | ||||||||||
G1BotUpdatingPLAB(size_t word_sz) : PLAB(word_sz) { } | ||||||||||
// Sets the new PLAB buffer as well as updates the threshold and region. | ||||||||||
virtual void set_buf(HeapWord* buf, size_t word_sz); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please, since it makes the intention explicit and enforces it in compile-time. |
||||||||||
// Updates the BOT if the last allocation crossed the threshold. | ||||||||||
inline void update_bot(size_t word_sz); | ||||||||||
}; | ||||||||||
|
||||||||||
// Manages the PLABs used during garbage collection. Interface for allocation from PLABs. | ||||||||||
// Needs to handle multiple contexts, extra alignment in any "survivor" area and some | ||||||||||
// statistics. | ||||||||||
@@ -165,6 +181,9 @@ class G1PLABAllocator : public CHeapObj<mtGC> { | ||||||||||
inline PLAB* alloc_buffer(G1HeapRegionAttr dest, uint node_index) const; | ||||||||||
inline PLAB* alloc_buffer(region_type_t dest, uint node_index) const; | ||||||||||
|
||||||||||
// Helpers to do explicit BOT updates for allocations in old generation regions. | ||||||||||
void update_bot_for_direct_allocation(G1HeapRegionAttr attr, HeapWord* addr, size_t size); | ||||||||||
|
||||||||||
// Returns the number of allocation buffers for the given dest. | ||||||||||
// There is only 1 buffer for Old while Young may have multiple buffers depending on | ||||||||||
// active NUMA nodes. | ||||||||||
@@ -198,6 +217,9 @@ class G1PLABAllocator : public CHeapObj<mtGC> { | ||||||||||
bool* refill_failed, | ||||||||||
uint node_index); | ||||||||||
|
||||||||||
// Update the BOT for the last PLAB allocation. | ||||||||||
inline void update_bot_for_allocation(G1HeapRegionAttr dest, size_t word_sz, uint node_index); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Suggested change
I would explicitly call this out as to be used for PLAB allocation. If changed, obviously needs updates to the callers as well. |
||||||||||
|
||||||||||
void undo_allocation(G1HeapRegionAttr dest, HeapWord* obj, size_t word_sz, uint node_index); | ||||||||||
}; | ||||||||||
|
||||||||||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -103,6 +103,7 @@ struct G1HeapRegionAttr { | ||
bool is_young() const { return type() == Young; } | ||
bool is_old() const { return type() == Old; } | ||
bool is_optional() const { return type() == Optional; } | ||
bool needs_bot_update() const { return is_old(); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if that predicate needs to be here, I'd probably just add a method to |
||
|
||
#ifdef ASSERT | ||
bool is_default() const { return type() == NotInCSet; } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ternary operator can be used here: