mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8221477: Inject os/cpu-specific constants into Unsafe from JVM
Initialize Unsafe os/cpu-specific constants using injection instead of native callouts Reviewed-by: stuefe, coleenp, dholmes, plevart
This commit is contained in:
parent
7a093bcf50
commit
71164a973b
9 changed files with 190 additions and 52 deletions
|
@ -292,18 +292,6 @@ UNSAFE_ENTRY(jobject, Unsafe_GetUncompressedObject(JNIEnv *env, jobject unsafe,
|
|||
return JNIHandles::make_local(env, v);
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_LEAF(jboolean, Unsafe_isBigEndian0(JNIEnv *env, jobject unsafe)) {
|
||||
#ifdef VM_LITTLE_ENDIAN
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_LEAF(jint, Unsafe_unalignedAccess0(JNIEnv *env, jobject unsafe)) {
|
||||
return UseUnalignedAccesses;
|
||||
} UNSAFE_END
|
||||
|
||||
#define DEFINE_GETSETOOP(java_type, Type) \
|
||||
\
|
||||
UNSAFE_ENTRY(java_type, Unsafe_Get##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { \
|
||||
|
@ -446,14 +434,6 @@ UNSAFE_LEAF(void, Unsafe_CopySwapMemory0(JNIEnv *env, jobject unsafe, jobject sr
|
|||
|
||||
////// Random queries
|
||||
|
||||
UNSAFE_LEAF(jint, Unsafe_AddressSize0(JNIEnv *env, jobject unsafe)) {
|
||||
return sizeof(void*);
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_LEAF(jint, Unsafe_PageSize()) {
|
||||
return os::vm_page_size();
|
||||
} UNSAFE_END
|
||||
|
||||
static jlong find_field_offset(jclass clazz, jstring name, TRAPS) {
|
||||
assert(clazz != NULL, "clazz must not be NULL");
|
||||
assert(name != NULL, "name must not be NULL");
|
||||
|
@ -1073,8 +1053,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
|
|||
{CC "ensureClassInitialized0", CC "(" CLS ")V", FN_PTR(Unsafe_EnsureClassInitialized0)},
|
||||
{CC "arrayBaseOffset0", CC "(" CLS ")I", FN_PTR(Unsafe_ArrayBaseOffset0)},
|
||||
{CC "arrayIndexScale0", CC "(" CLS ")I", FN_PTR(Unsafe_ArrayIndexScale0)},
|
||||
{CC "addressSize0", CC "()I", FN_PTR(Unsafe_AddressSize0)},
|
||||
{CC "pageSize", CC "()I", FN_PTR(Unsafe_PageSize)},
|
||||
|
||||
{CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)},
|
||||
{CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)},
|
||||
|
@ -1102,9 +1080,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
|
|||
{CC "loadFence", CC "()V", FN_PTR(Unsafe_LoadFence)},
|
||||
{CC "storeFence", CC "()V", FN_PTR(Unsafe_StoreFence)},
|
||||
{CC "fullFence", CC "()V", FN_PTR(Unsafe_FullFence)},
|
||||
|
||||
{CC "isBigEndian0", CC "()Z", FN_PTR(Unsafe_isBigEndian0)},
|
||||
{CC "unalignedAccess0", CC "()Z", FN_PTR(Unsafe_unalignedAccess0)}
|
||||
};
|
||||
|
||||
#undef CC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue