l1a/l1b: 32-bit OK, 64-bit broken. l2: FAIL.#563
Open
opencode-agent[bot] wants to merge 1 commit into
Open
Conversation
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
Details
l1a Implementation
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:3184-3227(visit_ldiv)core/src/core/org/jnode/vm/MathSupport.java:41-94(ldiv implementation for 32-bit)MathSupport.ldiv()viainvokeJavaMethod(context.getLdivMethod()). MathSupport.ldiv() correctly implements JVM spec:core/src/native/x86/ints64.asm) lacksint_divhandler for vector 0 (#DE). The handler exists only inints32.asm:240-244. Without it, division by zero in 64-bit mode will not be converted to ArithmeticException.l1b Implementation
core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:3976-4029(visit_ldiv)core/src/core/org/jnode/vm/MathSupport.java:41-94(shared 32-bit implementation)l2 Implementation
core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java:3630-3637(32-bit stack-based generateBinaryOP)core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java(no override for visit_ldiv)generateBinaryOP(int disp1, int disp2, BinaryOperation operation, int disp3)at line 3631, LDIV falls through tothrow new IllegalArgumentException("Unknown operation: " + operation). Code generation fails at compile time.// if (os.isCode64())comments (lines 4022, 4066, 4113, 4612, 5278, 5453) indicate incomplete 64-bit support.visit_ldiv(), inherits no-op fromBytecodeVisitorSupport:923. This causes L2 to incorrectly believe ldiv is supported, leading to runtime codegen failures.JVM Spec References
JNode File References
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:3188-3196core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:3197-3226core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:3981-3998core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:3999-4028core/src/core/org/jnode/vm/MathSupport.java:41-94core/src/core/org/jnode/vm/x86/compiler/l2/GenericX86CodeGenerator.java:3630-3637core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java(no visit_ldiv override)core/src/native/x86/ints32.asm:240-244core/src/native/x86/ints64.asmCloses #341
opencode session | github run