l1a/l1b: PARTIAL (no explicit NPE); l2: FAIL (unsupported, broken codegen)#568
Open
opencode-agent[bot] wants to merge 1 commit into
Open
l1a/l1b: PARTIAL (no explicit NPE); l2: FAIL (unsupported, broken codegen)#568opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
…egen) Co-authored-by: LSantha <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec compliance report
saloadmarked unsupported inL2ByteCodeSupportChecker;GenericX86CodeGenerator.generateCodeFor(ArrayAssignQuad)ignores element type (hardcodes 32-bit, scale=4)Details
l1a Implementation
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:3919(visit_saload),:4045(waload),:330(checkBounds)waloadpopsIntItem idx(index) thenRefItem ref(arrayref) — matches spec..., arrayref, index → ..., value.valSize = BITS16,scale = 2(lines 4058-4062).resultType = JvmType.INT; pushesWordItem(int).os.writeMOVSX(resultr, resultr, WORDSIZE)at line 4126 sign-extends 16-bit short to 32-bit int.checkBounds(ref, idx)emits bounds check callingSoftByteCodes.throwArrayOutOfBounds.test ref, ref / jz throw_npesequence. Relies on JNode's page fault handler (ints32.asm:406-408,ints64.asm:427-428) to convert null-page access toEX_NULLPOINTER→NullPointerException. Spec requires explicit NPE throw; implicit HW fault is implementation-dependent.l1b Implementation
core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:4870(visit_saload),:5029(waload),:322(checkBounds)waloadimplementation, same operand handling, same missing explicit null check.l2 Implementation
core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java:71,core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java:4001L2ByteCodeSupportChecker.visit_saload()callsnotSupported()(line 72) — methods containingsaloadnever reach L2 compilation; fall back to L1.IRGenerator.visit_saload()(line 384) emitsArrayAssignQuadwithtype = Operand.SHORT.GenericX86CodeGenerator.generateCodeFor(ArrayAssignQuad)(line 4001) hardcodesscale = 4andBITS32(line 4018, 4030, 4043, etc.), ignoringquad.getType(). For SHORT it should usescale = 2,BITS16, and emit sign-extension (MOVSX).checkBounds(line 4276) also lacks explicit null check (same implicit page-fault reliance).Closes #374
opencode session | github run