Skip to content

Commit

Permalink
8344607: Link Time Optimization - basic support for clang
Browse files Browse the repository at this point in the history
Reviewed-by: lucy, jkern, ihse
  • Loading branch information
MBaesken committed Dec 5, 2024
1 parent 5a0899f commit 85fedbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions make/hotspot/lib/JvmFeatures.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ ifeq ($(call check-jvm-feature, link-time-opt), true)
-fno-fat-lto-objects
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto \
-fuse-linker-plugin -fno-strict-aliasing
else ifeq ($(call isCompiler, clang), true)
JVM_CFLAGS_FEATURES += -flto -fno-strict-aliasing
ifeq ($(call isBuildOs, aix), true)
JVM_CFLAGS_FEATURES += -ffat-lto-objects
endif
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto -fno-strict-aliasing
else ifeq ($(call isCompiler, microsoft), true)
JVM_CFLAGS_FEATURES += -GL
JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL
Expand Down
9 changes: 5 additions & 4 deletions src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
}

extern "C" {
// needs local assembler label '1:' to avoid trouble when using linktime optimization
int SpinPause() {
// We don't use StubRoutines::aarch64::spin_wait stub in order to
// avoid a costly call to os::current_thread_enable_wx() on MacOS.
Expand All @@ -523,14 +524,14 @@ extern "C" {
// to entry for case SpinWait::NOP
" add %[d], %[d], %[o] \n"
" br %[d] \n"
" b SpinPause_return \n" // case SpinWait::NONE (-1)
" b 1f \n" // case SpinWait::NONE (-1)
" nop \n" // padding
" nop \n" // case SpinWait::NOP ( 0)
" b SpinPause_return \n"
" b 1f \n"
" isb \n" // case SpinWait::ISB ( 1)
" b SpinPause_return \n"
" b 1f \n"
" yield \n" // case SpinWait::YIELD ( 2)
"SpinPause_return: \n"
"1: \n"
: [d]"=&r"(br_dst)
: [o]"r"(off)
: "memory");
Expand Down

0 comments on commit 85fedbf

Please sign in to comment.