Skip to content

All 3 compilers FAIL: l1a/l1b miss returnAddress push/type; L2 explicitly unsupported#561

Open
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue330-20260623001901
Open

All 3 compilers FAIL: l1a/l1b miss returnAddress push/type; L2 explicitly unsupported#561
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue330-20260623001901

Conversation

@opencode-agent

Copy link
Copy Markdown

Spec Compliance Report for jsr_w

Compiler Status Issues
l1a ❌ FAIL Missing operand stack push of returnAddress; no returnAddress type support; ret/jsr asymmetry not modeled
l1b ❌ FAIL Missing operand stack push of returnAddress; no returnAddress type support; ret/jsr asymmetry not modeled
l2 ❌ FAIL Explicitly unsupported in L2ByteCodeSupportChecker and IRGenerator

Details

l1a Implementation

  • Status: ❌ FAIL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:2960-2962, core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:3886-3892
  • Issues:
    1. Missing operand stack push (line 2960-2962): visit_jsr only emits os.writeCALL(helper.getInstrLabel(address)). Per JVM spec, the address of the next instruction (return address) must be pushed onto the operand stack as a returnAddress type value. The x86 CALL pushes to hardware stack, not JVM operand stack.
    2. No returnAddress type support: The JVM returnAddress type is not represented in JvmType, Item hierarchy, or type system. No ReturnAddressItem class exists.
    3. ret/jsr asymmetry not modeled (line 3886-3892): visit_ret does os.writeJMP(helper.BP, ebpOfs) — jumps to address stored in local variable — but jsr never pushed that address to the operand stack for subsequent astore by the subroutine.
    4. BytecodeParser correct (BytecodeParser.java:890-891): Properly decodes 32-bit signed offset via gets4() and computes absolute target.

l1b Implementation

  • Status: ❌ FAIL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:3687-3692, core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:4830-4839
  • Issues: Identical to l1a — same writeCALL implementation, same missing operand stack push, same missing returnAddress type, same ret/jsr asymmetry.

l2 Implementation

  • Status: ❌ FAIL
  • Files:
    • core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java:163-165
    • core/src/core/org/jnode/vm/compiler/ir/IRGenerator.java:1321-1323
    • core/src/core/org/jnode/vm/compiler/ir/IRBasicBlockFinder.java:216-220
  • Issues:
    1. Explicitly unsupported: Both L2ByteCodeSupportChecker.visit_jsr and IRGenerator.visit_jsr throw UnsupportedOperationException.
    2. Basic block analysis incomplete: IRBasicBlockFinder.visit_jsr doesn't add branch target or fall-through as successors.
    3. No returnAddress type in IR: The IR Operand type system has no RETURN_ADDRESS category.

Key JVM Spec Requirements (from https://docs.oracle.com/javase/specs/jvms/se6/html/Instructions2.doc7.html)

  • Operand Stack: ... → ..., address (pushes returnAddress type)
  • Branch Offset: Signed 32-bit, computed from 4 bytes
  • Target: Must be opcode within same method
  • Asymmetry: jsr_w pushes to operand stack; ret retrieves from local variable

Closes #330

New%20session%20-%202026-06-23T00%3A18%3A59.790Z
opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JVM instruction spec compliance: jsr_w

0 participants