5555 "--enable-native-access=ALL-UNNAMED" })
5656public class InternalStrLen {
5757
58- private AbstractMemorySegmentImpl singleByteSegment ;
59- private AbstractMemorySegmentImpl singleByteSegmentMisaligned ;
60- private AbstractMemorySegmentImpl doubleByteSegment ;
61- private AbstractMemorySegmentImpl quadByteSegment ;
58+ private MemorySegment singleByteSegment ;
59+ private MemorySegment singleByteSegmentMisaligned ;
60+ private MemorySegment doubleByteSegment ;
61+ private MemorySegment quadByteSegment ;
6262
6363 @ Param ({"1" , "4" , "16" , "251" , "1024" })
6464 int size ;
6565
6666 @ Setup
6767 public void setup () {
6868 var arena = Arena .ofAuto ();
69- singleByteSegment = ( AbstractMemorySegmentImpl ) arena .allocate ((size + 1L ) * Byte .BYTES );
70- doubleByteSegment = ( AbstractMemorySegmentImpl ) arena .allocate ((size + 1L ) * Short .BYTES );
71- quadByteSegment = ( AbstractMemorySegmentImpl ) arena .allocate ((size + 1L ) * Integer .BYTES );
69+ singleByteSegment = arena .allocate ((size + 1L ) * Byte .BYTES );
70+ doubleByteSegment = arena .allocate ((size + 1L ) * Short .BYTES );
71+ quadByteSegment = arena .allocate ((size + 1L ) * Integer .BYTES );
7272 Stream .of (singleByteSegment , doubleByteSegment , quadByteSegment )
7373 .forEach (s -> IntStream .range (0 , (int ) s .byteSize () - 1 )
7474 .forEach (i -> s .set (
@@ -79,7 +79,7 @@ public void setup() {
7979 singleByteSegment .set (ValueLayout .JAVA_BYTE , singleByteSegment .byteSize () - Byte .BYTES , (byte ) 0 );
8080 doubleByteSegment .set (ValueLayout .JAVA_SHORT , doubleByteSegment .byteSize () - Short .BYTES , (short ) 0 );
8181 quadByteSegment .set (ValueLayout .JAVA_INT , quadByteSegment .byteSize () - Integer .BYTES , 0 );
82- singleByteSegmentMisaligned = ( AbstractMemorySegmentImpl ) arena .allocate (singleByteSegment .byteSize () + 1 ).
82+ singleByteSegmentMisaligned = arena .allocate (singleByteSegment .byteSize () + 1 ).
8383 asSlice (1 );
8484 MemorySegment .copy (singleByteSegment , 0 , singleByteSegmentMisaligned , 0 , singleByteSegment .byteSize ());
8585 }
@@ -106,22 +106,22 @@ public int elementQuad() {
106106
107107 @ Benchmark
108108 public int chunkedSingle () {
109- return StringSupport .strlenByte (singleByteSegment , 0 , singleByteSegment .byteSize ());
109+ return StringSupport .strlenByte (( AbstractMemorySegmentImpl ) singleByteSegment , 0 , singleByteSegment .byteSize ());
110110 }
111111
112112 @ Benchmark
113113 public int chunkedSingleMisaligned () {
114- return StringSupport .strlenByte (singleByteSegmentMisaligned , 0 , singleByteSegment .byteSize ());
114+ return StringSupport .strlenByte (( AbstractMemorySegmentImpl ) singleByteSegmentMisaligned , 0 , singleByteSegment .byteSize ());
115115 }
116116
117117 @ Benchmark
118118 public int chunkedDouble () {
119- return StringSupport .strlenShort (doubleByteSegment , 0 , doubleByteSegment .byteSize ());
119+ return StringSupport .strlenShort (( AbstractMemorySegmentImpl ) doubleByteSegment , 0 , doubleByteSegment .byteSize ());
120120 }
121121
122122 @ Benchmark
123123 public int changedElementQuad () {
124- return StringSupport .strlenInt (quadByteSegment , 0 , quadByteSegment .byteSize ());
124+ return StringSupport .strlenInt (( AbstractMemorySegmentImpl ) quadByteSegment , 0 , quadByteSegment .byteSize ());
125125 }
126126
127127 // These are the legacy methods
0 commit comments