Skip to content

Commit

Permalink
8344355: Register corruption in MacroAssembler::lookup_secondary_supe…
Browse files Browse the repository at this point in the history
…rs_table_var: x86-64 only

Reviewed-by: vlivanov, martin, dlong, asemenov
  • Loading branch information
Andrew Haley committed Nov 27, 2024
1 parent 82137db commit eb0d1ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4912,6 +4912,10 @@ void MacroAssembler::population_count(Register dst, Register src,
}
bind(done);
}
#ifdef ASSERT
mov64(scratch1, 0xCafeBabeDeadBeef);
movq(scratch2, scratch1);
#endif
}

// Ensure that the inline code and the stub are using the same registers.
Expand Down Expand Up @@ -5113,6 +5117,7 @@ void MacroAssembler::lookup_secondary_supers_table_var(Register r_sub_klass,
const Register r_array_base = *available_regs++;

// Get the first array index that can contain super_klass into r_array_index.
// Note: Clobbers r_array_base and slot.
population_count(r_array_index, r_array_index, /*temp2*/r_array_base, /*temp3*/slot);

// NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word.
Expand All @@ -5130,7 +5135,7 @@ void MacroAssembler::lookup_secondary_supers_table_var(Register r_sub_klass,
jccb(Assembler::equal, L_success);

// Restore slot to its true value
xorl(slot, (u1)(Klass::SECONDARY_SUPERS_TABLE_SIZE - 1)); // slot ^ 63 === 63 - slot (mod 64)
movb(slot, Address(r_super_klass, Klass::hash_slot_offset()));

// Linear probe. Rotate the bitmap so that the next bit to test is
// in Bit 1.
Expand Down

0 comments on commit eb0d1ce

Please sign in to comment.