Skip to content

Commit 3624377

Browse files
committed
Fix incorrect map argument
For accurate bytecode information, getCurrentByteCodeIndexAndIsSameReceiver needs the inline map, not the stack map. Fix exception event and decompilation to use the proper map, and update the variable name in other code to be consistent. Closes: #3373 [ci skip] Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
1 parent fe549ec commit 3624377

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

runtime/codert_vm/CodertVMHelpers.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,14 @@ jitGetExceptionCatcher(J9VMThread *currentThread, void *handlerPC, J9JITExceptio
332332
* the start address of the compiled exception handler.
333333
*/
334334
jitGetMapsFromPC(currentThread->javaVM, metaData, (UDATA)handlerPC + 1, &stackMap, &inlineMap);
335-
Assert_CodertVM_false(NULL == stackMap);
335+
Assert_CodertVM_false(NULL == inlineMap);
336336
if (NULL != getJitInlinedCallInfo(metaData)) {
337-
if (NULL != inlineMap) {
338-
inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap);
339-
if (NULL != inlinedCallSite) {
340-
method = (J9Method*)getInlinedMethod(inlinedCallSite);
341-
}
337+
inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap);
338+
if (NULL != inlinedCallSite) {
339+
method = (J9Method*)getInlinedMethod(inlinedCallSite);
342340
}
343341
}
344-
*location = (IDATA)getCurrentByteCodeIndexAndIsSameReceiver(metaData, stackMap, inlinedCallSite, NULL);
342+
*location = (IDATA)getCurrentByteCodeIndexAndIsSameReceiver(metaData, inlineMap, inlinedCallSite, NULL);
345343
return method;
346344
}
347345

runtime/codert_vm/decomp.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,13 +1228,11 @@ c_jitDecompileAtExceptionCatch(J9VMThread * currentThread)
12281228
* decomp record is the start address of the compiled exception handler.
12291229
*/
12301230
jitGetMapsFromPC(vm, metaData, (UDATA)jitPC + 1, &stackMap, &inlineMap);
1231-
Assert_CodertVM_false(NULL == stackMap);
1231+
Assert_CodertVM_false(NULL == inlineMap);
12321232
if (NULL != getJitInlinedCallInfo(metaData)) {
1233-
if (NULL != inlineMap) {
1234-
inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap);
1235-
if (inlinedCallSite != NULL) {
1236-
newNumberOfFrames = getJitInlineDepthFromCallSite(metaData, inlinedCallSite) + 1;
1237-
}
1233+
inlinedCallSite = getFirstInlinedCallSite(metaData, inlineMap);
1234+
if (inlinedCallSite != NULL) {
1235+
newNumberOfFrames = getJitInlineDepthFromCallSite(metaData, inlinedCallSite) + 1;
12381236
}
12391237
}
12401238
Assert_CodertVM_true(numberOfFrames >= newNumberOfFrames);
@@ -1255,7 +1253,7 @@ c_jitDecompileAtExceptionCatch(J9VMThread * currentThread)
12551253
/* Fix the OSR frame to resume at the catch point with an empty pending stack (the caught exception
12561254
* is pushed after decompilation completes).
12571255
*/
1258-
osrFrame->bytecodePCOffset = getCurrentByteCodeIndexAndIsSameReceiver(metaData, stackMap, inlinedCallSite, NULL);
1256+
osrFrame->bytecodePCOffset = getCurrentByteCodeIndexAndIsSameReceiver(metaData, inlineMap, inlinedCallSite, NULL);
12591257
Trc_Decomp_jitInterpreterPCFromWalkState_Entry(jitPC);
12601258
Trc_Decomp_jitInterpreterPCFromWalkState_exHandler(osrFrame->bytecodePCOffset);
12611259
osrFrame->pendingStackHeight = 0;

runtime/vm/exceptiondescribe.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ iterateStackTrace(J9VMThread * vmThread, j9object_t* exception, callback_func_t
285285
J9JITExceptionTable * metaData = NULL;
286286
UDATA inlineDepth = 0;
287287
void * inlinedCallSite = NULL;
288-
void * stackMap = NULL;
288+
void * inlineMap = NULL;
289289
J9JITConfig * jitConfig = vm->jitConfig;
290290

291291
if (jitConfig) {
292292
metaData = jitConfig->jitGetExceptionTableFromPC(vmThread, methodPC);
293293
if (metaData) {
294-
stackMap = jitConfig->jitGetInlinerMapFromPC(vm, metaData, methodPC);
295-
if (stackMap) {
296-
inlinedCallSite = jitConfig->getFirstInlinedCallSite(metaData, stackMap);
294+
inlineMap = jitConfig->jitGetInlinerMapFromPC(vm, metaData, methodPC);
295+
if (inlineMap) {
296+
inlinedCallSite = jitConfig->getFirstInlinedCallSite(metaData, inlineMap);
297297
if (inlinedCallSite) {
298298
inlineDepth = jitConfig->getJitInlineDepthFromCallSite(metaData, inlinedCallSite);
299299
totalEntries += inlineDepth;
@@ -318,15 +318,15 @@ iterateStackTrace(J9VMThread * vmThread, j9object_t* exception, callback_func_t
318318
goto done;
319319
}
320320
if (inlineDepth == 0) {
321-
if (stackMap == NULL) {
321+
if (inlineMap == NULL) {
322322
methodPC = -1;
323323
isSameReceiver = FALSE;
324324
} else {
325-
methodPC = jitConfig->getCurrentByteCodeIndexAndIsSameReceiver(metaData, stackMap, NULL, &isSameReceiver);
325+
methodPC = jitConfig->getCurrentByteCodeIndexAndIsSameReceiver(metaData, inlineMap, NULL, &isSameReceiver);
326326
}
327327
ramMethod = metaData->ramMethod;
328328
} else {
329-
methodPC = jitConfig->getCurrentByteCodeIndexAndIsSameReceiver(metaData, stackMap , inlinedCallSite, &isSameReceiver);
329+
methodPC = jitConfig->getCurrentByteCodeIndexAndIsSameReceiver(metaData, inlineMap , inlinedCallSite, &isSameReceiver);
330330
ramMethod = jitConfig->getInlinedMethod(inlinedCallSite);
331331
}
332332
if (pruneConstructors) {

0 commit comments

Comments
 (0)