mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8343188: Investigate ways to simplify MemorySegment::ofBuffer
Reviewed-by: mcimadamore
This commit is contained in:
parent
7f131a9e1e
commit
f69b6016d6
9 changed files with 307 additions and 66 deletions
|
@ -28,6 +28,10 @@
|
|||
package java.nio;
|
||||
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import jdk.internal.foreign.AbstractMemorySegmentImpl;
|
||||
import jdk.internal.foreign.MemorySessionImpl;
|
||||
import jdk.internal.foreign.SegmentFactories;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -735,6 +739,23 @@ class Heap$Type$Buffer$RW$
|
|||
|
||||
#end[char]
|
||||
|
||||
#if[byte]
|
||||
@ForceInline
|
||||
@Override
|
||||
int scaleShifts() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
@Override
|
||||
AbstractMemorySegmentImpl heapSegment(Object base,
|
||||
long offset,
|
||||
long length,
|
||||
boolean readOnly,
|
||||
MemorySessionImpl bufferScope) {
|
||||
return SegmentFactories.arrayOf$Type$Segment(base, offset, length, readOnly, bufferScope);
|
||||
}
|
||||
#end[byte]
|
||||
|
||||
#if[!byte]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue