Skip to content

All three compilers (L1A, L1B, L2) PASS for fconst_0#553

Open
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue268-20260621154746
Open

All three compilers (L1A, L1B, L2) PASS for fconst_0#553
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue268-20260621154746

Conversation

@opencode-agent

Copy link
Copy Markdown

Spec compliance report

Compiler Status Issues
l1a ✅ PASS None
l1b ✅ PASS None
l2 ✅ PASS None

Details

l1a Implementation

  • Status: ✅ PASS
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:1792, core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java:74, core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java:88-110
  • Issues: None

Analysis:
The L1A implementation correctly handles fconst_0 (opcode 0xb) by creating a FloatItem with Kind.CONSTANT and the value 0.0f. The FloatItem class stores the float value and when loaded to a register or pushed to the stack, it uses Float.floatToIntBits(value) (line 89, 109 in FloatItem.java) which correctly preserves the IEEE 754 bit pattern including signed zero (+0.0). The virtual stack mechanism delays emission until needed, maintaining the correct category-1 (single-slot) stack effect as required by the spec.

l1b Implementation

  • Status: ✅ PASS
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:2153, core/src/core/org/jnode/vm/x86/compiler/l1b/ItemFactory.java:67, core/src/core/org/jnode/vm/x86/compiler/l1b/FloatItem.java:88-110
  • Issues: None

Analysis:
The L1B implementation is functionally identical to L1A for fconst_0, with the addition of a bytecode counter increment. It creates a FloatItem with Kind.CONSTANT and value 0.0f, using the same Float.floatToIntBits() conversion for register loads and stack pushes. The virtual stack and item management are equivalent to L1A, correctly preserving the float bit pattern and category-1 stack effect.

l2 Implementation

  • Status: ✅ PASS
  • Files: core/src/core/org/jnode/vm/compiler/ir/IRGenerator.java:291, core/src/core/org/jnode/vm/compiler/ir/FloatConstant.java:38, core/src/core/org/jnode/vm/x86/compiler/l2/FPX86CodeGenerator.java:191
  • Issues: None

Analysis:
The L2 compiler's IRGenerator.visit_fconst() creates a FloatConstant IR node with the value 0.0f. The FloatConstant.getIntBits() method uses Float.floatToRawIntBits(value) (line 39) which preserves the exact IEEE 754 bit representation including signed zero. During code generation, FPX86CodeGenerator.loadToFPUStack32() (line 191) handles the CONSTANT addressing mode by pushing the raw int bits to the stack and executing FLD32, correctly loading +0.0 onto the FPU stack. The IR assigns it to a single stack slot (stackOffset += 1), matching the category-1 requirement.


JVM Spec References

All three JNode compiler tiers correctly implement the fconst_0 instruction per the JVM SE 6 specification.

Closes #268

New%20session%20-%202026-06-21T15%3A47%3A46.125Z
opencode session  |  github run

Co-authored-by: LSantha <LSantha@users.noreply.github.com>
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: fconst_0

0 participants