From 244a57aa7dcb5282baca4cd07c517e38e5b7a893 Mon Sep 17 00:00:00 2001 From: Tobi Ajila Date: Wed, 16 Feb 2022 15:59:31 -0500 Subject: [PATCH] Replaces uses of currentThread with walkThread in jswalk There are cases where a non JVM thread may trigger a javacore. In these cases the currentThread will be NULL. This will cause crashes when we need to walk certain jit frames as the currentThread is used to facilitate this. This PR replaces uses of currentThread with walkThread in these cases. Signed-off-by: Tobi Ajila --- runtime/codert_vm/CodertVMHelpers.cpp | 4 ++-- runtime/codert_vm/cnathelp.cpp | 2 +- runtime/codert_vm/decomp.cpp | 6 +++--- runtime/codert_vm/jswalk.c | 18 +++++++++--------- runtime/compiler/runtime/MethodMetaData.c | 23 +++++++++++------------ runtime/compiler/runtime/MethodMetaData.h | 8 ++++---- runtime/compiler/runtime/SignalHandler.c | 4 ++-- runtime/oti/j9nonbuilder.h | 9 +++++---- runtime/oti/j9protos.h | 6 +++--- runtime/vm/exceptiondescribe.c | 4 ++-- runtime/vm/swalk.c | 1 + 11 files changed, 43 insertions(+), 42 deletions(-) diff --git a/runtime/codert_vm/CodertVMHelpers.cpp b/runtime/codert_vm/CodertVMHelpers.cpp index 3523fb3c2b6..e0068062d8c 100644 --- a/runtime/codert_vm/CodertVMHelpers.cpp +++ b/runtime/codert_vm/CodertVMHelpers.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -323,7 +323,7 @@ jitGetExceptionCatcher(J9VMThread *currentThread, void *handlerPC, J9JITExceptio * because jitGetMapsFromPC is expecting a return address, so it subtracts 1. The value passed in is * the start address of the compiled exception handler. */ - jitGetMapsFromPC(currentThread, metaData, (UDATA)handlerPC + 1, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, currentThread->javaVM, metaData, (UDATA)handlerPC + 1, &stackMap, &inlineMap); Assert_CodertVM_false(NULL == inlineMap); if (NULL != getJitInlinedCallInfo(metaData)) { inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap); diff --git a/runtime/codert_vm/cnathelp.cpp b/runtime/codert_vm/cnathelp.cpp index 319ed9fa2da..e8f9e1bdbb9 100644 --- a/runtime/codert_vm/cnathelp.cpp +++ b/runtime/codert_vm/cnathelp.cpp @@ -1718,7 +1718,7 @@ slow_jitMonitorEnterImpl(J9VMThread *currentThread, bool forMethod) J9JavaVM *vm = currentThread->javaVM; J9JITExceptionTable *metaData = vm->jitConfig->jitGetExceptionTableFromPC(currentThread, (UDATA)oldPC); Assert_CodertVM_false(NULL == metaData); - jitGetMapsFromPC(currentThread, metaData, (UDATA)oldPC, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, vm, metaData, (UDATA)oldPC, &stackMap, &inlineMap); Assert_CodertVM_false(NULL == inlineMap); if ((NULL == getJitInlinedCallInfo(metaData)) || (NULL == getFirstInlinedCallSite(metaData, inlineMap))) { J9SFJITResolveFrame *resolveFrame = (J9SFJITResolveFrame*)currentThread->sp; diff --git a/runtime/codert_vm/decomp.cpp b/runtime/codert_vm/decomp.cpp index 4f580e3d5c3..f2243aa9e08 100644 --- a/runtime/codert_vm/decomp.cpp +++ b/runtime/codert_vm/decomp.cpp @@ -1252,7 +1252,7 @@ c_jitDecompileAtExceptionCatch(J9VMThread * currentThread) * because jitGetMapsFromPC is expecting a return address, so it subtracts 1. The value stored in the * decomp record is the start address of the compiled exception handler. */ - jitGetMapsFromPC(currentThread, metaData, (UDATA)jitPC + 1, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, vm, metaData, (UDATA)jitPC + 1, &stackMap, &inlineMap); Assert_CodertVM_false(NULL == inlineMap); if (NULL != getJitInlinedCallInfo(metaData)) { inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap); @@ -1853,7 +1853,7 @@ osrAllFramesSize(J9VMThread *currentThread, J9JITExceptionTable *metaData, void void * inlineMap = NULL; /* Count the inlined methods */ - jitGetMapsFromPC(currentThread, metaData, (UDATA)jitPC, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, currentThread->javaVM, metaData, (UDATA)jitPC, &stackMap, &inlineMap); Assert_CodertVM_false(NULL == inlineMap); if (NULL != getJitInlinedCallInfo(metaData)) { void *inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap); @@ -2190,7 +2190,7 @@ initializeOSRBuffer(J9VMThread *currentThread, J9OSRBuffer *osrBuffer, J9OSRData U_16 numberOfMapBits = 0; /* Get the stack map, inline map and live monitor metadata */ - jitGetMapsFromPC(currentThread, metaData, (UDATA)jitPC, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, currentThread->javaVM, metaData, (UDATA)jitPC, &stackMap, &inlineMap); liveMonitorMap = getJitLiveMonitors(metaData, stackMap); gcStackAtlas = (J9JITStackAtlas *)getJitGCStackAtlas(metaData); numberOfMapBits = getJitNumberOfMapBytes(gcStackAtlas) << 3; diff --git a/runtime/codert_vm/jswalk.c b/runtime/codert_vm/jswalk.c index 0f5a2baed9c..b1bfaae96ed 100644 --- a/runtime/codert_vm/jswalk.c +++ b/runtime/codert_vm/jswalk.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -186,7 +186,7 @@ UDATA jitWalkStackFrames(J9StackWalkState *walkState) walkState->outgoingArgCount = walkState->argCount; if ((!(walkState->flags & J9_STACKWALK_SKIP_INLINES)) && getJitInlinedCallInfo(walkState->jitInfo)) { - jitGetMapsFromPC(walkState->currentThread, walkState->jitInfo, (UDATA) walkState->pc, &(walkState->stackMap), &(walkState->inlineMap)); + jitGetMapsFromPC(walkState->currentThread, walkState->javaVM, walkState->jitInfo, (UDATA) walkState->pc, &(walkState->stackMap), &(walkState->inlineMap)); if (NULL != walkState->inlineMap) { walkState->inlinedCallSite = getFirstInlinedCallSite(walkState->jitInfo, walkState->inlineMap); @@ -217,7 +217,7 @@ UDATA jitWalkStackFrames(J9StackWalkState *walkState) } } } else if (walkState->flags & J9_STACKWALK_RECORD_BYTECODE_PC_OFFSET) { - jitGetMapsFromPC(walkState->currentThread, walkState->jitInfo, (UDATA) walkState->pc, &(walkState->stackMap), &(walkState->inlineMap)); + jitGetMapsFromPC(walkState->currentThread, walkState->javaVM, walkState->jitInfo, (UDATA) walkState->pc, &(walkState->stackMap), &(walkState->inlineMap)); } SET_A0_CP_METHOD(walkState); @@ -517,7 +517,7 @@ static void jitWalkFrame(J9StackWalkState *walkState, UDATA walkLocals, void *st WALK_METHOD_CLASS(walkState); if (stackMap == NULL) { - stackMap = getStackMapFromJitPC(walkState->currentThread, walkState->jitInfo, (UDATA) walkState->pc); + stackMap = getStackMapFromJitPC(walkState->currentThread, walkState->javaVM, walkState->jitInfo, (UDATA) walkState->pc); if (stackMap == NULL) { if (J9_ARE_ANY_BITS_SET(walkState->flags, J9_STACKWALK_NO_ERROR_REPORT)) { return; @@ -1061,7 +1061,7 @@ static void jitWalkResolveMethodFrame(J9StackWalkState *walkState) } return; } - jitGetMapsFromPC(walkState->currentThread, metaData, (UDATA)walkState->pc, &stackMap, &inlineMap); + jitGetMapsFromPC(walkState->currentThread, walkState->javaVM, metaData, (UDATA)walkState->pc, &stackMap, &inlineMap); /* If there are no inlines, use the outer method. Otherwise, use the innermost inline at the current PC */ @@ -1680,7 +1680,7 @@ jitGetOwnedObjectMonitors(J9StackWalkState *walkState) } /* get the stackmap and inline map for the given pc (this is a single walk of jit metadata) */ - jitGetMapsFromPC(walkState->currentThread, walkState->jitInfo, (UDATA)walkState->pc, &stackMap, &inlineMap); + jitGetMapsFromPC(walkState->currentThread, walkState->javaVM, walkState->jitInfo, (UDATA)walkState->pc, &stackMap, &inlineMap); /* get a slot map of all live monitors on the JIT frame. May include slots from inlined methods */ liveMonitorMap = getJitLiveMonitors(walkState->jitInfo, stackMap); @@ -1732,7 +1732,7 @@ countOwnedObjectMonitors(J9StackWalkState *walkState) U_16 numberOfMapBits; /* get the stackmap and inline map for the given pc (this is a single walk of jit metadata) */ - jitGetMapsFromPC(walkState->currentThread, walkState->jitInfo, (UDATA)walkState->pc, &stackMap, &inlineMap); + jitGetMapsFromPC(walkState->currentThread, walkState->javaVM, walkState->jitInfo, (UDATA)walkState->pc, &stackMap, &inlineMap); /* get a slot map of all live monitors on the JIT frame. May include slots from inlined methods */ liveMonitorMap = getJitLiveMonitors(walkState->jitInfo, stackMap); @@ -1779,7 +1779,7 @@ walkLiveMonitorSlots(J9StackWalkState *walkState, J9JITStackAtlas *gcStackAtlas, U_8 bit; J9VMThread *currentThread = walkState->currentThread; J9VMThread *targetThread = walkState->walkThread; - J9InternalVMFunctions const * const vmFuncs = currentThread->javaVM->internalVMFunctions; + J9InternalVMFunctions const * const vmFuncs = walkState->javaVM->internalVMFunctions; for (i = 0; i < numberOfMapBits; ++i) { bit = liveMonitorMap[i >> 3] & monitorMask[i >> 3] & (1 << (i & 7)); @@ -1819,7 +1819,7 @@ countLiveMonitorSlots(J9StackWalkState *walkState, J9JITStackAtlas *gcStackAtlas U_8 bit; J9VMThread *currentThread = walkState->currentThread; J9VMThread *targetThread = walkState->walkThread; - J9InternalVMFunctions const * const vmFuncs = currentThread->javaVM->internalVMFunctions; + J9InternalVMFunctions const * const vmFuncs = walkState->javaVM->internalVMFunctions; for (i = 0; i < numberOfMapBits; ++i) { bit = liveMonitorMap[i >> 3] & monitorMask[i >> 3]; diff --git a/runtime/compiler/runtime/MethodMetaData.c b/runtime/compiler/runtime/MethodMetaData.c index 3662a8a34fc..e9895d467f5 100644 --- a/runtime/compiler/runtime/MethodMetaData.c +++ b/runtime/compiler/runtime/MethodMetaData.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2021 IBM Corp. and others + * Copyright (c) 2000, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -224,16 +224,15 @@ static VMINLINE TR_StackMapTable * initializeMapTable(J9JavaVM * javaVM, J9TR_Me return mapTable; } -static VMINLINE TR_StackMapTable * findOrCreateMapTable(J9VMThread * currentThread, J9TR_MethodMetaData * metaData, UDATA fourByteOffsets) +static VMINLINE TR_StackMapTable * findOrCreateMapTable(J9VMThread * currentThread, J9JavaVM * javaVM, J9TR_MethodMetaData * metaData, UDATA fourByteOffsets) { TR_StackMapTable * mapTablePtr = 0; assert(metaData); // In a signal handler, do not use or create the map tables. The tables may be in an inconsistent // state when interrupted by the signal, and malloc must not be called from a signal handler. - if (J9_ARE_NO_BITS_SET(currentThread->privateFlags2, J9_PRIVATE_FLAGS2_ASYNC_GET_CALL_TRACE)) + if ((NULL != currentThread) && J9_ARE_NO_BITS_SET(currentThread->privateFlags2, J9_PRIVATE_FLAGS2_ASYNC_GET_CALL_TRACE)) { - J9JavaVM * javaVM = currentThread->javaVM; if (metaData->bodyInfo && (javaVM->phase == J9VM_PHASE_NOT_STARTUP || 0 == (javaVM->jitConfig->runtimeFlags & J9JIT_QUICKSTART))) // save footprint during startup in Xquickstart mode { @@ -404,7 +403,7 @@ static void fastwalkDebug(J9TR_MethodMetaData * methodMetaData, UDATA offsetPC, } #endif /* defined(DEBUG) */ -void jitGetMapsFromPC(J9VMThread * currentThread, J9TR_MethodMetaData * methodMetaData, UDATA jitPC, void * * stackMap, void * * inlineMap) +void jitGetMapsFromPC(J9VMThread * currentThread, J9JavaVM * vm, J9TR_MethodMetaData * methodMetaData, UDATA jitPC, void * * stackMap, void * * inlineMap) { TR_MapIterator i; TR_StackMapTable * stackMapTable = 0; @@ -435,7 +434,7 @@ void jitGetMapsFromPC(J9VMThread * currentThread, J9TR_MethodMetaData * methodMe #ifdef FASTWALK - stackMapTable = findOrCreateMapTable(currentThread, methodMetaData, fourByteOffsets); + stackMapTable = findOrCreateMapTable(currentThread, vm, methodMetaData, fourByteOffsets); if (stackMapTable) { @@ -525,17 +524,17 @@ void jitGetMapsFromPC(J9VMThread * currentThread, J9TR_MethodMetaData * methodMe } } -void * jitGetInlinerMapFromPC(J9VMThread * currentThread, J9TR_MethodMetaData * methodMetaData, UDATA jitPC) +void * jitGetInlinerMapFromPC(J9VMThread * currentThread, J9JavaVM * vm, J9TR_MethodMetaData * methodMetaData, UDATA jitPC) { void * stackMap, * inlineMap; - jitGetMapsFromPC(currentThread, methodMetaData, jitPC, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, vm, methodMetaData, jitPC, &stackMap, &inlineMap); return inlineMap; } -void * getStackMapFromJitPC(J9VMThread * currentThread, J9TR_MethodMetaData * methodMetaData, UDATA jitPC) +void * getStackMapFromJitPC(J9VMThread * currentThread, J9JavaVM * vm, J9TR_MethodMetaData * methodMetaData, UDATA jitPC) { void * stackMap, * inlineMap; - jitGetMapsFromPC(currentThread, methodMetaData, jitPC, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, vm, methodMetaData, jitPC, &stackMap, &inlineMap); return stackMap; } @@ -551,7 +550,7 @@ void * getStackAllocMapFromJitPC(J9VMThread * currentThread, J9TR_MethodMetaData if (curStackMap) stackMap = curStackMap; else - stackMap = getStackMapFromJitPC(currentThread, methodMetaData, jitPC); + stackMap = getStackMapFromJitPC(currentThread, currentThread->javaVM, methodMetaData, jitPC); stackAllocMap = (void **)((J9JITStackAtlas *) methodMetaData->gcStackAtlas)->stackAllocMap; if (stackAllocMap) @@ -2447,7 +2446,7 @@ void* preOSR(J9VMThread* currentThread, J9JITExceptionTable *metaData, void *pc) assert(metaData); assert(metaData->osrInfo); - jitGetMapsFromPC(currentThread, metaData, (UDATA) pc, &stackMap, &inlineMap); + jitGetMapsFromPC(currentThread, currentThread->javaVM, metaData, (UDATA) pc, &stackMap, &inlineMap); bcInfo = (TR_ByteCodeInfo*) getByteCodeInfoFromStackMap(metaData, inlineMap); /* printf("offset=%08X bytecode.caller=%d bytecode.index=%x\n", diff --git a/runtime/compiler/runtime/MethodMetaData.h b/runtime/compiler/runtime/MethodMetaData.h index 7410115289b..4abd0959560 100644 --- a/runtime/compiler/runtime/MethodMetaData.h +++ b/runtime/compiler/runtime/MethodMetaData.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2021 IBM Corp. and others + * Copyright (c) 2000, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -240,11 +240,11 @@ typedef struct TR_MapIterator } \ } -void * getStackMapFromJitPC(J9VMThread * currentThread, J9TR_MethodMetaData * exceptionTable, UDATA jitPC); +void * getStackMapFromJitPC(J9VMThread * currentThread, J9JavaVM * vm, J9TR_MethodMetaData * exceptionTable, UDATA jitPC); void * getStackAllocMapFromJitPC(J9VMThread * currentThread, J9TR_MethodMetaData * exceptionTable, UDATA jitPC, void *curStackMap); UDATA jitExceptionHandlerSearch(J9VMThread * currentThread, J9StackWalkState * walkState); -void * jitGetInlinerMapFromPC(J9VMThread * currentThread, J9JITExceptionTable * exceptionTable, UDATA jitPC); -void jitGetMapsFromPC(J9VMThread * currentThread, J9JITExceptionTable * exceptionTable, UDATA jitPC, void * * inlineMap, void * * stackMap); +void * jitGetInlinerMapFromPC(J9VMThread * currentThread, J9JavaVM * vm, J9JITExceptionTable * exceptionTable, UDATA jitPC); +void jitGetMapsFromPC(J9VMThread * currentThread, J9JavaVM * vm, J9JITExceptionTable * exceptionTable, UDATA jitPC, void * * inlineMap, void * * stackMap); void * getFirstInlineRange(TR_MapIterator * i, void * methodMetaData, UDATA * startOffset, UDATA * endOffset); void * getNextInlineRange(TR_MapIterator * i, UDATA * startOffset, UDATA * endOffset); void walkJITFrameSlotsForInternalPointers(J9StackWalkState * walkState, U_8 ** jitDescriptionCursor, UDATA * scanCursor, void *stackMap, J9JITStackAtlas *gcStackAtlas); diff --git a/runtime/compiler/runtime/SignalHandler.c b/runtime/compiler/runtime/SignalHandler.c index f133c4de3d8..2d14488e94a 100644 --- a/runtime/compiler/runtime/SignalHandler.c +++ b/runtime/compiler/runtime/SignalHandler.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2021 IBM Corp. and others + * Copyright (c) 2000, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -398,7 +398,7 @@ UDATA jitX86Handler(J9VMThread* vmThread, U_32 sigType, void* sigInfo) } } - stackMap = jitConfig->jitGetStackMapFromPC(vmThread, exceptionTable, (UDATA) (eip + 1)); + stackMap = jitConfig->jitGetStackMapFromPC(vmThread, vmThread->javaVM, exceptionTable, (UDATA) (eip + 1)); if (stackMap ) { registerMap = jitConfig->getJitRegisterMap(exceptionTable, stackMap); *espPtr += (((registerMap >> 16) & 0xFF) * sizeof(UDATA)); diff --git a/runtime/oti/j9nonbuilder.h b/runtime/oti/j9nonbuilder.h index d2fb6e6e11a..467140f90a5 100644 --- a/runtime/oti/j9nonbuilder.h +++ b/runtime/oti/j9nonbuilder.h @@ -2461,6 +2461,7 @@ typedef struct J9I2JState { typedef struct J9StackWalkState { struct J9StackWalkState* previous; struct J9VMThread* walkThread; + struct J9JavaVM* javaVM; UDATA flags; UDATA* bp; UDATA* unwindSP; @@ -2516,7 +2517,7 @@ typedef struct J9StackWalkState { /* The size of J9StackWalkState must be a multiple of 8 because it is inlined into * J9VMThread where alignment assumotions are being made. */ -#if 1 && !defined(J9VM_ENV_DATA64) /* Change to 0 or 1 based on number of fields above */ +#if 0 && !defined(J9VM_ENV_DATA64) /* Change to 0 or 1 based on number of fields above */ U_32 padTo8; #endif /* !J9VM_ENV_DATA64 */ } J9StackWalkState; @@ -3916,11 +3917,11 @@ typedef struct J9JITConfig { UDATA codeCacheTotalKB; UDATA dataCacheTotalKB; struct J9JITExceptionTable* ( *jitGetExceptionTableFromPC)(struct J9VMThread * vmThread, UDATA jitPC) ; - void* ( *jitGetStackMapFromPC)(struct J9VMThread * currentThread, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; - void* ( *jitGetInlinerMapFromPC)(struct J9VMThread * currentThread, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; + void* ( *jitGetStackMapFromPC)(struct J9VMThread * currentThread, struct J9JavaVM * vm, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; + void* ( *jitGetInlinerMapFromPC)(struct J9VMThread * currentThread, struct J9JavaVM * vm, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; UDATA ( *getJitInlineDepthFromCallSite)(struct J9JITExceptionTable *metaData, void *inlinedCallSite) ; void* ( *getJitInlinedCallInfo)(struct J9JITExceptionTable * md) ; - void* ( *getStackMapFromJitPC)(struct J9VMThread * currentThread, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; + void* ( *getStackMapFromJitPC)(struct J9VMThread * currentThread, struct J9JavaVM * vm, struct J9JITExceptionTable * exceptionTable, UDATA jitPC) ; void* ( *getFirstInlinedCallSite)(struct J9JITExceptionTable * metaData, void * stackMap) ; void* ( *getNextInlinedCallSite)(struct J9JITExceptionTable * metaData, void * inlinedCallSite) ; UDATA ( *hasMoreInlinedMethods)(void * inlinedCallSite) ; diff --git a/runtime/oti/j9protos.h b/runtime/oti/j9protos.h index e6483b6e330..576d0f31bed 100644 --- a/runtime/oti/j9protos.h +++ b/runtime/oti/j9protos.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1377,8 +1377,8 @@ extern J9_CFUNC UDATA hasMoreInlinedMethods (void * inlinedCallSite); extern J9_CFUNC UDATA getByteCodeIndex (void * inlinedCallSite); extern J9_CFUNC void jitReportDynamicCodeLoadEvents (J9VMThread * currentThread); extern J9_CFUNC UDATA getJitInlineDepthFromCallSite (J9JITExceptionTable *metaData, void *inlinedCallSite); -extern J9_CFUNC void* jitGetInlinerMapFromPC (J9VMThread * currentThread, J9JITExceptionTable * exceptionTable, UDATA jitPC); -extern J9_CFUNC void* getStackMapFromJitPC (J9VMThread * currentThread, struct J9JITExceptionTable * exceptionTable, UDATA jitPC); +extern J9_CFUNC void* jitGetInlinerMapFromPC (J9VMThread * currentThread, J9JavaVM * vm, J9JITExceptionTable * exceptionTable, UDATA jitPC); +extern J9_CFUNC void* getStackMapFromJitPC (J9VMThread * currentThread, J9JavaVM * vm, struct J9JITExceptionTable * exceptionTable, UDATA jitPC); extern J9_CFUNC UDATA getCurrentByteCodeIndexAndIsSameReceiver (J9JITExceptionTable *metaData, void *stackMap, void *currentInlinedCallSite, UDATA * isSameReceiver); extern J9_CFUNC void clearFPStack (void); extern J9_CFUNC void jitExclusiveVMShutdownPending (J9VMThread *vmThread); diff --git a/runtime/vm/exceptiondescribe.c b/runtime/vm/exceptiondescribe.c index d7c0635af74..c926fc90986 100644 --- a/runtime/vm/exceptiondescribe.c +++ b/runtime/vm/exceptiondescribe.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -279,7 +279,7 @@ iterateStackTrace(J9VMThread * vmThread, j9object_t* exception, callback_func_t if (jitConfig) { metaData = jitConfig->jitGetExceptionTableFromPC(vmThread, methodPC); if (metaData) { - inlineMap = jitConfig->jitGetInlinerMapFromPC(vmThread, metaData, methodPC); + inlineMap = jitConfig->jitGetInlinerMapFromPC(vmThread, vm, metaData, methodPC); if (inlineMap) { inlinedCallSite = jitConfig->getFirstInlinedCallSite(metaData, inlineMap); if (inlinedCallSite) { diff --git a/runtime/vm/swalk.c b/runtime/vm/swalk.c index b854f54a8a0..dbb12d751a5 100644 --- a/runtime/vm/swalk.c +++ b/runtime/vm/swalk.c @@ -125,6 +125,7 @@ UDATA walkStackFrames(J9VMThread *currentThread, J9StackWalkState *walkState) currentThread->activeWalkState = walkState; } + walkState->javaVM = walkState->walkThread->javaVM; walkState->currentThread = currentThread; walkState->cache = NULL; walkState->framesWalked = 0;