Skip to content

JVM instruction spec compliance: astore_2 #218

@LSantha

Description

@LSantha

Instruction: astore_2

Wiki References

Note: Before reading wiki pages, clone the wiki repository if .wiki/ directory does not exist:
git clone git@github.com:LSantha/jnode_ai.wiki.git .wiki

Agent Instructions

  1. Read Spec Pages:

  2. Read Wiki Pages:

    • First, check if .wiki/ directory exists. If not, clone it:
      git clone git@github.com:LSantha/jnode_ai.wiki.git .wiki
    • Review JIT-Compilers.md to understand the 3-tier compilation model.
    • Review L1-Compiler.md for L1A/L1B implementation details.
    • Review L2-Compiler-Deep-Dive.md for L2 specifics.
    • Review Type-System-Internals.md for type/category rules that affect stack and local-variable handling.
  3. Analyze Implementations:
    Focus on the JNode bytecode parser, visitor contract, and all compiler implementations that can execute or lower this instruction:

    • Parser / opcode dispatch: core/src/core/org/jnode/vm/bytecode/BytecodeParser.java
    • Visitor contract: core/src/core/org/jnode/vm/bytecode/BytecodeVisitor.java
    • l1a: core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java
    • l1b: core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java
    • l2 support: core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java
    • l2 code generation: core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java
    • Operand stack behavior: core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java, core/src/core/org/jnode/vm/x86/compiler/l1b/ItemStack.java, core/src/core/org/jnode/vm/x86/compiler/l1a/VirtualStack.java, core/src/core/org/jnode/vm/x86/compiler/l1b/VirtualStack.java
    • Local variable / frame behavior: core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java, core/src/core/org/jnode/vm/x86/compiler/l1b/X86StackFrame.java, core/src/core/org/jnode/vm/x86/compiler/l2/X86StackFrame.java

    For astore_2, also focus on this instruction family context: local variable load/store.

    • core/src/core/org/jnode/vm/bytecode/BytecodeParser.java — local index operand decoding and wide index decoding.
    • core/src/core/org/jnode/vm/bytecode/BytecodeVisitor.java — visitor method signature for local loads/stores.
    • core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java and core/src/core/org/jnode/vm/x86/compiler/l1b/X86StackFrame.java — local slot layout, category-2 locals, and frame offsets.
    • core/src/core/org/jnode/vm/x86/compiler/l1a/Item.java, core/src/core/org/jnode/vm/x86/compiler/l1b/Item.java, core/src/core/org/jnode/vm/x86/compiler/l1a/ItemStack.java, and core/src/core/org/jnode/vm/x86/compiler/l1b/ItemStack.java — type/category propagation.
    • core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java and core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java — instruction lowering.
    • core/src/core/org/jnode/vm/x86/compiler/l2/X86StackFrame.java, core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java, and core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java — L2 local handling, support, and code generation.
  4. Verify Spec Compliance:
    Check the implementation against the astore_2 spec page and the JNode code focus above. In particular, verify:

    • Verify the local index is decoded with the correct width: 8-bit for normal loads/stores, 16-bit after wide.
    • Check category-2 local slot behavior for long/double values.
    • Check that the pushed or popped stack item has the correct JVM type and category.
    • For L2, verify the local slot offset calculation and code generation match the verifier frame model.
  5. Document Results:
    Add a comment to this issue with the following format. Do not open a PR and do not change source code or wiki pages for this ticket.

Spec compliance report

Compiler Status Issues
l1a ✅ PASS / ❌ FAIL / ⚠️ PARTIAL
l1b ✅ PASS / ❌ FAIL / ⚠️ PARTIAL
l2 ✅ PASS / ❌ FAIL / ⚠️ PARTIAL

Details

l1a Implementation

  • Status: ✅ PASS / ❌ FAIL / ⚠️ PARTIAL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:<line>, plus any stack/local helper files that affect astore_2
  • Issues: <specific issues with line numbers or "None">

l1b Implementation

  • Status: ✅ PASS / ❌ FAIL / ⚠️ PARTIAL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:<line>, plus any stack/local helper files that affect astore_2
  • Issues: <specific issues with line numbers or "None">

l2 Implementation

  • Status: ✅ PASS / ❌ FAIL / ⚠️ PARTIAL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java:<line>, core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java:<line>
  • Issues: <specific issues with line numbers or "None">

IMPORTANT: No changes to source code or wiki are permitted. This is a read-only analysis task. The expected outcome is a single issue comment containing the spec compliance report above, with JVM spec references and JNode file references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/investigatedThe agent posted an investigation report on this issue.area/vmJVM internals: JIT compilers, GC, VM magic, type system.jvm-bytecodeJVM bytecode instruction compliancekind/investigateAsks the agent to investigate and report back, not to fix.spec-complianceJVM specification compliance checks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions