-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8320275: assert(_chunk->bitmap().at(index)) failed: Bit not set at index #16837
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f117421
v1
pchilano 247f041
remove round up on java_calling_convention
pchilano 42478a4
add is_aligned assert in stackChunkOopDesc::bit_index_for
pchilano 4f580f5
add comment in clear_bitmap_bits()
pchilano 917c4b6
Merge branch 'master' into JDK-8320275
pchilano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1775,7 +1775,7 @@ class ThawBase : public StackObj { | |
| inline void before_thaw_java_frame(const frame& hf, const frame& caller, bool bottom, int num_frame); | ||
| inline void after_thaw_java_frame(const frame& f, bool bottom); | ||
| inline void patch(frame& f, const frame& caller, bool bottom); | ||
| void clear_bitmap_bits(intptr_t* start, int range); | ||
| void clear_bitmap_bits(address start, address end); | ||
|
|
||
| NOINLINE void recurse_thaw_interpreted_frame(const frame& hf, frame& caller, int num_frames); | ||
| void recurse_thaw_compiled_frame(const frame& hf, frame& caller, int num_frames, bool stub_caller); | ||
|
|
@@ -2166,13 +2166,22 @@ inline void ThawBase::patch(frame& f, const frame& caller, bool bottom) { | |
| assert(!bottom || (_cont.is_empty() != Continuation::is_cont_barrier_frame(f)), ""); | ||
| } | ||
|
|
||
| void ThawBase::clear_bitmap_bits(intptr_t* start, int range) { | ||
| void ThawBase::clear_bitmap_bits(address start, address end) { | ||
| assert(is_aligned(start, wordSize), "should be aligned: " PTR_FORMAT, p2i(start)); | ||
| assert(is_aligned(end, VMRegImpl::stack_slot_size), "should be aligned: " PTR_FORMAT, p2i(end)); | ||
|
|
||
| // we need to clear the bits that correspond to arguments as they reside in the caller frame | ||
| // or they will keep objects that are otherwise unreachable alive | ||
| log_develop_trace(continuations)("clearing bitmap for " INTPTR_FORMAT " - " INTPTR_FORMAT, p2i(start), p2i(start+range)); | ||
| // or they will keep objects that are otherwise unreachable alive. | ||
|
|
||
| // Align `end` if UseCompressedOops is not set to avoid UB when calculating the bit index, since | ||
| // `end` could be at an odd number of stack slots from `start`, i.e might not be oop aligned. | ||
| // If that's the case the bit range corresponding to the last stack slot should not have bits set | ||
| // anyways and we assert that before returning. | ||
| address effective_end = UseCompressedOops ? end : align_down(end, wordSize); | ||
| log_develop_trace(continuations)("clearing bitmap for " INTPTR_FORMAT " - " INTPTR_FORMAT, p2i(start), p2i(effective_end)); | ||
| stackChunkOop chunk = _cont.tail(); | ||
| chunk->bitmap().clear_range(chunk->bit_index_for(start), | ||
| chunk->bit_index_for(start+range)); | ||
| chunk->bitmap().clear_range(chunk->bit_index_for(start), chunk->bit_index_for(effective_end)); | ||
| assert(chunk->bitmap().count_one_bits(chunk->bit_index_for(effective_end), chunk->bit_index_for(end)) == 0, "bits should not be set"); | ||
| } | ||
|
|
||
| NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& caller, int num_frames) { | ||
|
|
@@ -2225,7 +2234,9 @@ NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& c | |
| _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance); | ||
| } else if (_cont.tail()->has_bitmap() && locals > 0) { | ||
| assert(hf.is_heap_frame(), "should be"); | ||
| clear_bitmap_bits(heap_frame_bottom - locals, locals); | ||
| address start = (address)(heap_frame_bottom - locals); | ||
| address end = (address)heap_frame_bottom; | ||
| clear_bitmap_bits(start, end); | ||
| } | ||
|
|
||
| DEBUG_ONLY(after_thaw_java_frame(f, is_bottom_frame);) | ||
|
|
@@ -2298,7 +2309,10 @@ void ThawBase::recurse_thaw_compiled_frame(const frame& hf, frame& caller, int n | |
| // can only fix caller once this frame is thawed (due to callee saved regs); this happens on the stack | ||
| _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance); | ||
| } else if (_cont.tail()->has_bitmap() && added_argsize > 0) { | ||
| clear_bitmap_bits(heap_frame_top + ContinuationHelper::CompiledFrame::size(hf) + frame::metadata_words_at_top, added_argsize); | ||
| address start = (address)(heap_frame_top + ContinuationHelper::CompiledFrame::size(hf) + frame::metadata_words_at_top); | ||
| int stack_args_slots = f.cb()->as_compiled_method()->method()->num_stack_arg_slots(false /* rounded */); | ||
|
Member
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. It would be nice if we could trust the |
||
| int argsize_in_bytes = stack_args_slots * VMRegImpl::stack_slot_size; | ||
| clear_bitmap_bits(start, start + argsize_in_bytes); | ||
| } | ||
|
|
||
| DEBUG_ONLY(after_thaw_java_frame(f, is_bottom_frame);) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is the align_down for correctness, or just for the benefit of the new assert at line 2179? Since it's not immediately obvious, I think it deserves a comment.
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.
Because
endis not necessarily word aligned anymore the pointer arithmetic we do in bit_index_for() would be UB, sincepcan point to the middle of an oop (in practice we would probably not see any issue because that's implemented as a substraction and then an arithmetic shift right which will round down the result). So we need to alignenddown if UseCompressedOops is not set. That last half word part should not contain an oop anyways so the assert is to verify that. I added a comment, please take a look.