sendaoYan / riscv-port-jdk8u-ysd

https://openjdk.org/projects/riscv-port
GNU General Public License v2.0
0 stars 0 forks source link

[riscv64-8u]assembler_riscv.hpp:1974:46: error: macro "max" passed 3 arguments, but takes just 2 #1

Open sendaoYan opened 1 week ago

sendaoYan commented 1 week ago
/usr/bin/g++ -DLINUX -D_GNU_SOURCE -DRISCV64 -DPRODUCT -I. -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/prims -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/cpu/riscv/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os_cpu/linux_riscv/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os/linux/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os/posix/vm -I../generated -DHOTSPOT_RELEASE_VERSION="\"25.412-b00\"" -DHOTSPOT_BUILD_TARGET="\"product\"" -DHOTSPOT_BUILD_USER="\"yansendao\"" -DHOTSPOT_LIB_ARCH=\"riscv64\" -DHOTSPOT_VM_DISTRO="\"OpenJDK\""  -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_riscv -DTARGET_ARCH_MODEL_riscv -DTARGET_OS_ARCH_linux_riscv -DTARGET_OS_ARCH_MODEL_linux_riscv64 -DTARGET_COMPILER_gcc -DINCLUDE_JFR=1 -DCOMPILER2 -DCOMPILER1 -fPIC -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -fvisibility=hidden  -pipe -fno-strict-aliasing  -fno-omit-frame-pointer -O3  -g -DVM_LITTLE_ENDIAN -D_LP64=1 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type   -fstack-protector  -fno-delete-null-pointer-checks -fno-lifetime-dse -std=gnu++98 -DDTRACE_ENABLED -c -MMD -MP -MF ../generated/dependencies/precompiled.hpp.gch.d -fpch-deps -x c++-header /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled/precompiled.hpp -o precompiled.hpp.gch && { echo Done with /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled/precompiled.hpp; }
In file included from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/asm/assembler.hpp:464,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled/precompiled.hpp:29:
/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/cpu/riscv/vm/assembler_riscv.hpp:1974:46: error: macro "max" passed 3 arguments, but takes just 2
 1974 |   INSN(max,       0b0110011, 0b110, 0b0000101);
      |                                              ^
In file included from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/utilities/debug.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/runtime/globals.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/memory/allocation.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/memory/iterator.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/memory/genOopClosures.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/oops/klass.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/runtime/handles.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/memory/universe.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/code/oopRecorder.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/asm/codeBuffer.hpp:28,
                 from /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/asm/assembler.hpp:28:
/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/utilities/globalDefinitions.hpp:1144: note: macro "max" defined here
 1144 | #define max(a,b) Do_not_use_max_use_MAX2_instead
      | 
/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/cpu/riscv/vm/assembler_riscv.hpp:1976:46: error: macro "min" passed 3 arguments, but takes just 2
 1976 |   INSN(min,       0b0110011, 0b100, 0b0000101);
      |                                              ^
/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/utilities/globalDefinitions.hpp:1145: note: macro "min" defined here
 1145 | #define min(a,b) Do_not_use_min_use_MIN2_instead
      | 

make-fastdebug-aarch64.log make-fastdebug-x86_64.log make-release-aarch64.log make-release-x86_64.log make-slowdebug-aarch64.log make-slowdebug-x86_64.log build-precompiled.log make-riscv64.log

sendaoYan commented 1 week ago
time /usr/local/bin/ccache /usr/bin/gcc -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe -fno-rtti -fno-exceptions -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer -fcheck-new -fstack-protector -std=gnu++98 -DLIBC=gnu -DSUPPORTS_CLOCK_MONOTONIC -DLINUX -fPIC -fmacro-prefix-map=/home/yansendao/git/riscv-port-jdk11u/= -DVM_LITTLE_ENDIAN -D_LP64=1 -fno-delete-null-pointer-checks -fno-lifetime-dse -Wno-format-zero-length -Wtype-limits -Wuninitialized -DPRODUCT -DTARGET_ARCH_riscv -DINCLUDE_SUFFIX_OS=_linux -DINCLUDE_SUFFIX_CPU=_riscv -DINCLUDE_SUFFIX_COMPILER=_gcc -DTARGET_COMPILER_gcc -DRISCV64 -DHOTSPOT_LIB_ARCH='"riscv64"' -DCOMPILER1 -DCOMPILER2 -DDTRACE_ENABLED -DINCLUDE_JVMCI=0 -DINCLUDE_AOT=0 -DINCLUDE_ZGC=0 -DINCLUDE_SHENANDOAHGC=0 -I/home/yansendao/git/riscv-port-jdk11u/build/linux-riscv64-normal-server-release/hotspot/variant-server/gensrc/adfiles -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/share -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/os/linux -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/os/posix -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/cpu/riscv -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/os_cpu/linux_riscv -I/home/yansendao/git/riscv-port-jdk11u/build/linux-riscv64-normal-server-release/hotspot/variant-server/gensrc -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/share/precompiled -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/share/include -I/home/yansendao/git/riscv-port-jdk11u/src/hotspot/os/posix/include -I/home/yansendao/git/riscv-port-jdk11u/build/linux-riscv64-normal-server-release/support/modules_include/java.base -I/home/yansendao/git/riscv-port-jdk11u/build/linux-riscv64-normal-server-release/support/modules_include/java.base/linux -I/home/yansendao/git/riscv-port-jdk11u/src/java.base/share/native/libjimage -I/home/yansendao/git/riscv-port-jdk11u/test/fmw/gtest -I/home/yansendao/git/riscv-port-jdk11u/test/fmw/gtest/include -I/home/yansendao/git/riscv-port-jdk11u/test/hotspot/gtest -g -Wno-extra -Wno-all -Wno-undef -Werror -O3 -x c++-header -c -MMD -MF /home/yansendao/git/riscv-port-jdk11u/build/linux-riscv64-normal-server-release/hotspot/variant-server/libjvm/gtest/objs/precompiled/precompiled.hpp.gch.d.tmp /home/yansendao/git/riscv-port-jdk11u/src/hotspot/share/precompiled/precompiled.hpp -o precompiled.hpp.gch-generate -E

precompiled.hpp.gch-generate.log

sendaoYan commented 1 week ago
docker exec -it jdk-build bash -c "cd $PWD/build/linux-aarch64-normal-server-release/hotspot/linux_aarch64_compiler2/generated && /opt/rh/devtoolset-10/root/usr/bin/g++ -DLINUX -D_GNU_SOURCE -DAARCH64 -DPRODUCT -I. -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/prims -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/cpu/aarch64/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os_cpu/linux_aarch64/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os/linux/vm -I/home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/os/posix/vm -I../generated -DHOTSPOT_RELEASE_VERSION="\"25.412-b00\"" -DHOTSPOT_BUILD_TARGET="\"product\"" -DHOTSPOT_BUILD_USER="\"yansendao\"" -DHOTSPOT_LIB_ARCH=\"aarch64\" -DHOTSPOT_VM_DISTRO="\"OpenJDK\""  -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_aarch64 -DTARGET_ARCH_MODEL_aarch64 -DTARGET_OS_ARCH_linux_aarch64 -DTARGET_OS_ARCH_MODEL_linux_aarch64 -DTARGET_COMPILER_gcc -DINCLUDE_JFR=1 -DCOMPILER2 -DCOMPILER1 -fPIC -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -fvisibility=hidden  -pipe -fno-strict-aliasing  -fno-omit-frame-pointer -O3  -g -DVM_LITTLE_ENDIAN -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type   -fstack-protector  -fno-delete-null-pointer-checks -fno-lifetime-dse -std=gnu++98 -DDTRACE_ENABLED -c -MMD -MP -MF ../generated/dependencies/precompiled.hpp.gch.d -fpch-deps -x c++-header /home/yansendao/git/riscv-port-jdk8u-ysd/hotspot/src/share/vm/precompiled/precompiled.hpp -o precompiled.hpp.gch.log -E"
sendaoYan commented 1 week ago

8161145: The min/max macros make hotspot tests fail to build with GCC 6

diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index e07ed31678..dbb080ef6e 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1095,8 +1095,11 @@ inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) {
 #undef min
 #endif

-#define max(a,b) Do_not_use_max_use_MAX2_instead
-#define min(a,b) Do_not_use_min_use_MIN2_instead
+// The following defines serve the purpose of preventing use of accidentally
+// included min max macros from compiling, while continuing to allow innocent
+// min and max identifiers in the code to compile as intended.
+#define max max
+#define min min
sendaoYan commented 1 week ago

8199356: Fix hotspot to allow stdlib to use libc++ and to allow changing the deployment target to 10.9

diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp
index 0dee11af8a..a6b9fdef58 100644
--- a/src/hotspot/share/utilities/globalDefinitions.hpp
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp
@@ -1012,12 +1012,6 @@ inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) {
 #undef min
 #endif

-// The following defines serve the purpose of preventing use of accidentally
-// included min max macros from compiling, while continuing to allow innocent
-// min and max identifiers in the code to compile as intended.
-#define max max
-#define min min
-
 // It is necessary to use templates here. Having normal overloaded
 // functions does not work because it is necessary to provide both 32-
 // and 64-bit overloaded functions, which does not work, and having
sendaoYan commented 1 week ago
diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
index c71df9bf52c..cb204a7b92b 100644
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp
@@ -1141,9 +1141,6 @@ inline intptr_t bitfield(intptr_t x, int start_bit_no, int field_length) {
 #undef min
 #endif

-#define max(a,b) Do_not_use_max_use_MAX2_instead
-#define min(a,b) Do_not_use_min_use_MIN2_instead
-
 // It is necessary to use templates here. Having normal overloaded
 // functions does not work because it is necessary to provide both 32-
 // and 64-bit overloaded functions, which does not work, and having
@@ -1158,6 +1155,13 @@ template<class T> inline T MIN4(T a, T b, T c, T d) { return MIN2(MIN3(a, b, c),

 template<class T> inline T ABS(T x)                 { return (x > 0) ? x : -x; }

+// Return the given value clamped to the range [min ... max]
+template<typename T>
+inline T clamp(T value, T min, T max) {
+  assert(min <= max, "must be");
+  return MIN2(MAX2(value, min), max);
+}
+
 // true if x is a power of 2, false otherwise
 inline bool is_power_of_2(intptr_t x) {
   return ((x != NoBits) && (mask_bits(x, x - 1) == NoBits));
sendaoYan commented 1 week ago

8233702: Introduce helper function to clamp value to range

sendaoYan commented 1 week ago

To github.com:sendaoYan/riscv-port-jdk8u-ysd.git d8af32ef2f6..dc9bc4398d6 minus-jbs8276799 -> minus-jbs8276799