Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
See JDK-8042997 Consider the following code: static void setVolatile(ArrayRefHandle handle, Object[] array, int index, Object value) { if (index < 0 || index >= array.length) // bounds and null check throw new ArrayIndexOutOfBoundsException(); UNSAFE.putObjectVolatile(array, (((long) index) << handle.ashift) + handle.abase, castReference(handle.componentType, value)); } For such a user written range test the compiler does fully recognize an array access is going on and so certain optimizations tend not to kick in, such as removing or strength reducing range checks, treating "index" as an unsigned value as opposed to a signed value, or coalescing write barriers when loop unrolling.
|