Files
amethyst/quartz
Claude 7f8dba4af8 perf: add API-tiered field multiply dispatch for Android
Add 3-file dispatch structure for fieldMulReduce on Android:
- FieldMulApi35: placeholder for Math.unsignedMultiplyHigh (API 35+)
- FieldMulApi31: placeholder for Math.multiplyHigh (API 31-34)
- Fallback: pure-Kotlin 4-imul (API <31, unchanged)

All three currently use the pure-Kotlin fallback because both paths
to the hardware UMULH intrinsic are blocked:

1. Direct Math.unsignedMultiplyHigh call: D8 replaces with synthetic
   backport (ExternalSyntheticBackport0.m) when minSdk=26 < 35.
   Verified via dexdump: backport is pure-Java 4-imul, never reaches
   hardware UMULH even on API 36 devices.

2. MethodHandle.invokeExact: Kotlin compiles as regular invokevirtual
   with Object[] boxing (3 allocs per call), not type-exact
   invoke-polymorphic (JJ)J. Only Java's javac has @PolymorphicSignature
   support. KMP androidMain doesn't support Java sources.

TO UNLOCK: Add a Java helper class (MulHighInvoker.java) in a separate
Android library module that calls MethodHandle.invokeExact(long, long)
with zero boxing. This produces invoke-polymorphic that D8 cannot
desugar and ART intrinsifies to UMULH on ARM64.

https://claude.ai/code/session_015CtM5k88rF7WFgX8o2AGNR
2026-04-09 19:10:37 +00:00
..