Skip to content

ParparVM: a for-each over a ?: walked the else branch - #6121

Merged
shai-almog merged 2 commits into
masterfrom
fix-foreach-ternary-receiver
Oct 28, 2026
Merged

shai-almog merged 2 commits into
masterfrom
fix-foreach-ternary-receiver

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Problem

On iOS (and native Linux/Windows), for (String s : (all ? getOwn() : updated)) always iterated the else branch; with updated == null and all == true it threw NullPointerException. JavaSE and Android were correct.

javac compiles it to IFEQ L2; <a>; GOTO L3; L2: ALOAD updated; L3: INVOKE iterator. BytecodeMethod.prevExecutable() skipped the join label L3, so intrinsifyForEach() folded ALOAD updated into the loop setup as the receiver for both paths and removed it from the else branch. The HashMap.keySet()/values() fold used the same helper and had the same bug for (c ? m1 : m2).keySet().

Fix

prevExecutable stops at a jump-target label (as srNextRealNoJoin already does); a joined receiver is read with POP_OBJ() and the loop stays intrinsified. Every caller pairs a consumer with its producer, so all of them were unsafe across a join.

Tests

  • 14 ?: cases in the bulk CollectionSemanticsApp fixture, each isolated, with named expected values in BulkGeneratedCodeChecks. With the fix reverted, 7 fail (for-each and keySet/values); the iterator-call case is behaviour-only, as its comment says.
  • Harness hardening in BulkConformanceIntegrationTest.compare: a check that prints nothing, throws out of its body on HotSpot, or is skipped while ParparVM throws now fails, and the HotSpot run must reach Bulk.end(). BulkCompareTest covers each rule. No existing check trips them.

Locally: full bulk suite 330 checks / 0 failing; BulkCompareTest, NativeTraversalTest, LocalReceiverTypesTest green.

🤖 Generated with Claude Code

javac joins the two branches of `for (x : c ? a : b)` at a label right
before iterator(). prevExecutable skipped that label, so intrinsifyForEach
folded the else branch's load in as the receiver of both paths: the loop
always walked `b`, and threw NullPointerException when `b` was null and `c`
true. The keySet()/values() fold had the same flaw. prevExecutable now stops
at a jump target, and the loop reads a joined receiver off the stack.

The bulk comparison also stops passing checks that prove nothing: a check
that prints nothing, throws out of its body on HotSpot, or is skipped while
ParparVM throws now fails, and the HotSpot run must reach Bulk.end().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ desktop-compat-runtime: 0 findings (no issues)
    • ✅ fxml-compiler: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ javafx-compat: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
    • ✅ swing-compat: 0 findings (no issues)
  • ✅ PMD: 0 findings (no issues) [Report archive]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 227 screenshots: 227 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 206 screenshots: 206 matched.
Native Windows port, REAL shipping pipeline: the hellocodenameone screenshot suite rendered by a binary CROSS-COMPILED on Linux (clang-cl + xwin, WebView2 linked) and RUN on a Windows x64 runner. Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 28ms / native 2ms = 14.0x speedup
SIMD float-mul (64K x300) java 33ms / native 3ms = 11.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 37.000 ms
Base64 CN1 decode 45.000 ms
Base64 SIMD encode 54.000 ms
Base64 encode ratio (SIMD/CN1) 1.459x (45.9% slower)
Base64 SIMD decode 50.000 ms
Base64 decode ratio (SIMD/CN1) 1.111x (11.1% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 5.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.400x (60.0% faster)
Image applyMask (SIMD off) 16.000 ms
Image applyMask (SIMD on) 18.000 ms
Image applyMask ratio (SIMD on/off) 1.125x (12.5% slower)
Image modifyAlpha (SIMD off) 22.000 ms
Image modifyAlpha (SIMD on) 10.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.455x (54.5% faster)
Image modifyAlpha removeColor (SIMD off) 20.000 ms
Image modifyAlpha removeColor (SIMD on) 7.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.350x (65.0% faster)

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 206 screenshots: 206 matched.
Native Linux port (arm64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub arm64 runner. Baseline: scripts/linux/screenshots-arm.

ParparVM vs HotSpot (JDK 25): Linux arm64

Runner CPU: Neoverse-N2 (baseline linux-arm64@neoverse-n2)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.96x (base 1.02x, -5.9%) 0.66x (base 0.93x, -28.9%) ok
translator (self) 4 0.73x (base 0.70x, +5.2%) 0.45x (base 0.43x, +4.9%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.03x (base 0.03x, +4.4%) ok
longArithmetic 4 0.79x (base 0.79x, -0.1%) 0.03x (base 0.03x, +4.9%) ok
mathTranscendental 4 1.10x (base 1.10x, -0.0%) 0.04x (base 0.03x, +9.5%) ok
arraySequential 4 0.34x (base 0.36x, -4.8%) 0.37x (base 0.37x, +0.1%) ok
arrayRandom 4 0.93x (base 0.94x, -0.3%) 0.20x (base 0.20x, +0.5%) ok
objectAllocation 4 1.85x (base 1.77x, +4.8%) 0.37x (base 0.37x, +0.9%) ok
valueEscape 4 0.51x (base 0.51x, -0.1%) 0.03x (base 0.03x, +5.8%) ok
hashMapChurn 4 0.85x (base 0.84x, +1.5%) 0.12x (base 0.12x, +2.3%) ok
stringBuilding 4 1.37x (base 1.57x, -12.3%) 0.26x (base 0.26x, +0.1%) ok
recursion 4 1.41x (base 1.43x, -1.4%) 0.04x (base 0.04x, +6.7%) ok
quicksort 4 1.01x (base 0.99x, +2.1%) 0.09x (base 0.09x, +1.1%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 206 screenshots: 206 matched.
Native Windows port (x64 / Intel-AMD): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, SSE2 SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 47ms / native 4ms = 11.7x speedup
SIMD float-mul (64K x300) java 48ms / native 3ms = 16.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 71.000 ms
Base64 CN1 decode 80.000 ms
Base64 SIMD encode 95.000 ms
Base64 encode ratio (SIMD/CN1) 1.338x (33.8% slower)
Base64 SIMD decode 90.000 ms
Base64 decode ratio (SIMD/CN1) 1.125x (12.5% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 9.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.444x (55.6% faster)
Image applyMask (SIMD off) 35.000 ms
Image applyMask (SIMD on) 29.000 ms
Image applyMask ratio (SIMD on/off) 0.829x (17.1% faster)
Image modifyAlpha (SIMD off) 34.000 ms
Image modifyAlpha (SIMD on) 25.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.735x (26.5% faster)
Image modifyAlpha removeColor (SIMD off) 37.000 ms
Image modifyAlpha removeColor (SIMD on) 19.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.514x (48.6% faster)

ParparVM vs HotSpot (JDK 25): Windows x64

Runner CPU: Intel64 Family 6 Model 207 Stepping 2, GenuineIntel (baseline windows-x64@intel64-family-6-model-207-genuineintel)

2 improvements past the baseline (not a failure; rebaseline to lock them in):

  • hello (WinHelloMain) on all 4 CPUs: RAM 0.55x against a 0.86x baseline (-35.3%, tolerance 35%)
  • recursion on all 4 CPUs: time 0.93x against a 1.20x baseline (-22.3%, tolerance 20%)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.20x (base 1.07x, +12.6%) 0.55x (base 0.86x, -35.3%) improved: rebaseline to lock in (RAM -35.3%)
translator (self) 4 0.77x (base 0.79x, -2.6%) 0.51x (base 0.53x, -3.3%) ok
intArithmetic 4 1.02x (base 1.02x, -0.6%) 0.06x (base 0.06x, +2.0%) ok
longArithmetic 4 0.97x (base 0.97x, -0.3%) 0.06x (base 0.05x, +3.3%) ok
mathTranscendental 4 0.89x (base 0.89x, +0.9%) 0.06x (base 0.06x, +2.6%) ok
arraySequential 4 1.58x (base 1.98x, -20.4%) 0.38x (base 0.38x, +0.3%) ok
arrayRandom 4 1.00x (base 1.01x, -0.5%) 0.23x (base 0.23x, +0.6%) ok
objectAllocation 4 1.21x (base 1.22x, -0.2%) 0.33x (base 0.37x, -11.5%) ok
valueEscape 4 0.13x (base 0.13x, +1.2%) 0.05x (base 0.04x, +3.8%) ok
hashMapChurn 4 1.24x (base 1.14x, +8.9%) 0.10x (base 0.10x, -2.0%) ok
stringBuilding 4 1.52x (base 1.42x, +7.1%) 0.26x (base 0.22x, +17.6%) ok
recursion 4 0.93x (base 1.20x, -22.3%) 0.06x (base 0.06x, +3.0%) improved: rebaseline to lock in (time -22.3%)
quicksort 4 1.03x (base 1.07x, -3.6%) 0.12x (base 0.12x, +1.4%) ok

A change that moves performance ON PURPOSE records the new baseline in vm/selfhost/perf-baseline/pr/6121.json, with the reason, from this job's perf-results.json. The rebaseline is then part of this pull request's diff:

python3 vm/selfhost/calibrate-perf-baseline.py --pr 6121 --reason "<why these benchmarks moved>" perf-results.json

Result: no regression (improved past the baseline: consider rebaselining)

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • ✅ Tests: 889 total, 0 failed, 55 skipped

Benchmark Results

  • Execution Time: 11224 ms

  • Hotspots (Top 20 sampled methods):

    • 11.95% com.codename1.tools.translator.IteratorEscape.mangle (198 samples)
    • 9.29% java.lang.System.identityHashCode (154 samples)
    • 6.16% com.codename1.tools.translator.BytecodeMethod.equals (102 samples)
    • 5.79% java.util.ArrayList.indexOf (96 samples)
    • 4.83% java.lang.Object.hashCode (80 samples)
    • 3.44% java.lang.StringBuilder.append (57 samples)
    • 1.99% com.codename1.tools.translator.JavascriptReachability.enqueueResolved (33 samples)
    • 1.57% java.util.HashMap.hash (26 samples)
    • 1.33% java.io.FileOutputStream.writeBytes (22 samples)
    • 1.27% com.codename1.tools.translator.bytecodes.Invoke.resolveDirectTarget (21 samples)
    • 1.27% java.lang.String.equals (21 samples)
    • 1.27% java.lang.StringCoding.encode (21 samples)
    • 1.21% com.codename1.tools.translator.ByteCodeClass.hasDeclaredMethod (20 samples)
    • 1.15% com.codename1.tools.translator.classfile.analysis.Frame.merge (19 samples)
    • 1.09% java.util.HashMap.putVal (18 samples)
    • 1.09% java.util.AbstractCollection.containsAll (18 samples)
    • 1.03% com.codename1.tools.translator.Parser.cullMethods (17 samples)
    • 1.03% com.codename1.tools.translator.BytecodeMethod.updateInlinableFieldDependencies (17 samples)
    • 1.03% com.codename1.tools.translator.ByteCodeClass.markDependencies (17 samples)
    • 0.97% com.codename1.tools.translator.bytecodes.Invoke.findMethodUp (16 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 206 screenshots: 206 matched.
Native Windows port (arm64 / Apple Silicon - Arm): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, NEON SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 53ms / native 2ms = 26.5x speedup
SIMD float-mul (64K x300) java 54ms / native 3ms = 18.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 60.000 ms
Base64 CN1 decode 73.000 ms
Base64 SIMD encode 77.000 ms
Base64 encode ratio (SIMD/CN1) 1.283x (28.3% slower)
Base64 SIMD decode 73.000 ms
Base64 decode ratio (SIMD/CN1) 1.000x (0.0% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 4.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.500x (50.0% faster)
Image applyMask (SIMD off) 19.000 ms
Image applyMask (SIMD on) 19.000 ms
Image applyMask ratio (SIMD on/off) 1.000x (0.0% slower)
Image modifyAlpha (SIMD off) 17.000 ms
Image modifyAlpha (SIMD on) 14.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.824x (17.6% faster)
Image modifyAlpha removeColor (SIMD off) 24.000 ms
Image modifyAlpha removeColor (SIMD on) 12.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.500x (50.0% faster)

ParparVM vs HotSpot (JDK 25): Windows arm64

Runner CPU: ARMv8 (64-bit) Family 8 Model D49 Revision 0, MICROSOFT CORPORATION (baseline windows-arm64@armv8-64-bit-family-8-model-d49-microsoft-corporation)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.00x (base 1.11x, -9.3%) 0.61x (base 0.75x, -19.1%) ok
translator (self) 4 0.88x (base 0.84x, +5.0%) 0.49x (base 0.51x, -3.3%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.06x (base 0.06x, +3.0%) ok
longArithmetic 4 0.80x (base 0.80x, +0.0%) 0.06x (base 0.06x, +3.4%) ok
mathTranscendental 4 0.72x (base 0.72x, -0.0%) 0.07x (base 0.06x, +1.6%) ok
arraySequential 4 0.40x (base 0.46x, -11.7%) 0.39x (base 0.39x, +0.0%) ok
arrayRandom 4 0.94x (base 0.94x, +0.3%) 0.23x (base 0.23x, +0.2%) ok
objectAllocation 4 1.81x (base 1.82x, -0.5%) 0.41x (base 0.43x, -4.2%) ok
valueEscape 4 0.76x (base 0.76x, +0.1%) 0.05x (base 0.05x, +3.1%) ok
hashMapChurn 4 1.00x (base 0.98x, +1.1%) 0.12x (base 0.12x, -1.8%) ok
stringBuilding 4 1.58x (base 1.43x, +11.1%) 0.27x (base 0.27x, -0.1%) ok
recursion 4 1.55x (base 1.46x, +6.0%) 0.07x (base 0.07x, +1.0%) ok
quicksort 4 1.00x (base 1.00x, +0.3%) 0.12x (base 0.12x, +0.4%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 192 screenshots: 192 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 527 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 56ms / native 3ms = 18.6x speedup
SIMD float-mul (64K x300) java 57ms / native 3ms = 19.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 52.000 ms
Base64 CN1 decode 60.000 ms
Image encode benchmark iterations 100
Image createMask (SIMD off) 7.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.714x (28.6% faster)
Image applyMask (SIMD off) 52.000 ms
Image applyMask (SIMD on) 60.000 ms
Image applyMask ratio (SIMD on/off) 1.154x (15.4% slower)
Image modifyAlpha (SIMD off) 46.000 ms
Image modifyAlpha (SIMD on) 48.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.043x (4.3% slower)
Image modifyAlpha removeColor (SIMD off) 58.000 ms
Image modifyAlpha removeColor (SIMD on) 42.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.724x (27.6% faster)

ParparVM vs HotSpot (JDK 25): macOS arm64

Runner CPU: Apple M1 (Virtual) (baseline macos-arm64)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (HelloCodenameOne) 3 0.78x (base 0.96x, -18.4%) 0.89x (base 0.93x, -3.4%) ok
translator (self) 3 0.62x (base 0.62x, -0.3%) 0.74x (base 0.78x, -5.8%) ok
intArithmetic 3 1.04x (base 1.03x, +1.0%) 0.12x (base 0.12x, +1.8%) ok
longArithmetic 3 1.02x (base 1.03x, -0.4%) 0.11x (base 0.07x, +61.8%) ok
mathTranscendental 3 0.98x (base 1.01x, -2.3%) 0.12x (base 0.12x, +0.5%) ok
arraySequential 3 0.46x (base 0.42x, +10.4%) 0.53x (base 0.53x, +0.2%) ok
arrayRandom 3 0.99x (base 0.99x, -0.3%) 0.33x (base 0.32x, +0.4%) ok
objectAllocation 3 0.99x (base 1.11x, -10.9%) 0.65x (base 0.72x, -10.7%) ok
valueEscape 3 0.51x (base 0.51x, +0.0%) 0.09x (base 0.09x, -3.2%) ok
hashMapChurn 3 1.12x (base 1.18x, -4.4%) 0.07x (base 0.07x, +5.4%) ok
stringBuilding 3 0.89x (base 0.84x, +5.7%) 0.46x (base 0.46x, +0.4%) ok
recursion 3 1.09x (base 1.24x, -12.0%) 0.12x (base 0.12x, +1.0%) ok
quicksort 3 1.04x (base 1.01x, +2.8%) 0.11x (base 0.11x, +1.1%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 189 screenshots: 189 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 2514 seconds

Build and Run Timing

Metric Duration
Simulator Boot 81000 ms
Simulator Boot (Run) 1000 ms
App Install 11000 ms
App Launch 4000 ms
Test Execution 433000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 149ms / native 4ms = 37.2x speedup
SIMD float-mul (64K x300) java 96ms / native 4ms = 24.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 77.000 ms
Base64 CN1 decode 56.000 ms
Base64 native encode 1580.000 ms
Base64 encode ratio (CN1/native) 0.049x (95.1% faster)
Base64 native decode 1208.000 ms
Base64 decode ratio (CN1/native) 0.046x (95.4% faster)
Base64 SIMD encode 55.000 ms
Base64 encode ratio (SIMD/CN1) 0.714x (28.6% faster)
Base64 SIMD decode 52.000 ms
Base64 decode ratio (SIMD/CN1) 0.929x (7.1% faster)
Base64 encode ratio (SIMD/native) 0.035x (96.5% faster)
Base64 decode ratio (SIMD/native) 0.043x (95.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 5.000 ms
Image createMask (SIMD on) 1.000 ms
Image createMask ratio (SIMD on/off) 0.200x (80.0% faster)
Image applyMask (SIMD off) 59.000 ms
Image applyMask (SIMD on) 59.000 ms
Image applyMask ratio (SIMD on/off) 1.000x (0.0% slower)
Image modifyAlpha (SIMD off) 30.000 ms
Image modifyAlpha (SIMD on) 37.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.233x (23.3% slower)
Image modifyAlpha removeColor (SIMD off) 61.000 ms
Image modifyAlpha removeColor (SIMD on) 511.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 8.377x (737.7% slower)

@shai-almog

shai-almog commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 184 screenshots: 184 matched.
✅ Native Apple TV (tvOS, Metal) screenshot tests passed.

The only shipped loops whose translation the fix changes are JpqlQueryImpl's
`for (Expr c : v.resultBranches == null ? v.children : v.resultBranches)`.
An instance field read is not folded into the loop, so that shape was
already right; it is kept as a guard. A static field read is folded, and
the same shape over statics threw NullPointerException before the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog

shai-almog commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 206 screenshots: 206 matched.
Native Linux port (x64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub x64 runner. Baseline: scripts/linux/screenshots.

ParparVM vs HotSpot (JDK 25): Linux x64

Runner CPU: AMD EPYC 7763 64-Core Processor (baseline linux-x64@amd-epyc-7763-64-core-processor)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.85x (base 0.85x, +0.8%) 0.70x (base 0.83x, -16.3%) ok
translator (self) 4 0.54x (base 0.64x, -14.6%) 0.44x (base 0.52x, -15.4%) ok
intArithmetic 4 1.10x (base 1.12x, -1.2%) 0.04x (base 0.06x, -29.9%) ok
longArithmetic 4 1.14x (base 1.08x, +5.1%) 0.04x (base 0.05x, -30.5%) ok
mathTranscendental 4 1.08x (base 1.08x, +0.0%) 0.04x (base 0.07x, -44.9%) ok
arraySequential 4 2.00x (base 2.00x, -0.0%) 0.36x (base 0.36x, +0.4%) ok
arrayRandom 4 0.96x (base 0.91x, +5.3%) 0.20x (base 0.21x, -3.2%) ok
objectAllocation 4 1.53x (base 1.65x, -7.5%) 0.26x (base 0.35x, -25.3%) ok
valueEscape 4 0.10x (base 0.10x, -0.4%) 0.03x (base 0.04x, -28.2%) ok
hashMapChurn 4 1.55x (base 1.48x, +4.3%) 0.10x (base 0.09x, +9.2%) ok
stringBuilding 4 1.31x (base 1.39x, -5.8%) 0.26x (base 0.31x, -17.2%) ok
recursion 4 1.39x (base 1.25x, +10.4%) 0.04x (base 0.08x, -47.7%) ok
quicksort 4 1.09x (base 1.07x, +1.8%) 0.10x (base 0.11x, -12.7%) ok

Result: no regression

@shai-almog
shai-almog merged commit c29a745 into master Oct 28, 2026
63 of 73 checks passed
@shai-almog
shai-almog deleted the fix-foreach-ternary-receiver branch October 28, 2026 05:47
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.

1 participant