Safety first
summary
Details a concrete strategy to replace Unsafe for atomic and memory-layout use cases by introducing variable handles, an array mismatch intrinsic and leveraging get and put unaligned methods. Shows a vectorized mismatch implementation, applies it to ForkJoinPool hot paths, and reports performance on par with Unsafe under C1/C2 while noting increased startup/early-GC costs from added static initialization. Demonstrates which bounds-check intrinsics and index-shifting transforms HotSpot needs to produce nearly identical machine code to hand-written Unsafe.
AI-written summary · about
chapters (27)
- 0:00Intro
- 0:59An "internal detail"
- 2:37Use cases to features
- 3:09Near term focus
- 3:29Replacement strategy
- 4:29Array bounds checks
- 6:16Array Mismatch
- 10:17Equals with long[]
- 10:54Performance results
- 11:53Vectorization future?
- 12:35Current situation
- 13:15Variable handles goals
- 14:09Variable kinds
- 14:30Variable types
- 14:47Access modes
- 17:29Unsafe ++
- 18:18Signature polymorphic methods
- 21:21Lookup
- 21:57Invocation
- 24:04invokeExact
- 25:14With target typing?
- 25:35Performance: macro
- 27:30Under the hood
- 28:09Unsafe with
- 30:52VarHandle with bounds checks
- 35:38Exotic VarHandles
- 37:47VarHandle with FJP.Work Queue
related talks
46mUnsafe (and Java 9/10) (RU)
50mSafely Shoot Yourself in the Foot with Java 9
48mSafely Shoot Yourself in the Foot with Java 9
41mJava 9 VarHandles Best practices, and why?
34mMaking C Less Dangerous
56mHotSpot Internals: Safepoints, NullPointers and StackOverflows
49mA Post Apocalyptic sun misc Unsafe World
43mAuto-Vectorization in HotSpot
