Skip to content

Commit

Permalink
8332724: x86 MacroAssembler may over-align code
Browse files Browse the repository at this point in the history
Backport-of: 08d51003d142e89b9d2f66187a4ea50e12b94fbb
  • Loading branch information
GoeLin committed Sep 17, 2024
1 parent 5a6a425 commit f7dff46
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/assembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3325,7 +3325,7 @@ void Assembler::negl(Address dst) {
emit_operand(as_Register(3), dst);
}

void Assembler::nop(int i) {
void Assembler::nop(uint i) {
#ifdef ASSERT
assert(i > 0, " ");
// The fancy nops aren't currently recognized by debuggers making it a
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/assembler_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ class Assembler : public AbstractAssembler {
void negq(Address dst);
#endif

void nop(int i = 1);
void nop(uint i = 1);

void notl(Register dst);

Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,20 +1175,20 @@ void MacroAssembler::addpd(XMMRegister dst, AddressLiteral src) {
// Stub code is generated once and never copied.
// NMethods can't use this because they get copied and we can't force alignment > 32 bytes.
void MacroAssembler::align64() {
align(64, (unsigned long long) pc());
align(64, (uint)(uintptr_t)pc());
}

void MacroAssembler::align32() {
align(32, (unsigned long long) pc());
align(32, (uint)(uintptr_t)pc());
}

void MacroAssembler::align(int modulus) {
void MacroAssembler::align(uint modulus) {
// 8273459: Ensure alignment is possible with current segment alignment
assert(modulus <= CodeEntryAlignment, "Alignment must be <= CodeEntryAlignment");
assert(modulus <= (uintx)CodeEntryAlignment, "Alignment must be <= CodeEntryAlignment");
align(modulus, offset());
}

void MacroAssembler::align(int modulus, int target) {
void MacroAssembler::align(uint modulus, uint target) {
if (target % modulus != 0) {
nop(modulus - (target % modulus));
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/macroAssembler_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ class MacroAssembler: public Assembler {
// Alignment
void align32();
void align64();
void align(int modulus);
void align(int modulus, int target);
void align(uint modulus);
void align(uint modulus, uint target);

// A 5 byte nop that is safe for patching (see patch_verified_entry)
void fat_nop();
Expand Down

1 comment on commit f7dff46

@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.