Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Prevent hard VM assertions on call-stack overflow and allow translated apps to catch and recover by throwing a StackOverflowError instead of asserting.
  • Add the StackOverflowError JavaAPI type so the VM can instantiate and throw a standard Java error.
  • Ensure VM-side behavior is validated by compiling and running a translated app in VM tests instead of only inspecting source text.

Description

  • Updated initMethodStack in vm/ByteCodeTranslator/src/nativeMethods.m to detect call-stack overflow and call throwException(threadStateData, __NEW_INSTANCE_java_lang_StackOverflowError(threadStateData)) and return instead of asserting.
  • Added vm/JavaAPI/src/java/lang/StackOverflowError.java implementing java.lang.StackOverflowError as a subclass of java.lang.VirtualMachineError with standard constructors.
  • Enhanced test runtime stubs in vm/tests/src/test/java/com/codename1/tools/translator/CompilerHelper.java to implement the real exception dispatch flow (fill-in-stack, set threadStateData->exception, unwind try-blocks, longjmp to handlers, and fallback exit(1)) and to provide a compatible instanceofFunction stub to enable exception matching.
  • Added a VM-focused test vm/tests/src/test/java/com/codename1/tools/translator/StackOverflowHandlingTest.java that (1) compiles and runs a translated app which triggers a stack overflow and asserts the app can catch StackOverflowError and continue, and (2) verifies nativeMethods.m references and throws StackOverflowError and that VirtualMachineError.java exists in the JavaAPI.

Testing

  • No automated test runs were executed as part of this change; the new VM unit test StackOverflowHandlingTest and modified stubs were added but not run in CI or locally.
  • The change set was inspected to confirm initMethodStack throws StackOverflowError, that StackOverflowError.java was added to the JavaAPI, and that runtime stubs were updated to support exception dispatch in compiled tests.

Codex Task

@github-actions
Copy link

github-actions bot commented Jan 19, 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 19, 2026

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 updated, 1 missing reference.

  • 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 — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    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 — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    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: 388 seconds
  • Compilation Time: 134 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 32349 ms
Extract Extensions 21 ms
Google Services Setup 2 ms
Scan Classes 581 ms
Extract Libs 1087 ms
Inject Build Hints 27 ms
Generate Unit Tests 2 ms
Generate Stubs 1429 ms
Compile Stubs 2586 ms
Generate Icons 1169 ms
Prepare ParparVM 240 ms
ParparVM Execution 228665 ms
Post-VM Setup 116 ms
CocoaPods 5552 ms
Finalize 45 ms
Total Time 273873 msMaven Overhead : 115000 ms
CocoaPods Install (Script) 2000 ms
Simulator Boot (Run) 86000 ms
App Install 21000 ms
App Launch 12000 ms
Test Execution 176000 ms

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