Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Prevent an assertion crash when the VM call stack is exhausted by throwing a proper StackOverflowError so Java code can catch and recover.
  • Provide the missing java.lang.StackOverflowError class so the VM can instantiate and throw the error.
  • Add an integration test to validate that a stack overflow is thrown and that the VM can continue execution after it is caught.

Description

  • Added vm/JavaAPI/src/java/lang/StackOverflowError.java implementing java.lang.VirtualMachineError.
  • Updated vm/ByteCodeTranslator/src/nativeMethods.m to include the StackOverflowError header and change initMethodStack to check callStackOffset and call throwException(threadStateData, __NEW_INSTANCE_java_lang_StackOverflowError(threadStateData)) and return instead of asserting.
  • Added vm/tests/src/test/java/com/codename1/tools/translator/StackOverflowIntegrationTest.java, a native integration test that compiles a small app which triggers a stack overflow, verifies the StackOverflowError was thrown/caught (STACK_OVERFLOW_OK) and that normal execution (a recursive sum) still works after recovery (RECOVERY_OK:7).

Testing

  • No automated tests were executed as part of this change.
  • A new automated integration test StackOverflowIntegrationTest was added under vm/tests and will run as part of the VM test suite when the test goals are invoked.
  • The change is limited to VM native code, the JavaAPI, and an integration test; CI or a local Maven test run should be used to validate the new test in the full environment.

Codex Task

@github-actions
Copy link

github-actions bot commented Jan 25, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Jan 25, 2026

iOS screenshot updates

Compared 29 screenshots: 22 matched, 2 updated, 1 missing reference, 4 errors.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-arc — comparison error. Comparison error: PNG chunk truncated before CRC while processing: /Users/runner/work/_temp/cn1-ios-tests-Q9QcFU/graphics-draw-arc.png

    No preview available for this screenshot.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — comparison error. Comparison error: PNG chunk truncated before CRC while processing: /Users/runner/work/_temp/cn1-ios-tests-Q9QcFU/graphics-draw-gradient.png

    No preview available for this screenshot.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — comparison error. Comparison error: PNG chunk truncated before CRC while processing: /Users/runner/work/_temp/cn1-ios-tests-Q9QcFU/graphics-draw-string.png

    No preview available for this screenshot.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — comparison error. Comparison error: PNG chunk truncated before CRC while processing: /Users/runner/work/_temp/cn1-ios-tests-Q9QcFU/graphics-draw-string-decorated.png

    No preview available for this screenshot.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 420 seconds
  • Compilation Time: 232 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 39348 ms
Extract Extensions 29 ms
Google Services Setup 2 ms
Scan Classes 1068 ms
Extract Libs 2054 ms
Inject Build Hints 69 ms
Generate Unit Tests 15 ms
Generate Stubs 1603 ms
Compile Stubs 2953 ms
Generate Icons 1495 ms
Prepare ParparVM 258 ms
ParparVM Execution 241096 ms
Post-VM Setup 192 ms
CocoaPods 8186 ms
Finalize 53 ms
Total Time 298423 msMaven Overhead : 122000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot 394000 ms
Simulator Boot (Run) 5000 ms
App Install 21000 ms
App Launch 11000 ms
Test Execution 253000 ms

@shai-almog shai-almog force-pushed the codex/add-stackoverflowerror-and-virtualmachineerror branch from 405a78a to 5fc47c2 Compare February 2, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants