From 08d51003d142e89b9d2f66187a4ea50e12b94fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jeli=C5=84ski?= Date: Mon, 27 May 2024 05:23:26 +0000 Subject: [PATCH] 8332724: x86 MacroAssembler may over-align code Reviewed-by: dlong, kvn --- src/hotspot/cpu/x86/assembler_x86.cpp | 2 +- src/hotspot/cpu/x86/assembler_x86.hpp | 2 +- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 10 +++++----- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index ee9e2064941..b02cca92cd4 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -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 diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 32a81519f82..41a63924828 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1800,7 +1800,7 @@ private: void negq(Address dst); #endif - void nop(int i = 1); + void nop(uint i = 1); void notl(Register dst); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index d20f34e27b8..01372f0c53a 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -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)); } diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index c69c8c0d447..b9f14da3db6 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -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)