dragonwell-releng / issues-repo

0 stars 0 forks source link

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

Open sendaoYan opened 3 days ago

sendaoYan commented 3 days 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
      | 

build-precompiled.log make-riscv64.log 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

sendaoYan commented 2 days 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));