43 lines
2.6 KiB
Plaintext
43 lines
2.6 KiB
Plaintext
$ java --sun-misc-unsafe-memory-access=allow -cp build Equivalence (Unsafe, VarHandle and FFM side by side)
|
|
field CAS: Unsafe and the replacement gave the same 2000-step trace
|
|
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
|
off-heap array: Unsafe and the replacement gave the same 2000-step trace
|
|
off-heap getAndAdd: 4 threads x 100000 -> sum 400000 on every implementation
|
|
copyFrom / clear: identical on every implementation
|
|
byte[] long access at offsets 0..32: Unsafe and VarHandle view agree
|
|
VarHandle view at offset 36 of a 40-byte array: ArrayIndexOutOfBoundsException
|
|
FFM read of element 4 in a 4-element segment: IndexOutOfBoundsException
|
|
FFM read after close: IllegalStateException: Already closed
|
|
ALL 170 CHECKS PASSED
|
|
exit=0
|
|
|
|
$ java --sun-misc-unsafe-memory-access=deny -cp build Equivalence --new-only (replacements only)
|
|
field CAS: the replacement alone gave the same 2000-step trace
|
|
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
|
off-heap array: the replacement alone gave the same 2000-step trace
|
|
off-heap getAndAdd: 4 threads x 100000 -> sum 400000 on every implementation
|
|
copyFrom / clear: identical on every implementation
|
|
byte[] long access at offsets 0..32: VarHandle view only
|
|
VarHandle view at offset 36 of a 40-byte array: ArrayIndexOutOfBoundsException
|
|
FFM read of element 4 in a 4-element segment: IndexOutOfBoundsException
|
|
FFM read after close: IllegalStateException: Already closed
|
|
ALL 67 CHECKS PASSED (new APIs only)
|
|
exit=0
|
|
|
|
$ java --sun-misc-unsafe-memory-access=deny -cp build Equivalence (the Unsafe version under deny)
|
|
Exception in thread "main" java.lang.ExceptionInInitializerError
|
|
at Equivalence.main(Equivalence.java:25)
|
|
Caused by: java.lang.UnsupportedOperationException: objectFieldOffset
|
|
at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccessSlow(Unsafe.java:1822)
|
|
at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccess(Unsafe.java:1787)
|
|
at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:905)
|
|
|
|
$ java -cp build Equivalence (JDK 25 default: one warning, then the same results)
|
|
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
|
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by UnsafeFieldCounter (file:<build>/m/)
|
|
WARNING: Please consider reporting this to the maintainers of class UnsafeFieldCounter
|
|
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
|
field CAS: Unsafe and the replacement gave the same 2000-step trace
|
|
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
|
off-heap array: Unsafe and the replacement gave the same 2000-step trace
|