From 24513b0c6def9b7d25128a3c748c536deb54a92f Mon Sep 17 00:00:00 2001 From: tajila Date: Tue, 16 Apr 2024 10:03:23 -0400 Subject: [PATCH] Array base offset zero Signed-off-by: tajila --- runtime/gc_modron_startup/mminit.cpp | 12 +++ runtime/jcl/common/sun_misc_Unsafe.cpp | 7 +- runtime/oti/UnsafeAPI.hpp | 16 +-- runtime/oti/j9nonbuilder.h | 4 + runtime/oti/vm_api.h | 11 ++ runtime/vm/BytecodeInterpreter.hpp | 2 +- runtime/vm/exceptionsupport.c | 136 +++++++++++++------------ runtime/vm/intfunc.c | 1 + runtime/vm/j9vm.tdf | 2 + runtime/vm/vmthread.cpp | 1 + 10 files changed, 115 insertions(+), 77 deletions(-) diff --git a/runtime/gc_modron_startup/mminit.cpp b/runtime/gc_modron_startup/mminit.cpp index 26a51330aad..30b1fee2668 100644 --- a/runtime/gc_modron_startup/mminit.cpp +++ b/runtime/gc_modron_startup/mminit.cpp @@ -3323,6 +3323,12 @@ setIndexableObjectHeaderSizeWithDataAddress(J9JavaVM* vm) vm->contiguousIndexableHeaderSize = sizeof(J9IndexableObjectWithDataAddressContiguousFull); vm->discontiguousIndexableHeaderSize = sizeof(J9IndexableObjectWithDataAddressDiscontiguousFull); } + + if (MM_GCExtensions::getExtensions(vm)->isVirtualLargeObjectHeapEnabled) { + vm->unsafeIndexableHeaderSize = 0; + } else { + vm->unsafeIndexableHeaderSize = vm->contiguousIndexableHeaderSize; + } } #endif /* defined(J9VM_ENV_DATA64) */ @@ -3336,6 +3342,12 @@ setIndexableObjectHeaderSizeWithoutDataAddress(J9JavaVM* vm) vm->contiguousIndexableHeaderSize = sizeof(J9IndexableObjectContiguousFull); vm->discontiguousIndexableHeaderSize = sizeof(J9IndexableObjectDiscontiguousFull); } + + if (MM_GCExtensions::getExtensions(vm)->isVirtualLargeObjectHeapEnabled) { + vm->unsafeIndexableHeaderSize = 0; + } else { + vm->unsafeIndexableHeaderSize = vm->contiguousIndexableHeaderSize; + } } #if defined(OMR_GC_CONCURRENT_SCAVENGER) diff --git a/runtime/jcl/common/sun_misc_Unsafe.cpp b/runtime/jcl/common/sun_misc_Unsafe.cpp index 80739834815..97b7a397729 100644 --- a/runtime/jcl/common/sun_misc_Unsafe.cpp +++ b/runtime/jcl/common/sun_misc_Unsafe.cpp @@ -38,6 +38,7 @@ #include "ArrayCopyHelpers.hpp" #include "AtomicSupport.hpp" #include "ObjectMonitor.hpp" +#include "UnsafeAPI.hpp" #include "VMHelpers.hpp" extern "C" { @@ -572,7 +573,7 @@ copyMemory(J9VMThread* currentThread, j9object_t sourceObject, UDATA sourceOffse UDATA destOffset, UDATA actualSize) { /* Because array data is always 8-aligned, only the alignment of the offsets (and byte size) need be considered */ - UDATA const headerSize = J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(currentThread); + UDATA const headerSize = VM_UnsafeAPI::arrayBase(currentThread); UDATA logElementSize = determineCommonAlignment(sourceOffset, destOffset, actualSize); UDATA sourceIndex = (sourceOffset - headerSize) >> logElementSize; UDATA destIndex = (destOffset - headerSize) >> logElementSize; @@ -595,7 +596,7 @@ static VMINLINE void copyMemoryByte(J9VMThread* currentThread, j9object_t sourceObject, UDATA sourceOffset, j9object_t destObject, UDATA destOffset) { - UDATA const headerSize = J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(currentThread); + UDATA const headerSize = VM_UnsafeAPI::arrayBase(currentThread); UDATA sourceIndex = sourceOffset - headerSize; UDATA destIndex = destOffset - headerSize; @@ -695,7 +696,7 @@ Java_sun_misc_Unsafe_setMemory__Ljava_lang_Object_2JJB(JNIEnv *env, jobject rece if (!J9ROMCLASS_IS_PRIMITIVE_TYPE(((J9ArrayClass*)clazz)->componentType->romClass)) { goto illegal; } - offset -= J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(currentThread); + offset -= VM_UnsafeAPI::arrayBase(currentThread); VM_ArrayCopyHelpers::primitiveArrayFill(currentThread, object, (UDATA)offset, actualSize, (U_8)value); } vmFuncs->internalExitVMToJNI(currentThread); diff --git a/runtime/oti/UnsafeAPI.hpp b/runtime/oti/UnsafeAPI.hpp index 4d231fba796..2dbd52a1e1a 100644 --- a/runtime/oti/UnsafeAPI.hpp +++ b/runtime/oti/UnsafeAPI.hpp @@ -36,7 +36,6 @@ #include "j9.h" #include "ArrayCopyHelpers.hpp" #include "ObjectAccessBarrierAPI.hpp" -#include "ut_j9vm.h" #include "VMHelpers.hpp" #include "AtomicSupport.hpp" @@ -90,10 +89,6 @@ class VM_UnsafeAPI */ private: - static VMINLINE UDATA arrayBase(J9VMThread *currentThread) { - return J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(currentThread); - } - static VMINLINE UDATA logFJ9ObjectSize(J9VMThread *currentThread) { return (4 == J9VMTHREAD_REFERENCE_SIZE(currentThread)) ? 2 : 3; } @@ -335,6 +330,9 @@ class VM_UnsafeAPI protected: public: + static VMINLINE UDATA arrayBase(J9VMThread *currentThread) { + return J9VMTHREAD_UNSAFE_INDEXABLE_HEADER_SIZE(currentThread); + } static VMINLINE void loadFence() { @@ -526,7 +524,7 @@ class VM_UnsafeAPI compareAndSwapObject(J9VMThread *currentThread, MM_ObjectAccessBarrierAPI *objectAccessBarrier, j9object_t object, UDATA offset, j9object_t *compareValue, j9object_t *swapValue) { bool result = false; - + if (VM_VMHelpers::objectIsArray(currentThread, object)) { UDATA index = convertOffsetToIndex(currentThread, offset, logFJ9ObjectSize(currentThread)); result = objectAccessBarrier->inlineIndexableObjectCompareAndSwapObject(currentThread, object, index, *compareValue, *swapValue, true); @@ -550,7 +548,7 @@ class VM_UnsafeAPI { UDATA logElementSize = 3; bool result = false; - + if (NULL == object) { result = (compareValue == VM_AtomicSupport::lockCompareExchangeU64((U_64*)offset, compareValue, swapValue)); } else { @@ -606,7 +604,9 @@ class VM_UnsafeAPI static VMINLINE j9object_t compareAndExchangeObject(J9VMThread *currentThread, MM_ObjectAccessBarrierAPI *objectAccessBarrier, j9object_t object, UDATA offset, j9object_t *compareValue, j9object_t *swapValue) { - Assert_VM_notNull(object); + if (J9_UNEXPECTED(NULL != object)) { + currentThread->javaVM->internalVMFunctions->triggerAssertion(currentThread, "object is null"); + } j9object_t result = NULL; diff --git a/runtime/oti/j9nonbuilder.h b/runtime/oti/j9nonbuilder.h index a04bd591a83..5f1e850b0bf 100644 --- a/runtime/oti/j9nonbuilder.h +++ b/runtime/oti/j9nonbuilder.h @@ -5183,6 +5183,7 @@ typedef struct J9InternalVMFunctions { #if defined(J9VM_ZOS_3164_INTEROPERABILITY) && (JAVA_SPEC_VERSION >= 17) I_32 (*invoke31BitJNI_OnXLoad)(struct J9JavaVM *vm, void *handle, jboolean isOnLoad, void *reserved); #endif /* defined(J9VM_ZOS_3164_INTEROPERABILITY) && (JAVA_SPEC_VERSION >= 17) */ + void (*triggerAssertion)(struct J9VMThread *currentThread, const char* message); } J9InternalVMFunctions; /* Jazz 99339: define a new structure to replace JavaVM so as to pass J9NativeLibrary to JVMTIEnv */ @@ -5427,6 +5428,7 @@ typedef struct J9VMThread { void* gcExtensions; UDATA contiguousIndexableHeaderSize; UDATA discontiguousIndexableHeaderSize; + UDATA unsafeIndexableHeaderSize; #if defined(J9VM_ENV_DATA64) UDATA isIndexableDataAddrPresent; #endif /* defined(J9VM_ENV_DATA64) */ @@ -5604,6 +5606,7 @@ typedef struct J9VMThread { #define J9VMTHREAD_OBJECT_HEADER_SIZE(vmThread) (J9VMTHREAD_COMPRESS_OBJECT_REFERENCES(vmThread) ? sizeof(J9ObjectCompressed) : sizeof(J9ObjectFull)) #define J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(vmThread) ((vmThread)->contiguousIndexableHeaderSize) #define J9VMTHREAD_DISCONTIGUOUS_INDEXABLE_HEADER_SIZE(vmThread) ((vmThread)->discontiguousIndexableHeaderSize) +#define J9VMTHREAD_UNSAFE_INDEXABLE_HEADER_SIZE(vmThread) ((vmThread)->unsafeIndexableHeaderSize) typedef struct JFRState { char *jfrFileName; @@ -5973,6 +5976,7 @@ typedef struct J9JavaVM { UDATA arrayletLeafLogSize; UDATA contiguousIndexableHeaderSize; UDATA discontiguousIndexableHeaderSize; + UDATA unsafeIndexableHeaderSize; #if defined(J9VM_ENV_DATA64) UDATA isIndexableDataAddrPresent; BOOLEAN isIndexableDualHeaderShapeEnabled; diff --git a/runtime/oti/vm_api.h b/runtime/oti/vm_api.h index 0100c7f6f89..6674662a848 100644 --- a/runtime/oti/vm_api.h +++ b/runtime/oti/vm_api.h @@ -1143,6 +1143,17 @@ void setCRIUSingleThreadModeJVMCRIUException(J9VMThread *vmThread, U_32 moduleName, U_32 messageNumber); #endif /* defined(J9VM_OPT_CRIU_SUPPORT) */ +/** + * Triggers a VM assertion + * + * @param currentThread vmthread token + * @param message the assertion message + * + * @return void + */ +void +triggerAssertion(J9VMThread *currentThread, const char* message); + /* ---------------- extendedMessageNPE.cpp ---------------- */ /** diff --git a/runtime/vm/BytecodeInterpreter.hpp b/runtime/vm/BytecodeInterpreter.hpp index afddf6e030d..3834a06854b 100644 --- a/runtime/vm/BytecodeInterpreter.hpp +++ b/runtime/vm/BytecodeInterpreter.hpp @@ -4249,7 +4249,7 @@ class INTERPRETER_CLASS if (J9CLASS_IS_ARRAY(receiverClass)) { I_64 arrayDataSize = J9INDEXABLEOBJECT_SIZE(_currentThread, receiver) * J9ARRAYCLASS_GET_STRIDE(receiverClass); - I_64 headerSize = J9VMTHREAD_CONTIGUOUS_INDEXABLE_HEADER_SIZE(_currentThread); + I_64 headerSize = J9VMTHREAD_UNSAFE_INDEXABLE_HEADER_SIZE(_currentThread); returnDoubleFromINL(REGISTER_ARGS, arrayDataSize + headerSize, 2); } else { I_64 headerSize = (I_64)J9VMTHREAD_OBJECT_HEADER_SIZE(_currentThread); diff --git a/runtime/vm/exceptionsupport.c b/runtime/vm/exceptionsupport.c index aace9de70e8..a82dbf74f35 100644 --- a/runtime/vm/exceptionsupport.c +++ b/runtime/vm/exceptionsupport.c @@ -50,7 +50,7 @@ static void internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDAT #define HOOK_METHOD_TYPE(walkState) ( 0 ) #endif -void +void setCurrentExceptionUTF(J9VMThread * vmThread, UDATA exceptionNumber, const char * detailUTF) { j9object_t detailString = NULL; @@ -72,7 +72,7 @@ setCurrentExceptionUTF(J9VMThread * vmThread, UDATA exceptionNumber, const char -void +void setCurrentExceptionNLS(J9VMThread * vmThread, UDATA exceptionNumber, U_32 moduleName, U_32 messageNumber) { PORT_ACCESS_FROM_VMC(vmThread); @@ -151,8 +151,8 @@ setCurrentExceptionNLSWithArgs(J9VMThread * vmThread, U_32 nlsModule, U_32 nlsID setCurrentExceptionUTF(vmThread, exceptionIndex, msgChars); j9mem_free_memory(msgChars); } - -static UDATA + +static UDATA decompStackHeadSearch(J9VMThread *currentThread, J9StackWalkState *walkState) { if (((UDATA *) walkState->userData1) == walkState->bp) { @@ -161,47 +161,47 @@ decompStackHeadSearch(J9VMThread *currentThread, J9StackWalkState *walkState) } return J9_STACKWALK_KEEP_ITERATING; -} - +} + -/** +/** * \brief Correct the decompilation stack of the passed in walkState - * - * @param currentThread current thread - * @param walkState stack walk state to be fixed + * + * @param currentThread current thread + * @param walkState stack walk state to be fixed * @param rewalkAllWalkedFrames set to true in order to rewalk the same amount of frames as upto the frame of the exceptionHandlerSearch that called us * @return none - * + * * The exceptionHandlerSearch function issues various events that * might call user callbacks such as jvmti pop frame event. Prior to the * callback we release vm access which in turn might cause our thread being * marked for decompilation (for example if a jvmti agent single steps or sets/removes * a breakpoint). The passed in walkState->decompilationStack will not always be valid - * when we come back. + * when we come back. * - * if (rewalkAllWalkedFrames == FALSE) + * if (rewalkAllWalkedFrames == FALSE) * This function walks the top two frames to determine the right decompilation stack head - * and use it to update the passed in walkState->decompilationStack. We do this when we had + * and use it to update the passed in walkState->decompilationStack. We do this when we had * to dropToCurrentFrame prior to issuing an event (read: releasing access which might result - * in class loading, calling out to any jvmti agent which expect the stack to be in the correct shape, - * hence we dropToCurrentFrame so that we match what they expect to see instead of having any - * leftover/special frames ontop). We only need to walk 2 frames to figure out the correct + * in class loading, calling out to any jvmti agent which expect the stack to be in the correct shape, + * hence we dropToCurrentFrame so that we match what they expect to see instead of having any + * leftover/special frames ontop). We only need to walk 2 frames to figure out the correct * decompilation side-stack head. * else * In case that the exceptionHandlerSearch stack walk iterator was used for a stack walk ment * to simply walk the stack and find the catch frame (ie no frame dropping involved). Once we reacquire - * access, we must re-walk the stack for at least as many frames as to reach the catch frame. - * + * access, we must re-walk the stack for at least as many frames as to reach the catch frame. + * */ static void syncDecompilationStackAfterReleasingVMAccess(J9VMThread *currentThread, J9StackWalkState *walkState, UDATA rewalkAllWalkedFrames) { #ifdef J9VM_JIT_FULL_SPEED_DEBUG - if (J9_FSD_ENABLED(currentThread->javaVM)) { + if (J9_FSD_ENABLED(currentThread->javaVM)) { J9StackWalkState ws; - /* Stack walk 2 frames in order to initialize ws.decompilationStack */ + /* Stack walk 2 frames in order to initialize ws.decompilationStack */ ws.skipCount = 0; ws.walkThread = walkState->walkThread; @@ -222,7 +222,7 @@ syncDecompilationStackAfterReleasingVMAccess(J9VMThread *currentThread, J9StackW walkState->decompilationStack = ws.decompilationStack; } -#endif +#endif } /* @@ -251,7 +251,7 @@ methodBeingTraced(J9JavaVM *vm, J9Method *method) 5) walkState->userData4 is the thrown class (input) */ -UDATA +UDATA exceptionHandlerSearch(J9VMThread *currentThread, J9StackWalkState *walkState) { J9JavaVM * vm = walkState->walkThread->javaVM; @@ -327,7 +327,7 @@ exceptionHandlerSearch(J9VMThread *currentThread, J9StackWalkState *walkState) * 1) The native method is guaranteed to be the top frame * 2) The stack must be left alone to ensure consistency of the JNI refs and stack frame flags */ - + PUSH_OBJECT_IN_SPECIAL_FRAME(currentThread, walkState->restartException); tempWalkState.previous = currentThread->stackWalkState; currentThread->stackWalkState = &tempWalkState; @@ -339,9 +339,9 @@ exceptionHandlerSearch(J9VMThread *currentThread, J9StackWalkState *walkState) } currentThread->stackWalkState = tempWalkState.previous; walkState->restartException = POP_OBJECT_IN_SPECIAL_FRAME(currentThread); -#ifdef J9VM_JIT_FULL_SPEED_DEBUG +#ifdef J9VM_JIT_FULL_SPEED_DEBUG walkState->decompilationStack = walkState->walkThread->decompilationStack; -#endif +#endif } } @@ -385,7 +385,7 @@ exceptionHandlerSearch(J9VMThread *currentThread, J9StackWalkState *walkState) currentThread->stackWalkState = tempWalkState.previous; walkState->restartException = POP_OBJECT_IN_SPECIAL_FRAME(currentThread); syncDecompilationStackAfterReleasingVMAccess(currentThread, walkState, FALSE); - } + } } #endif } else @@ -456,7 +456,7 @@ exceptionHandlerSearch(J9VMThread *currentThread, J9StackWalkState *walkState) -UDATA +UDATA isExceptionTypeCaughtByHandler(J9VMThread *currentThread, J9Class *thrownExceptionClass, J9ConstantPool *constantPool, UDATA handlerIndex, J9StackWalkState *walkState) { J9Class * caughtExceptionClass; @@ -490,7 +490,7 @@ isExceptionTypeCaughtByHandler(J9VMThread *currentThread, J9Class *thrownExcepti } else { syncDecompilationStackAfterReleasingVMAccess(currentThread, walkState, TRUE); } - + /* If we were unable to load the class, then we can only say that the exception is not caught */ if (caughtExceptionClass == NULL) { @@ -513,7 +513,7 @@ isExceptionTypeCaughtByHandler(J9VMThread *currentThread, J9Class *thrownExcepti } -void +void setCurrentException(J9VMThread *currentThread, UDATA exceptionNumber, UDATA *detailMessage) { setCurrentExceptionWithUtfCause(currentThread, exceptionNumber, detailMessage, NULL, NULL); @@ -523,10 +523,10 @@ setCurrentException(J9VMThread *currentThread, UDATA exceptionNumber, UDATA *det * Creates exception with its cause and detailed message * * @param currentThread - * @param exceptionNumber - * @param detailMessage - * @param cause - * + * @param exceptionNumber + * @param detailMessage + * @param cause + * */ static void internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionNumber, UDATA *detailMessage, const char *utfMessage, j9object_t cause) @@ -625,17 +625,17 @@ internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionN if (J9_EVENT_IS_HOOKED(vm->hookInterface, J9HOOK_VM_RESOURCE_EXHAUSTED)) { UDATA resourceTypes; - + /* The caller might have specified OOM exception type bits */ resourceTypes = exceptionNumber & J9_EX_OOM_TYPE_MASK; /* No bits specified, we are dealing with a regular Java Heap OOM */ if (resourceTypes == 0) { - resourceTypes = J9_EX_OOM_JAVA_HEAP; + resourceTypes = J9_EX_OOM_JAVA_HEAP; } ALWAYS_TRIGGER_J9HOOK_VM_RESOURCE_EXHAUSTED(vm->hookInterface, currentThread, resourceTypes, utfMessage); - } + } /* OOM_STATE_2 : If we're already throwing OutOfMemory, use the cached Throwable */ if (currentThread->privateFlags & J9_PRIVATE_FLAGS_OUT_OF_MEMORY) { @@ -657,10 +657,10 @@ internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionN DROP_OBJECT_IN_SPECIAL_FRAME(currentThread); /* cause */ goto done; } - + /* OOM_STATE_2 */ currentThread->privateFlags |= J9_PRIVATE_FLAGS_FINAL_CALL_OUT_OF_MEMORY; - + /* If there's a walkback object in the Throwable, zero it */ exceptionClass = J9OBJECT_CLAZZ(currentThread, exception); @@ -671,10 +671,10 @@ internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionN for (i = 0; i < J9INDEXABLEOBJECT_SIZE(currentThread, walkback); i++) { J9JAVAARRAYOFUDATA_STORE(currentThread, walkback, i, 0); - } + } currentThread->privateFlags |= J9_PRIVATE_FLAGS_FILL_EXISTING_TRACE; } - + goto sendConstructor; } /* OOM_STATE_1 */ @@ -682,8 +682,8 @@ internalSetCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionN resetOutOfMemory = TRUE; } - /* Get the class of the exception, loading the class if necessary. - * Fetch known class fatal exits if the class cannot be found. + /* Get the class of the exception, loading the class if necessary. + * Fetch known class fatal exits if the class cannot be found. */ exceptionClass = internalFindKnownClass(currentThread, index, J9_FINDKNOWNCLASS_FLAG_INITIALIZE | J9_FINDKNOWNCLASS_FLAG_NON_FATAL); if (exceptionClass == NULL) { @@ -772,7 +772,7 @@ typedef struct J9RedirectedSetCurrentExceptionWithCauseArgs { /** * This is an helper function to call internalSetCurrentExceptionWithCause indirectly from gpProtectAndRun function. - * + * * @param entryArg Argument structure (J9RedirectedSetCurrentExceptionWithCauseArgs). */ static UDATA @@ -789,12 +789,12 @@ gpProtectedSetCurrentExceptionWithCause(void *entryArg) * This function makes sure that call to "internalSetCurrentExceptionWithCause" is gpProtected * * @param currentThread - * @param exceptionNumber - * @param detailMessage - * @param cause + * @param exceptionNumber + * @param detailMessage + * @param cause * */ -void +void setCurrentExceptionWithCause(J9VMThread *currentThread, UDATA exceptionNumber, UDATA *detailMessage, j9object_t cause) { setCurrentExceptionWithUtfCause(currentThread, exceptionNumber, detailMessage, NULL, cause); @@ -819,7 +819,7 @@ setCurrentExceptionWithUtfCause(J9VMThread *currentThread, UDATA exceptionNumber } } -j9object_t +j9object_t walkStackForExceptionThrow(J9VMThread * currentThread, j9object_t exception, UDATA walkOnly) { J9StackWalkState * walkState = currentThread->stackWalkState; @@ -844,7 +844,7 @@ walkStackForExceptionThrow(J9VMThread * currentThread, j9object_t exception, UDA return walkState->restartException; } -void +void setClassCastException(J9VMThread *currentThread, J9Class * instanceClass, J9Class * castClass) { J9ClassCastParms detailMessage; @@ -863,7 +863,7 @@ setNegativeArraySizeException(J9VMThread *currentThread, I_32 size) setCurrentExceptionUTF(currentThread, J9VMCONSTANTPOOL_JAVALANGNEGATIVEARRAYSIZEEXCEPTION, buffer); } -void +void setClassLoadingConstraintError(J9VMThread * currentThread, J9ClassLoader * initiatingLoader, J9Class * existingClass) { PORT_ACCESS_FROM_VMC(currentThread); @@ -902,7 +902,7 @@ setClassLoadingConstraintError(J9VMThread * currentThread, J9ClassLoader * initi j9mem_free_memory(msg); } -void +void setClassLoadingConstraintSignatureError(J9VMThread *currentThread, J9ClassLoader *loader1, J9Class *class1, J9ClassLoader *loader2, J9Class *class2, J9Class *exceptionClass, U_8 *methodName, UDATA methodNameLength, U_8 *signature, UDATA signatureLength) { PORT_ACCESS_FROM_VMC(currentThread); @@ -968,7 +968,7 @@ setClassLoadingConstraintSignatureError(J9VMThread *currentThread, J9ClassLoader } -void +void setClassLoadingConstraintOverrideError(J9VMThread *currentThread, J9UTF8 *newClassNameUTF, J9ClassLoader *loader1, J9UTF8 *class1NameUTF, J9ClassLoader *loader2, J9UTF8 *class2NameUTF, J9UTF8 *exceptionClassNameUTF, U_8 *methodName, UDATA methodNameLength, U_8 *signature, UDATA signatureLength) { PORT_ACCESS_FROM_VMC(currentThread); @@ -1072,7 +1072,7 @@ nlsMessageForMethod(J9VMThread * currentThread, J9Method * method, U_32 module_n } -void +void setNativeBindOutOfMemoryError(J9VMThread * currentThread, J9Method * method) { char * msg = nlsMessageForMethod(currentThread, method, J9NLS_VM_BIND_OUT_OF_MEMORY); @@ -1083,7 +1083,7 @@ setNativeBindOutOfMemoryError(J9VMThread * currentThread, J9Method * method) } -void +void setRecursiveBindError(J9VMThread * currentThread, J9Method * method) { char * msg = nlsMessageForMethod(currentThread, method, J9NLS_VM_RECURSIVE_BIND); @@ -1094,7 +1094,7 @@ setRecursiveBindError(J9VMThread * currentThread, J9Method * method) } -void +void setNativeNotFoundError(J9VMThread * currentThread, J9Method * method) { j9object_t detailMessage = methodToString(currentThread, method); @@ -1104,7 +1104,7 @@ setNativeNotFoundError(J9VMThread * currentThread, J9Method * method) } -void +void setHeapOutOfMemoryError(J9VMThread * currentThread) { PORT_ACCESS_FROM_VMC(currentThread); @@ -1115,14 +1115,14 @@ setHeapOutOfMemoryError(J9VMThread * currentThread) } -void +void setArrayIndexOutOfBoundsException(J9VMThread * currentThread, IDATA index) { setCurrentException(currentThread, J9_EX_CTOR_INT + J9VMCONSTANTPOOL_JAVALANGARRAYINDEXOUTOFBOUNDSEXCEPTION, (UDATA*)(UDATA)index); } -void +void setNativeOutOfMemoryError(J9VMThread * vmThread, U_32 moduleName, U_32 messageNumber) { PORT_ACCESS_FROM_VMC(vmThread); @@ -1140,7 +1140,7 @@ setNativeOutOfMemoryError(J9VMThread * vmThread, U_32 moduleName, U_32 messageNu setCurrentExceptionUTF(vmThread, J9_EX_OOM_OS_HEAP | J9VMCONSTANTPOOL_JAVALANGOUTOFMEMORYERROR, msg); } -void +void setIncompatibleClassChangeErrorForDefaultConflict(J9VMThread * vmThread, J9Method *method) { PORT_ACCESS_FROM_VMC(vmThread); @@ -1177,7 +1177,7 @@ setIncompatibleClassChangeErrorForDefaultConflict(J9VMThread * vmThread, J9Metho j9mem_free_memory(msg); } -void +void setIllegalAccessErrorNonPublicInvokeInterface(J9VMThread *vmThread, J9Method *method) { PORT_ACCESS_FROM_VMC(vmThread); @@ -1214,7 +1214,7 @@ setIllegalAccessErrorNonPublicInvokeInterface(J9VMThread *vmThread, J9Method *me j9mem_free_memory(msg); } -void +void setThreadForkOutOfMemoryError(J9VMThread * vmThread, U_32 moduleName, U_32 messageNumber) { PORT_ACCESS_FROM_VMC(vmThread); @@ -1226,7 +1226,7 @@ setThreadForkOutOfMemoryError(J9VMThread * vmThread, U_32 moduleName, U_32 messa } -jint +jint initializeHeapOOMMessage(J9VMThread *currentThread) { J9JavaVM * vm = currentThread->javaVM; @@ -1241,14 +1241,14 @@ initializeHeapOOMMessage(J9VMThread *currentThread) if (NULL != globalRef) { vm->heapOOMStringRef = (j9object_t*)globalRef; - result = JNI_OK; + result = JNI_OK; } } return result; } -void +void setIllegalAccessErrorFinalFieldSet(J9VMThread *currentThread, UDATA isStatic, J9ROMClass *romClass, J9ROMFieldShape *field, J9ROMMethod *romMethod) { PORT_ACCESS_FROM_VMC(currentThread); @@ -1315,3 +1315,9 @@ setCRIUSingleThreadModeJVMCRIUException(J9VMThread *vmThread, U_32 moduleName, U Trc_VM_criu_setSingleThreadModeJVMCRIUException_triggerOneOffJavaDump(vmThread, rc); } #endif /* defined(J9VM_OPT_CRIU_SUPPORT) */ + +void +triggerAssertion(J9VMThread *currentThread, const char *message) +{ + Assert_VM_assertionFailure(currentThread, message); +} diff --git a/runtime/vm/intfunc.c b/runtime/vm/intfunc.c index 03853069834..980d35ee007 100644 --- a/runtime/vm/intfunc.c +++ b/runtime/vm/intfunc.c @@ -454,4 +454,5 @@ J9InternalVMFunctions J9InternalFunctions = { #if defined(J9VM_ZOS_3164_INTEROPERABILITY) && (JAVA_SPEC_VERSION >= 17) invoke31BitJNI_OnXLoad, #endif /* defined(J9VM_ZOS_3164_INTEROPERABILITY) && (JAVA_SPEC_VERSION >= 17) */ + triggerAssertion, }; diff --git a/runtime/vm/j9vm.tdf b/runtime/vm/j9vm.tdf index c2a45f25d8d..550a0a9afbc 100644 --- a/runtime/vm/j9vm.tdf +++ b/runtime/vm/j9vm.tdf @@ -980,3 +980,5 @@ TraceEvent=Trc_VM_criu_allocateVMThread_set_haltflag noEnv Overhead=1 Level=5 Te TraceEvent=Trc_VM_criu_toggleSuspendOnJavaThreads_start Test Overhead=1 Level=5 Template="toggleSuspendOnJavaThreads with currentThreadName(%s) suspendResumeFlag(%u)" TraceEvent=Trc_VM_criu_toggleSuspendOnJavaThreads_walkStatus Overhead=1 Level=5 Template="toggleSuspendOnJavaThreads (%s) walkThread(%p)" TraceEvent=Trc_VM_criu_toggleSuspendOnJavaThreads_walkThread Test Overhead=1 Level=5 Template="toggleSuspendOnJavaThreads with walkThreadName(%s) suspendResumeFlag(%u) walkThread(%p) currentThread(%p)" + +TraceEvent=Assert_VM_assertionFailure Overhead=1 Level=1 Template="%s" diff --git a/runtime/vm/vmthread.cpp b/runtime/vm/vmthread.cpp index bc78f5ae234..c3d7d6185e5 100644 --- a/runtime/vm/vmthread.cpp +++ b/runtime/vm/vmthread.cpp @@ -194,6 +194,7 @@ allocateVMThread(J9JavaVM *vm, omrthread_t osThread, UDATA privateFlags, void *m newThread->contiguousIndexableHeaderSize = vm->contiguousIndexableHeaderSize; newThread->discontiguousIndexableHeaderSize = vm->discontiguousIndexableHeaderSize; + newThread->unsafeIndexableHeaderSize = vm->unsafeIndexableHeaderSize; #if defined(J9VM_ENV_DATA64) newThread->isIndexableDataAddrPresent = vm->isIndexableDataAddrPresent; #endif /* defined(J9VM_ENV_DATA64) */