Skip to content

Commit

Permalink
8332724: x86 MacroAssembler may over-align code
Browse files Browse the repository at this point in the history
Reviewed-by: dlong, kvn
  • Loading branch information
djelinski committed May 27, 2024
1 parent 97ee2ff commit 08d5100
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 @@ -3918,7 +3918,7 @@ void Assembler::negl(Address dst) {
emit_operand(as_Register(3), dst, 0);
}

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 @@ -1800,7 +1800,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 @@ -1150,20 +1150,20 @@ void MacroAssembler::addpd(XMMRegister dst, AddressLiteral src, Register rscratc
// 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 @@ -213,8 +213,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);

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

5 comments on commit 08d5100

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 08d5100 Sep 13, 2024

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 08d5100 Sep 13, 2024

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 08d5100 Sep 13, 2024

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-08d51003-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 08d51003 from the openjdk/jdk repository.

The commit being backported was authored by Daniel Jeliński on 27 May 2024 and was reviewed by Dean Long and Vladimir Kozlov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-08d51003-master:backport-GoeLin-08d51003-master
$ git checkout backport-GoeLin-08d51003-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-08d51003-master

@openjdk
Copy link

@openjdk openjdk bot commented on 08d5100 Sep 13, 2024

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-08d51003-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 08d51003 from the openjdk/jdk repository.

The commit being backported was authored by Daniel Jeliński on 27 May 2024 and was reviewed by Dean Long and Vladimir Kozlov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-08d51003-master:backport-GoeLin-08d51003-master
$ git checkout backport-GoeLin-08d51003-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-08d51003-master

Please sign in to comment.