Tom Rodriguez wrote in a comment on JDK-8181822:
Why is the version of this fix for 8 different than what's in 9 and later?
// Can base be NULL? Otherwise, always on-heap access.
bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop));
+ if (can_access_non_heap && type == T_OBJECT) {
+ return false; // off-heap oop accesses are not supported
+ }
means that if the base pointer hasn't been null checked before the Unsafe.getObject then it won't be intrinsified at all. 9 and later don't have this check. http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/b756e7a2ec33/src/share/vm/opto/library_call.cpp#l2324 We see a huge slowdown in some code using Unsafe for reflection as a result of this change.
I attached a microbenchmark showing the difference. On 8u192, 9 and 11 the loop runs in about 40ms but with 8u202 it takes about 3000ms.