mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8265518: C1: Intrinsic support for Preconditions.checkIndex
Reviewed-by: dfuchs, iveresov
This commit is contained in:
parent
a466b49e71
commit
5cee23a9ed
11 changed files with 270 additions and 98 deletions
|
@ -34,9 +34,9 @@ import jdk.internal.misc.ScopedMemoryAccess.Scope;
|
|||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.misc.VM.BufferPool;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.util.Objects;
|
||||
import java.util.Spliterator;
|
||||
|
||||
/**
|
||||
|
@ -737,11 +737,8 @@ public abstract class Buffer {
|
|||
* IndexOutOfBoundsException} if it is not smaller than the limit
|
||||
* or is smaller than zero.
|
||||
*/
|
||||
@IntrinsicCandidate
|
||||
final int checkIndex(int i) { // package-private
|
||||
if ((i < 0) || (i >= limit))
|
||||
throw new IndexOutOfBoundsException();
|
||||
return i;
|
||||
return Objects.checkIndex(i, limit);
|
||||
}
|
||||
|
||||
final int checkIndex(int i, int nb) { // package-private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue