mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8318966: Some methods make promises about Java array element alignment that are too strong
Reviewed-by: psandoz, mcimadamore
This commit is contained in:
parent
737b4c515e
commit
9c852df6aa
19 changed files with 1850 additions and 4678 deletions
|
@ -1557,7 +1557,7 @@ public abstract sealed class $Type$Buffer
|
|||
super.position(newPosition);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @since 9
|
||||
|
@ -1571,13 +1571,13 @@ public abstract sealed class $Type$Buffer
|
|||
super.limit(newLimit);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @since 9
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
public
|
||||
#if[!byte]
|
||||
final
|
||||
#end[!byte]
|
||||
|
@ -1591,7 +1591,7 @@ public abstract sealed class $Type$Buffer
|
|||
* @since 9
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
public
|
||||
#if[!byte]
|
||||
final
|
||||
#end[!byte]
|
||||
|
@ -1605,7 +1605,7 @@ public abstract sealed class $Type$Buffer
|
|||
* @since 9
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
public
|
||||
#if[!byte]
|
||||
final
|
||||
#end[!byte]
|
||||
|
@ -1619,7 +1619,7 @@ public abstract sealed class $Type$Buffer
|
|||
* @since 9
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
public
|
||||
#if[!byte]
|
||||
final
|
||||
#end[!byte]
|
||||
|
@ -1633,7 +1633,7 @@ public abstract sealed class $Type$Buffer
|
|||
* @since 9
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
public
|
||||
#if[!byte]
|
||||
final
|
||||
#end[!byte]
|
||||
|
@ -2208,15 +2208,11 @@ public abstract sealed class $Type$Buffer
|
|||
* alignmentOffset(index + (unitSize - value), unitSize) == 0
|
||||
* }
|
||||
* must hold.
|
||||
*
|
||||
*
|
||||
* @apiNote
|
||||
* This method may be utilized to determine if unit size bytes from an
|
||||
* index can be accessed atomically, if supported by the native platform.
|
||||
*
|
||||
* @implNote
|
||||
* This implementation throws {@code UnsupportedOperationException} for
|
||||
* non-direct buffers when the given unit size is greater then {@code 8}.
|
||||
*
|
||||
* @param index
|
||||
* The index to query for alignment offset, must be non-negative, no
|
||||
* upper bounds check is performed
|
||||
|
@ -2231,13 +2227,7 @@ public abstract sealed class $Type$Buffer
|
|||
* {@code 2}
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* If the native platform does not guarantee stable alignment offset
|
||||
* values for the given unit size when managing the memory regions
|
||||
* of buffers of the same kind as this buffer (direct or
|
||||
* non-direct). For example, if garbage collection would result
|
||||
* in the moving of a memory region covered by a non-direct buffer
|
||||
* from one location to another and both locations have different
|
||||
* alignment characteristics.
|
||||
* If the buffer is non-direct, and {@code unitSize > 1}
|
||||
*
|
||||
* @see #alignedSlice(int)
|
||||
* @since 9
|
||||
|
@ -2247,7 +2237,7 @@ public abstract sealed class $Type$Buffer
|
|||
throw new IllegalArgumentException("Index less than zero: " + index);
|
||||
if (unitSize < 1 || (unitSize & (unitSize - 1)) != 0)
|
||||
throw new IllegalArgumentException("Unit size not a power of two: " + unitSize);
|
||||
if (unitSize > 8 && !isDirect())
|
||||
if (unitSize > 1 && !isDirect())
|
||||
throw new UnsupportedOperationException("Unit size unsupported for non-direct buffers: " + unitSize);
|
||||
|
||||
return (int) ((address + index) & (unitSize - 1));
|
||||
|
@ -2287,10 +2277,6 @@ public abstract sealed class $Type$Buffer
|
|||
* from index, that is a multiple of the unit size, may be accessed
|
||||
* atomically, if supported by the native platform.
|
||||
*
|
||||
* @implNote
|
||||
* This implementation throws {@code UnsupportedOperationException} for
|
||||
* non-direct buffers when the given unit size is greater then {@code 8}.
|
||||
*
|
||||
* @param unitSize
|
||||
* The unit size in bytes, must be a power of {@code 2}
|
||||
*
|
||||
|
@ -2300,13 +2286,7 @@ public abstract sealed class $Type$Buffer
|
|||
* If the unit size not a power of {@code 2}
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* If the native platform does not guarantee stable aligned slices
|
||||
* for the given unit size when managing the memory regions
|
||||
* of buffers of the same kind as this buffer (direct or
|
||||
* non-direct). For example, if garbage collection would result
|
||||
* in the moving of a memory region covered by a non-direct buffer
|
||||
* from one location to another and both locations have different
|
||||
* alignment characteristics.
|
||||
* If the buffer is non-direct, and {@code unitSize > 1}
|
||||
*
|
||||
* @see #alignmentOffset(int, int)
|
||||
* @see #slice()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue