Skip to content

Commit

Permalink
8325074: ZGC fails assert(index == 0 || is_power_of_2(index)) failed:…
Browse files Browse the repository at this point in the history
… Incorrect load shift: 11

Backport-of: 2705ed0a71e606a517518569d60051c85ad3c516
  • Loading branch information
shipilev committed Feb 22, 2024
1 parent 3b4932b commit 9adc281
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/hotspot/share/gc/z/zBarrierSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ void ZBarrierSet::on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) {
deoptimize_allocation(thread);
}

void ZBarrierSet::clone_obj_array(objArrayOop src_obj, objArrayOop dst_obj, size_t size) {
void ZBarrierSet::clone_obj_array(objArrayOop src_obj, objArrayOop dst_obj) {
volatile zpointer* src = (volatile zpointer*)src_obj->base();
volatile zpointer* dst = (volatile zpointer*)dst_obj->base();
const int length = src_obj->length();

for (const zpointer* const end = cast_from_oop<const zpointer*>(src_obj) + size; src < end; src++, dst++) {
for (const volatile zpointer* const end = src + length; src < end; src++, dst++) {
zaddress elem = ZBarrier::load_barrier_on_oop_field(src);
// We avoid healing here because the store below colors the pointer store good,
// hence avoiding the cost of a CAS.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zBarrierSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ZBarrierSet : public BarrierSet {
static ZBarrierSetAssembler* assembler();
static bool barrier_needed(DecoratorSet decorators, BasicType type);

static void clone_obj_array(objArrayOop src, objArrayOop dst, size_t size);
static void clone_obj_array(objArrayOop src, objArrayOop dst);

virtual void on_thread_create(Thread* thread);
virtual void on_thread_destroy(Thread* thread);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zBarrierSet.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ inline void ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(o
// for cloning arrays transform the clone to an optimized allocation
// and arraycopy sequence, so the performance of this runtime call
// does not matter for object arrays.
clone_obj_array(objArrayOop(src), objArrayOop(dst), size);
clone_obj_array(objArrayOop(src), objArrayOop(dst));
return;
}

Expand Down

1 comment on commit 9adc281

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.