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 8 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,11 +181,18 @@ 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. | ||
inline uint alloc_buffers_length(region_type_t dest) const; | ||
|
||
// Returns if BOT updates are needed for the given destinaion. Currently we only have | ||
// two destinations and BOT updates are only needed for the old generation. | ||
inline bool needs_bot_update(G1HeapRegionAttr dest) const; | ||
|
||
bool may_throw_away_buffer(size_t const allocation_word_sz, size_t const buffer_size) const; | ||
public: | ||
G1PLABAllocator(G1Allocator* allocator); | ||
@@ -198,6 +221,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_plab_allocation(G1HeapRegionAttr dest, size_t word_sz, uint node_index); | ||
|
||
void undo_allocation(G1HeapRegionAttr dest, HeapWord* obj, size_t word_sz, uint node_index); | ||
}; | ||
|
||
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: