Skip to content

l1a/l1b: PASS; L2: FAIL (LREM unimplemented)#566

Open
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue350-20260623054612
Open

l1a/l1b: PASS; L2: FAIL (LREM unimplemented)#566
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue350-20260623054612

Conversation

@opencode-agent

Copy link
Copy Markdown

Spec Compliance Report for lrem

Compiler Status Issues
l1a ✅ PASS None
l1b ✅ PASS None
l2 ❌ FAIL LREM (and all long arithmetic ops) not implemented

l1a (X86BytecodeVisitor.java:3371)

32-bit mode: Delegates to MathSupport.lrem() which explicitly checks den == 0 and throws ArithmeticException. Handles Long.MIN_VALUE % -1 edge case correctly per spec identity (a/b)*b + (a%b) == a.

64-bit mode: Uses x86 IDIV directly. Hardware raises #DE on divide-by-zero; VM catches EX_DIV0 and throws ArithmeticException (VmThread.java:1391-1393). Operand stack effect correct (pops 2 category-2, pushes 1 category-2).


l1b (X86BytecodeVisitor.java:4212)

Identical implementation to l1a with same correctness. Only difference is counter instrumentation.


L2 (GenericX86CodeGenerator.java, L2ByteCodeSupportChecker.java)

Complete failure: All 16 LREM case labels (and all other long arithmetic ops: LDIV, LMUL, LADD, LSUB, LAND, LOR, LXOR, LSHL, LSHR, LUSHR, LNEG, LCMP) throw IllegalArgumentException("Unknown operation"). L2ByteCodeSupportChecker doesn't reject lrem, so methods containing it pass canCompile() but fail at code generation.

Systemic gap: The entire long/double arithmetic category is unimplemented in L2.

Closes #350

New%20session%20-%202026-06-23T05%3A46%3A11.946Z
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: lrem

0 participants