Repository navigation
Fix class initialization and bytecode edge cases - #22
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 43 minutes. View limit details
|
| Layer / File(s) | Summary |
|---|---|
Conversion helper and execution paths src/runtime.ts, src/interp.ts, src/jit.ts, test/java/LongToFloat.java |
The runtime adds longToFloat, which handles large magnitudes using a sticky bit for discarded bits. The interpreter and JIT use the helper for l2f. The Java test checks selected values, including values near a midpoint and the long limits. |
Boolean array stores
| Layer / File(s) | Summary |
|---|---|
Boolean store paths and test src/interp.ts, src/jit.ts, test/java/BooleanStore.java |
The interpreter and JIT store only the low bit for boolean arrays and retain direct stores for byte arrays. The Java test changes a bytecode constant and invokes the modified method repeatedly. |
Interface initialization
| Layer / File(s) | Summary |
|---|---|
Interface traversal and test src/jvm.ts, test/java/InterfaceInitialization.java |
initGen traverses direct interfaces and their parent interfaces, visits each once, and initializes eligible interfaces in traversal order. The Java test defines interfaces and implementing classes with marked static fields. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Merge Risk: 
Minimal · previous review af63d
-
No merge-blocking runtime defect was identified. Run the broader checks before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 7 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Simplify code
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
I’m a rabbit with a careful little hop,
I test each long before I stop.
One-bit stores now land just right,
Inherited interfaces join the light.
My carrot rests; the checks are done.
I bound away beneath the sun.
CodeRabbit Verify
- Run CodeRabbit Verify to test the changes in this pull request.
There was a problem hiding this comment.
The PR fixes three JVM compliance issues: (1) interface initialization now walks the full superinterface hierarchy depth-first and initializes only those with default methods, (2) long-to-float conversion uses a custom sticky-bit rounding algorithm instead of going through double, and (3) bastore (0x54) masks values with &1 when storing into boolean arrays. A test for each behavior is added. The interpreter's boolean-array store path accesses o.cls.name before null-checking, which would throw a JS TypeError instead of a Java NPE.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict request_changes
There was a problem hiding this comment.
The PR fixes three JVM compliance issues: interface initialization order now follows JVM spec (parent interfaces before children, only those with default methods), long-to-float conversion uses correct round-to-nearest-even with sticky bit, and boolean array stores mask values to 0/1. Two defects from earlier reviews remain: the interpreter's bastore (0x54) reads o.cls.name before null check, and interface initialization still treats private methods as default methods.
Not approved: 2 earlier points are still open in the threads.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict comment
There was a problem hiding this comment.
The PR fixes three JVM compliance issues: (1) class initialization now traverses the full superinterface hierarchy in JVM order to initialize indirect superinterfaces with default methods, (2) long-to-float conversion (l2f) uses a sticky-bit rounding algorithm matching HotSpot semantics for values above 2^53, and (3) boolean array stores (bastore) mask the stored value to its low bit. Corresponding interpreter, JIT, and runtime changes are included with regression tests. No new issues found in the diff beyond points already settled with the author.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve
Classes can skip initialization of indirect superinterfaces with default methods, and two bytecode operations differ from HotSpot on edge cases. Initialize superinterfaces in JVM order, round long-to-float conversions directly, and mask values stored in boolean arrays.
The regression programs compare initialization order, float bit patterns, and generated boolean-store bytecode with HotSpot, including hot methods.
Tests: the three new programs and TypeScript typecheck passed. The full local suite was interrupted; CI runs the broader checks.