Skip to content

Reject synchronization on primitive wrappers#5338

Merged
liannacasper merged 1 commit into
masterfrom
verify-wrapper-monitor-locks
Jul 5, 2026
Merged

Reject synchronization on primitive wrappers#5338
liannacasper merged 1 commit into
masterfrom
verify-wrapper-monitor-locks

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Summary

  • Add a bytecode compliance check that rejects MONITORENTER on primitive wrapper values.
  • Preserve exact reference types during the verifier's ASM stack analysis so wrapper locks can be detected while normal object locks remain valid.
  • Add focused tests for rejecting Integer.valueOf(...) synchronization and allowing dedicated Object locks.

Rationale

Primitive wrappers are being treated as identity-free values for upcoming Valhalla-aligned semantics. Instead of preserving runtime monitor behavior for wrapper values, the Maven compliance verifier now flags unsupported synchronization at build time and points users toward a dedicated lock object.

Validation

  • mvn -pl codenameone-maven-plugin -Dtest=BytecodeComplianceMojoTest test
  • git diff --check

@github-actions

github-actions Bot commented Jul 5, 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)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 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 Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 142 screenshots: 142 matched.

Native Android coverage

  • 📊 Line coverage: 9.92% (10004/100816 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.77% (49256/561337), branch 4.31% (2205/51102), complexity 4.35% (2356/54161), method 6.61% (1862/28149), class 10.60% (424/3999)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 9.92% (10004/100816 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.77% (49256/561337), branch 4.31% (2205/51102), complexity 4.35% (2356/54161), method 6.61% (1862/28149), class 10.60% (424/3999)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 237ms / native 119ms = 1.9x speedup
SIMD float-mul (64K x300) java 131ms / native 117ms = 1.1x speedup
SIMD kernel correctness PASS (native result == scalar reference)
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 231.000 ms
Base64 CN1 decode 273.000 ms
Base64 native encode 903.000 ms
Base64 encode ratio (CN1/native) 0.256x (74.4% faster)
Base64 native decode 1045.000 ms
Base64 decode ratio (CN1/native) 0.261x (73.9% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 53ms / native 3ms = 17.6x speedup
SIMD float-mul (64K x300) java 53ms / native 2ms = 26.5x 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 281.000 ms
Base64 CN1 decode 207.000 ms
Base64 native encode 886.000 ms
Base64 encode ratio (CN1/native) 0.317x (68.3% faster)
Base64 native decode 700.000 ms
Base64 decode ratio (CN1/native) 0.296x (70.4% faster)
Base64 SIMD encode 57.000 ms
Base64 encode ratio (SIMD/CN1) 0.203x (79.7% faster)
Base64 SIMD decode 53.000 ms
Base64 decode ratio (SIMD/CN1) 0.256x (74.4% faster)
Base64 encode ratio (SIMD/native) 0.064x (93.6% faster)
Base64 decode ratio (SIMD/native) 0.076x (92.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 34.000 ms
Image createMask (SIMD on) 24.000 ms
Image createMask ratio (SIMD on/off) 0.706x (29.4% faster)
Image applyMask (SIMD off) 187.000 ms
Image applyMask (SIMD on) 208.000 ms
Image applyMask ratio (SIMD on/off) 1.112x (11.2% slower)
Image modifyAlpha (SIMD off) 209.000 ms
Image modifyAlpha (SIMD on) 110.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.526x (47.4% faster)
Image modifyAlpha removeColor (SIMD off) 195.000 ms
Image modifyAlpha removeColor (SIMD on) 203.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.041x (4.1% slower)

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 216 screenshots: 216 matched.
✅ Native Apple Watch (watchOS, Core Graphics) screenshot tests passed.

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 115000 ms
Simulator Boot (Run) 1000 ms
App Install 21000 ms
App Launch 65000 ms
Test Execution 537000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 121ms / native 6ms = 20.1x speedup
SIMD float-mul (64K x300) java 94ms / native 6ms = 15.6x 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 2011.000 ms
Base64 CN1 decode 478.000 ms
Base64 native encode 1825.000 ms
Base64 encode ratio (CN1/native) 1.102x (10.2% slower)
Base64 native decode 1719.000 ms
Base64 decode ratio (CN1/native) 0.278x (72.2% faster)
Base64 SIMD encode 97.000 ms
Base64 encode ratio (SIMD/CN1) 0.048x (95.2% faster)
Base64 SIMD decode 65.000 ms
Base64 decode ratio (SIMD/CN1) 0.136x (86.4% faster)
Base64 encode ratio (SIMD/native) 0.053x (94.7% faster)
Base64 decode ratio (SIMD/native) 0.038x (96.2% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 29.000 ms
Image createMask (SIMD on) 10.000 ms
Image createMask ratio (SIMD on/off) 0.345x (65.5% faster)
Image applyMask (SIMD off) 229.000 ms
Image applyMask (SIMD on) 406.000 ms
Image applyMask ratio (SIMD on/off) 1.773x (77.3% slower)
Image modifyAlpha (SIMD off) 460.000 ms
Image modifyAlpha (SIMD on) 572.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.243x (24.3% slower)
Image modifyAlpha removeColor (SIMD off) 289.000 ms
Image modifyAlpha removeColor (SIMD on) 454.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.571x (57.1% slower)

@shai-almog

shai-almog commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 137 screenshots: 137 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 131000 ms
Simulator Boot (Run) 2000 ms
App Install 27000 ms
App Launch 3000 ms
Test Execution 507000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 80ms / native 5ms = 16.0x speedup
SIMD float-mul (64K x300) java 90ms / native 4ms = 22.5x 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 380.000 ms
Base64 CN1 decode 381.000 ms
Base64 native encode 823.000 ms
Base64 encode ratio (CN1/native) 0.462x (53.8% faster)
Base64 native decode 570.000 ms
Base64 decode ratio (CN1/native) 0.668x (33.2% faster)
Base64 SIMD encode 64.000 ms
Base64 encode ratio (SIMD/CN1) 0.168x (83.2% faster)
Base64 SIMD decode 55.000 ms
Base64 decode ratio (SIMD/CN1) 0.144x (85.6% faster)
Base64 encode ratio (SIMD/native) 0.078x (92.2% faster)
Base64 decode ratio (SIMD/native) 0.096x (90.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 49.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.102x (89.8% faster)
Image applyMask (SIMD off) 137.000 ms
Image applyMask (SIMD on) 37.000 ms
Image applyMask ratio (SIMD on/off) 0.270x (73.0% faster)
Image modifyAlpha (SIMD off) 82.000 ms
Image modifyAlpha (SIMD on) 45.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.549x (45.1% faster)
Image modifyAlpha removeColor (SIMD off) 73.000 ms
Image modifyAlpha removeColor (SIMD on) 50.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.685x (31.5% faster)

@liannacasper liannacasper merged commit b00f504 into master Jul 5, 2026
34 of 35 checks passed
@liannacasper liannacasper deleted the verify-wrapper-monitor-locks branch July 5, 2026 12:15
shai-almog added a commit that referenced this pull request Jul 10, 2026
…posts (#5357)

* Release week 2026-07-10 blog series: ParparVM vs HotSpot + 3 feature posts

Parent post (Fri): "How We Beat HotSpot Performance (By Cheating, But Not
Like That)" -- the PR #5327 performance story from 4.21x slower than warmed
Java 25 to geomean 1.00x parity, with the GC/tagged-Integer deep dives and
the PR #5338 synchronized-on-wrapper build check.

Daily posts: standalone certificate wizard (PR #5339, Sat), AR/VR support
and simulation (PR #5335, Sun), automated store submissions as code incl.
Huawei AppGallery plus organization accounts and self-service account
deletion (PR #5353, Mon).

Includes 1024x512 hero images, post screenshots, and VM/performance
vocabulary for the LanguageTool blog accept-list. Prose gate passes; all
mermaid diagrams verified against the site's mermaid@10 loader.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Blog series: Oxford commas + numeral percentage for the Vale gate

CI runs Vale's Microsoft.OxfordComma and Microsoft.Percentages rules that
the local styles cache was missing. Sweep every serial list in the four
posts and switch "Ninety percent" to "90%".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Restructure the HotSpot post around architecture

Founder feedback pass: add the memory story (table + chart, standalone
ParparVM benchmark note, Java 25 AOT fairness note), explain the HotSpot
big-block heap vs our malloc/free philosophy and the BiBOP page heap,
tease the twists up top, drop the bug-anecdote sections and the warmup/
GraalVM/what-I-got-wrong filler, rework "Going Deeper" around the
readable one-file-per-class tradeoff, add a TL;DR, and close on the
two-big-PRs slow-week note. Charts split into two clean single-series
xycharts (render-verified on mermaid@10 and mermaid.ink for syndication).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants