Description
Two fields in Heap Buffers are unconditionally declared. But they are unused in read-only buffer classes.
// Cached array base offset
private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
// Cached array index scale
private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
Affected classes: HeapByteBufferR, HeapCharBufferR, HeapDoubleBufferR, HeapFloatBufferR, HeapIntBufferR, HeapLongBufferR, HeapShortBufferR.
By widening '#if[rw]' we can remove redundant fields.
// Cached array base offset
private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
// Cached array index scale
private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
Affected classes: HeapByteBufferR, HeapCharBufferR, HeapDoubleBufferR, HeapFloatBufferR, HeapIntBufferR, HeapLongBufferR, HeapShortBufferR.
By widening '#if[rw]' we can remove redundant fields.