--- a/src/hotspot/share/utilities/globalDefinitions.hpp Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp Thu Oct 17 20:53:35 2019 +0100
@@ -308,6 +308,13 @@
return s;
}
+// Memory size transition formatting.
+
+#define HEAP_CHANGE_FORMAT "%s: " SIZE_FORMAT "K(" SIZE_FORMAT "K)->" SIZE_FORMAT "K(" SIZE_FORMAT "K)"
+
+#define HEAP_CHANGE_FORMAT_ARGS(_name_, _prev_used_, _prev_capacity_, _used_, _capacity_) \
+ (_name_), (_prev_used_) / K, (_prev_capacity_) / K, (_used_) / K, (_capacity_) / K
+
//----------------------------------------------------------------------------------------------------
// VM type definitions
@@ -474,10 +481,13 @@
// assure their ordering, instead of after volatile stores.
// (See "A Tutorial Introduction to the ARM and POWER Relaxed Memory Models"
// by Luc Maranget, Susmit Sarkar and Peter Sewell, INRIA/Cambridge)
-#ifdef CPU_NOT_MULTIPLE_COPY_ATOMIC
-const bool support_IRIW_for_not_multiple_copy_atomic_cpu = true;
+#ifdef CPU_MULTI_COPY_ATOMIC
+// Not needed.
+const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
#else
-const bool support_IRIW_for_not_multiple_copy_atomic_cpu = false;
+// From all non-multi-copy-atomic architectures, only PPC64 supports IRIW at the moment.
+// Final decision is subject to JEP 188: Java Memory Model Update.
+const bool support_IRIW_for_not_multiple_copy_atomic_cpu = PPC64_ONLY(true) NOT_PPC64(false);
#endif
// The expected size in bytes of a cache line, used to pad data structures.
@@ -1085,6 +1095,28 @@
#undef JAVA_INTEGER_OP
+//----------------------------------------------------------------------------------------------------
+// The goal of this code is to provide saturating operations for int/uint.
+// Checks overflow conditions and saturates the result to min_jint/max_jint.
+#define SATURATED_INTEGER_OP(OP, NAME, TYPE1, TYPE2) \
+inline int NAME (TYPE1 in1, TYPE2 in2) { \
+ jlong res = static_cast<jlong>(in1); \
+ res OP ## = static_cast<jlong>(in2); \
+ if (res > max_jint) { \
+ res = max_jint; \
+ } else if (res < min_jint) { \
+ res = min_jint; \
+ } \
+ return static_cast<int>(res); \
+}
+
+SATURATED_INTEGER_OP(+, saturated_add, int, int)
+SATURATED_INTEGER_OP(+, saturated_add, int, uint)
+SATURATED_INTEGER_OP(+, saturated_add, uint, int)
+SATURATED_INTEGER_OP(+, saturated_add, uint, uint)
+
+#undef SATURATED_INTEGER_OP
+
// Dereference vptr
// All C++ compilers that we know of have the vtbl pointer in the first
// word. If there are exceptions, this function needs to be made compiler