Skip to content

Fix incorrect faulting instruction update in BNDCHK implicit null check - #24586

Open
AbdallahAbd05 wants to merge 1 commit into
eclipse-openj9:masterfrom
AbdallahAbd05:fix-bndchkImplicitNullStackMap
Open

Fix incorrect faulting instruction update in BNDCHK implicit null check#24586
AbdallahAbd05 wants to merge 1 commit into
eclipse-openj9:masterfrom
AbdallahAbd05:fix-bndchkImplicitNullStackMap

Conversation

@AbdallahAbd05

Copy link
Copy Markdown
Contributor

When a BNDCHK has a foldedImplicitNULLCHK, the function setImplicitNULLCHKExceptionInfo attempts to correctly identify the faulting instruction. The condition checked for both CMP4MemReg and CMP4RegMem, but CMP4RegMem loads from an object field (e.g. idx from 'this') rather than the array, so it cannot be the faulting instruction for a null array access. This caused the stack walker to fail to find the stack map, hitting a fatal assertion in jswalk.c.

The fix removes CMP4RegMem from the condition, keeping only CMP4MemReg which correctly identifies a cmp that loads array length from the array.

Fixes #24569

@hzongaro hzongaro self-assigned this Aug 19, 2026
@hzongaro
hzongaro self-requested a review August 19, 2026 14:17
@hzongaro

Copy link
Copy Markdown
Member

Thanks for figuring out the problem. I think the change looks correct.

May I ask you to provide more information in the commit comment indicating why the change is being made? Some of the same information that you've provided in the pull request description above would be appropriate.

Also, could you add a comment here showing the relevant IL that could give rise to a CMP4MemReg instruction versus the IL that might give rise to a CMP4RegMem instruction to help illustrate the two cases?

When a BNDCHK has a foldedImplicitNULLCHK, the function
setImplicitNULLCHKExceptionInfo attempts to correctly identify the faulting
instruction. The condition checked for both CMP4MemReg and CMP4RegMem, but
CMP4RegMem loads from an object field rather than the array, so it cannot be
the faulting instruction for a null array access. This caused the stack
walker to fail to find the stack map, hitting a fatal assertion in jswalk.c.

The fix removes CMP4RegMem from the condition, keeping only CMP4MemReg which
correctly identifies a cmp that loads array length from the array.
@AbdallahAbd05
AbdallahAbd05 force-pushed the fix-bndchkImplicitNullStackMap branch from 5f425d3 to 670a110 Compare August 26, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JVMCDRT000E: Unable to locate JIT stack map - aborting VM with Assertion Failed in jswalk.c on NullPointerException

2 participants