Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Dec 23, 2024
2 parents 3fa988c + ed29231 commit 29cb14d
Show file tree
Hide file tree
Showing 21 changed files with 3,068 additions and 60 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/compressedKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void CompressedKlassPointers::sanity_check_after_initialization() {

// Check that Klass range is fully engulfed in the encoding range
const address encoding_start = _base;
const address encoding_end = _base + nth_bit(narrow_klass_pointer_bits() + _shift);
const address encoding_end = (address)(p2u(_base) + (uintptr_t)nth_bit(narrow_klass_pointer_bits() + _shift));
ASSERT_HERE_2(_klass_range_start >= _base && _klass_range_end <= encoding_end,
"Resulting encoding range does not fully cover the class range");

Expand Down
78 changes: 39 additions & 39 deletions src/hotspot/share/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2413,7 +2413,7 @@ static char* get_bad_address() {



#define DEFINE_GETSCALARARRAYELEMENTS(ElementTag,ElementType,Result, Tag \
#define DEFINE_GETSCALARARRAYELEMENTS(ElementType,Result \
, EntryProbe, ReturnProbe) \
\
JNI_ENTRY_NO_PRESERVE(ElementType*, \
Expand Down Expand Up @@ -2447,35 +2447,35 @@ JNI_ENTRY_NO_PRESERVE(ElementType*, \
return result; \
JNI_END

DEFINE_GETSCALARARRAYELEMENTS(T_BOOLEAN, jboolean, Boolean, bool
DEFINE_GETSCALARARRAYELEMENTS(jboolean, Boolean
, HOTSPOT_JNI_GETBOOLEANARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETBOOLEANARRAYELEMENTS_RETURN((uintptr_t*)result))
DEFINE_GETSCALARARRAYELEMENTS(T_BYTE, jbyte, Byte, byte
DEFINE_GETSCALARARRAYELEMENTS(jbyte, Byte
, HOTSPOT_JNI_GETBYTEARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETBYTEARRAYELEMENTS_RETURN((char*)result))
DEFINE_GETSCALARARRAYELEMENTS(T_SHORT, jshort, Short, short
DEFINE_GETSCALARARRAYELEMENTS(jshort, Short
, HOTSPOT_JNI_GETSHORTARRAYELEMENTS_ENTRY(env, (uint16_t*) array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETSHORTARRAYELEMENTS_RETURN((uint16_t*)result))
DEFINE_GETSCALARARRAYELEMENTS(T_CHAR, jchar, Char, char
DEFINE_GETSCALARARRAYELEMENTS(jchar, Char
, HOTSPOT_JNI_GETCHARARRAYELEMENTS_ENTRY(env, (uint16_t*) array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETCHARARRAYELEMENTS_RETURN(result))
DEFINE_GETSCALARARRAYELEMENTS(T_INT, jint, Int, int
DEFINE_GETSCALARARRAYELEMENTS(jint, Int
, HOTSPOT_JNI_GETINTARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETINTARRAYELEMENTS_RETURN((uint32_t*)result))
DEFINE_GETSCALARARRAYELEMENTS(T_LONG, jlong, Long, long
DEFINE_GETSCALARARRAYELEMENTS(jlong, Long
, HOTSPOT_JNI_GETLONGARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETLONGARRAYELEMENTS_RETURN(((uintptr_t*)result)))
// Float and double probes don't return value because dtrace doesn't currently support it
DEFINE_GETSCALARARRAYELEMENTS(T_FLOAT, jfloat, Float, float
DEFINE_GETSCALARARRAYELEMENTS(jfloat, Float
, HOTSPOT_JNI_GETFLOATARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETFLOATARRAYELEMENTS_RETURN(result))
DEFINE_GETSCALARARRAYELEMENTS(T_DOUBLE, jdouble, Double, double
DEFINE_GETSCALARARRAYELEMENTS(jdouble, Double
, HOTSPOT_JNI_GETDOUBLEARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) isCopy),
HOTSPOT_JNI_GETDOUBLEARRAYELEMENTS_RETURN(result))


#define DEFINE_RELEASESCALARARRAYELEMENTS(ElementTag,ElementType,Result,Tag \
, EntryProbe, ReturnProbe);\
#define DEFINE_RELEASESCALARARRAYELEMENTS(ElementType,Result \
, EntryProbe, ReturnProbe) \
\
JNI_ENTRY_NO_PRESERVE(void, \
jni_Release##Result##ArrayElements(JNIEnv *env, ElementType##Array array, \
Expand All @@ -2494,28 +2494,28 @@ JNI_ENTRY_NO_PRESERVE(void, \
ReturnProbe; \
JNI_END

DEFINE_RELEASESCALARARRAYELEMENTS(T_BOOLEAN, jboolean, Boolean, bool
DEFINE_RELEASESCALARARRAYELEMENTS(jboolean, Boolean
, HOTSPOT_JNI_RELEASEBOOLEANARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) buf, mode),
HOTSPOT_JNI_RELEASEBOOLEANARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_BYTE, jbyte, Byte, byte
DEFINE_RELEASESCALARARRAYELEMENTS(jbyte, Byte
, HOTSPOT_JNI_RELEASEBYTEARRAYELEMENTS_ENTRY(env, array, (char *) buf, mode),
HOTSPOT_JNI_RELEASEBYTEARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_SHORT, jshort, Short, short
DEFINE_RELEASESCALARARRAYELEMENTS(jshort, Short
, HOTSPOT_JNI_RELEASESHORTARRAYELEMENTS_ENTRY(env, array, (uint16_t *) buf, mode),
HOTSPOT_JNI_RELEASESHORTARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_CHAR, jchar, Char, char
DEFINE_RELEASESCALARARRAYELEMENTS(jchar, Char
, HOTSPOT_JNI_RELEASECHARARRAYELEMENTS_ENTRY(env, array, (uint16_t *) buf, mode),
HOTSPOT_JNI_RELEASECHARARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_INT, jint, Int, int
DEFINE_RELEASESCALARARRAYELEMENTS(jint, Int
, HOTSPOT_JNI_RELEASEINTARRAYELEMENTS_ENTRY(env, array, (uint32_t *) buf, mode),
HOTSPOT_JNI_RELEASEINTARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_LONG, jlong, Long, long
DEFINE_RELEASESCALARARRAYELEMENTS(jlong, Long
, HOTSPOT_JNI_RELEASELONGARRAYELEMENTS_ENTRY(env, array, (uintptr_t *) buf, mode),
HOTSPOT_JNI_RELEASELONGARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_FLOAT, jfloat, Float, float
DEFINE_RELEASESCALARARRAYELEMENTS(jfloat, Float
, HOTSPOT_JNI_RELEASEFLOATARRAYELEMENTS_ENTRY(env, array, (float *) buf, mode),
HOTSPOT_JNI_RELEASEFLOATARRAYELEMENTS_RETURN())
DEFINE_RELEASESCALARARRAYELEMENTS(T_DOUBLE, jdouble, Double, double
DEFINE_RELEASESCALARARRAYELEMENTS(jdouble, Double
, HOTSPOT_JNI_RELEASEDOUBLEARRAYELEMENTS_ENTRY(env, array, (double *) buf, mode),
HOTSPOT_JNI_RELEASEDOUBLEARRAYELEMENTS_RETURN())

Expand All @@ -2533,8 +2533,8 @@ static void check_bounds(jsize start, jsize copy_len, jsize array_len, TRAPS) {
}
}

#define DEFINE_GETSCALARARRAYREGION(ElementTag,ElementType,Result, Tag \
, EntryProbe, ReturnProbe); \
#define DEFINE_GETSCALARARRAYREGION(ElementType,Result \
, EntryProbe, ReturnProbe) \
DT_VOID_RETURN_MARK_DECL(Get##Result##ArrayRegion \
, ReturnProbe); \
\
Expand All @@ -2550,34 +2550,34 @@ jni_Get##Result##ArrayRegion(JNIEnv *env, ElementType##Array array, jsize start,
} \
JNI_END

DEFINE_GETSCALARARRAYREGION(T_BOOLEAN, jboolean,Boolean, bool
DEFINE_GETSCALARARRAYREGION(jboolean,Boolean
, HOTSPOT_JNI_GETBOOLEANARRAYREGION_ENTRY(env, array, start, len, (uintptr_t *) buf),
HOTSPOT_JNI_GETBOOLEANARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_BYTE, jbyte, Byte, byte
DEFINE_GETSCALARARRAYREGION(jbyte, Byte
, HOTSPOT_JNI_GETBYTEARRAYREGION_ENTRY(env, array, start, len, (char *) buf),
HOTSPOT_JNI_GETBYTEARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_SHORT, jshort, Short, short
DEFINE_GETSCALARARRAYREGION(jshort, Short
, HOTSPOT_JNI_GETSHORTARRAYREGION_ENTRY(env, array, start, len, (uint16_t *) buf),
HOTSPOT_JNI_GETSHORTARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_CHAR, jchar, Char, char
DEFINE_GETSCALARARRAYREGION(jchar, Char
, HOTSPOT_JNI_GETCHARARRAYREGION_ENTRY(env, array, start, len, (uint16_t*) buf),
HOTSPOT_JNI_GETCHARARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_INT, jint, Int, int
DEFINE_GETSCALARARRAYREGION(jint, Int
, HOTSPOT_JNI_GETINTARRAYREGION_ENTRY(env, array, start, len, (uint32_t*) buf),
HOTSPOT_JNI_GETINTARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_LONG, jlong, Long, long
DEFINE_GETSCALARARRAYREGION(jlong, Long
, HOTSPOT_JNI_GETLONGARRAYREGION_ENTRY(env, array, start, len, (uintptr_t *) buf),
HOTSPOT_JNI_GETLONGARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_FLOAT, jfloat, Float, float
DEFINE_GETSCALARARRAYREGION(jfloat, Float
, HOTSPOT_JNI_GETFLOATARRAYREGION_ENTRY(env, array, start, len, (float *) buf),
HOTSPOT_JNI_GETFLOATARRAYREGION_RETURN());
DEFINE_GETSCALARARRAYREGION(T_DOUBLE, jdouble, Double, double
DEFINE_GETSCALARARRAYREGION(jdouble, Double
, HOTSPOT_JNI_GETDOUBLEARRAYREGION_ENTRY(env, array, start, len, (double *) buf),
HOTSPOT_JNI_GETDOUBLEARRAYREGION_RETURN());


#define DEFINE_SETSCALARARRAYREGION(ElementTag,ElementType,Result, Tag \
, EntryProbe, ReturnProbe); \
#define DEFINE_SETSCALARARRAYREGION(ElementType,Result \
, EntryProbe, ReturnProbe) \
DT_VOID_RETURN_MARK_DECL(Set##Result##ArrayRegion \
,ReturnProbe); \
\
Expand All @@ -2593,28 +2593,28 @@ jni_Set##Result##ArrayRegion(JNIEnv *env, ElementType##Array array, jsize start,
} \
JNI_END

DEFINE_SETSCALARARRAYREGION(T_BOOLEAN, jboolean, Boolean, bool
DEFINE_SETSCALARARRAYREGION(jboolean, Boolean
, HOTSPOT_JNI_SETBOOLEANARRAYREGION_ENTRY(env, array, start, len, (uintptr_t *)buf),
HOTSPOT_JNI_SETBOOLEANARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_BYTE, jbyte, Byte, byte
DEFINE_SETSCALARARRAYREGION(jbyte, Byte
, HOTSPOT_JNI_SETBYTEARRAYREGION_ENTRY(env, array, start, len, (char *) buf),
HOTSPOT_JNI_SETBYTEARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_SHORT, jshort, Short, short
DEFINE_SETSCALARARRAYREGION(jshort, Short
, HOTSPOT_JNI_SETSHORTARRAYREGION_ENTRY(env, array, start, len, (uint16_t *) buf),
HOTSPOT_JNI_SETSHORTARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_CHAR, jchar, Char, char
DEFINE_SETSCALARARRAYREGION(jchar, Char
, HOTSPOT_JNI_SETCHARARRAYREGION_ENTRY(env, array, start, len, (uint16_t *) buf),
HOTSPOT_JNI_SETCHARARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_INT, jint, Int, int
DEFINE_SETSCALARARRAYREGION(jint, Int
, HOTSPOT_JNI_SETINTARRAYREGION_ENTRY(env, array, start, len, (uint32_t *) buf),
HOTSPOT_JNI_SETINTARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_LONG, jlong, Long, long
DEFINE_SETSCALARARRAYREGION(jlong, Long
, HOTSPOT_JNI_SETLONGARRAYREGION_ENTRY(env, array, start, len, (uintptr_t *) buf),
HOTSPOT_JNI_SETLONGARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_FLOAT, jfloat, Float, float
DEFINE_SETSCALARARRAYREGION(jfloat, Float
, HOTSPOT_JNI_SETFLOATARRAYREGION_ENTRY(env, array, start, len, (float *) buf),
HOTSPOT_JNI_SETFLOATARRAYREGION_RETURN())
DEFINE_SETSCALARARRAYREGION(T_DOUBLE, jdouble, Double, double
DEFINE_SETSCALARARRAYREGION(jdouble, Double
, HOTSPOT_JNI_SETDOUBLEARRAYREGION_ENTRY(env, array, start, len, (double *) buf),
HOTSPOT_JNI_SETDOUBLEARRAYREGION_RETURN())

Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/utilities/globalDefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ inline intptr_t p2i(const volatile void* p) {
return (intptr_t) p;
}

// Convert pointer to uintptr_t
inline uintptr_t p2u(const volatile void* p) {
return (uintptr_t) p;
}

#define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false")

//----------------------------------------------------------------------------------------------------
Expand Down
13 changes: 11 additions & 2 deletions src/java.base/share/man/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -1292,10 +1292,15 @@ These `java` options control the runtime behavior of the Java HotSpot VM.

`-XX:OnOutOfMemoryError=`*string*
: Sets a custom command or a series of semicolon-separated commands to run
when an `OutOfMemoryError` exception is first thrown. If the string
when an `OutOfMemoryError` exception is first thrown by the JVM.
If the string
contains spaces, then it must be enclosed in quotation marks. For an
example of a command string, see the description of the `-XX:OnError`
option.
This applies only to `OutOfMemoryError` exceptions caused by Java Heap
exhaustion; it does not apply to `OutOfMemoryError` exceptions thrown
directly from Java code, nor by the JVM for other types of resource
exhaustion (such as native thread creation errors).

`-XX:+PrintCommandLineFlags`
: Enables printing of ergonomically selected JVM flags that appeared on the
Expand Down Expand Up @@ -2189,10 +2194,14 @@ perform extensive debugging.
`-XX:+HeapDumpOnOutOfMemoryError`
: Enables the dumping of the Java heap to a file in the current directory by
using the heap profiler (HPROF) when a `java.lang.OutOfMemoryError`
exception is thrown. You can explicitly set the heap dump file path and
exception is thrown by the JVM. You can explicitly set the heap dump file path and
name using the `-XX:HeapDumpPath` option. By default, this option is
disabled and the heap isn't dumped when an `OutOfMemoryError` exception is
thrown.
This applies only to `OutOfMemoryError` exceptions caused by Java Heap
exhaustion; it does not apply to `OutOfMemoryError` exceptions thrown
directly from Java code, nor by the JVM for other types of resource
exhaustion (such as native thread creation errors).

`-XX:HeapDumpPath=`*path*
: Sets the path and file name for writing the heap dump provided by the heap
Expand Down
Loading

0 comments on commit 29cb14d

Please sign in to comment.