8286401: Address possibly lossy conversions in Microbenchmarks

Reviewed-by: shade, ecaspole
This commit is contained in:
Claes Redestad 2022-05-11 20:51:57 +00:00
parent 1c50ea36a5
commit 1586bf862b
13 changed files with 179 additions and 179 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -115,8 +115,8 @@ public class ByteBuffers {
// -- Heap_Byte_Swap_RO // -- Heap_Byte_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetByteSwapRO() { public byte testHeapLoopGetByteSwapRO() {
int r = 0; byte r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=1) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=1) {
r += heapByteBufferSwapRO.get(i); r += heapByteBufferSwapRO.get(i);
} }
@ -133,8 +133,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetByteSwap() { public byte testHeapLoopGetByteSwap() {
int r = 0; byte r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=1) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=1) {
r += heapByteBufferSwap.get(i); r += heapByteBufferSwap.get(i);
} }
@ -144,8 +144,8 @@ public class ByteBuffers {
// -- Heap_Byte__RO // -- Heap_Byte__RO
@Benchmark @Benchmark
public int testHeapLoopGetByteRO() { public byte testHeapLoopGetByteRO() {
int r = 0; byte r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=1) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=1) {
r += heapByteBufferRO.get(i); r += heapByteBufferRO.get(i);
} }
@ -162,8 +162,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetByte() { public byte testHeapLoopGetByte() {
int r = 0; byte r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=1) { for (int i = 0; i < heapByteBuffer.capacity(); i+=1) {
r += heapByteBuffer.get(i); r += heapByteBuffer.get(i);
} }
@ -173,8 +173,8 @@ public class ByteBuffers {
// -- Direct_Byte_Swap_RO // -- Direct_Byte_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetByteSwapRO() { public byte testDirectLoopGetByteSwapRO() {
int r = 0; byte r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=1) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=1) {
r += directByteBufferSwapRO.get(i); r += directByteBufferSwapRO.get(i);
} }
@ -191,8 +191,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetByteSwap() { public byte testDirectLoopGetByteSwap() {
int r = 0; byte r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=1) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=1) {
r += directByteBufferSwap.get(i); r += directByteBufferSwap.get(i);
} }
@ -202,8 +202,8 @@ public class ByteBuffers {
// -- Direct_Byte__RO // -- Direct_Byte__RO
@Benchmark @Benchmark
public int testDirectLoopGetByteRO() { public byte testDirectLoopGetByteRO() {
int r = 0; byte r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=1) { for (int i = 0; i < directByteBufferRO.capacity(); i+=1) {
r += directByteBufferRO.get(i); r += directByteBufferRO.get(i);
} }
@ -220,8 +220,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetByte() { public byte testDirectLoopGetByte() {
int r = 0; byte r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=1) { for (int i = 0; i < directByteBuffer.capacity(); i+=1) {
r += directByteBuffer.get(i); r += directByteBuffer.get(i);
} }
@ -231,8 +231,8 @@ public class ByteBuffers {
// -- Heap_Char_Swap_RO // -- Heap_Char_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetCharSwapRO() { public char testHeapLoopGetCharSwapRO() {
int r = 0; char r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=2) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=2) {
r += heapByteBufferSwapRO.getChar(i); r += heapByteBufferSwapRO.getChar(i);
} }
@ -249,8 +249,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetCharSwap() { public char testHeapLoopGetCharSwap() {
int r = 0; char r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=2) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=2) {
r += heapByteBufferSwap.getChar(i); r += heapByteBufferSwap.getChar(i);
} }
@ -260,8 +260,8 @@ public class ByteBuffers {
// -- Heap_Char__RO // -- Heap_Char__RO
@Benchmark @Benchmark
public int testHeapLoopGetCharRO() { public char testHeapLoopGetCharRO() {
int r = 0; char r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=2) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=2) {
r += heapByteBufferRO.getChar(i); r += heapByteBufferRO.getChar(i);
} }
@ -278,8 +278,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetChar() { public char testHeapLoopGetChar() {
int r = 0; char r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=2) { for (int i = 0; i < heapByteBuffer.capacity(); i+=2) {
r += heapByteBuffer.getChar(i); r += heapByteBuffer.getChar(i);
} }
@ -289,8 +289,8 @@ public class ByteBuffers {
// -- Direct_Char_Swap_RO // -- Direct_Char_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetCharSwapRO() { public char testDirectLoopGetCharSwapRO() {
int r = 0; char r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=2) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=2) {
r += directByteBufferSwapRO.getChar(i); r += directByteBufferSwapRO.getChar(i);
} }
@ -307,8 +307,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetCharSwap() { public char testDirectLoopGetCharSwap() {
int r = 0; char r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=2) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=2) {
r += directByteBufferSwap.getChar(i); r += directByteBufferSwap.getChar(i);
} }
@ -318,8 +318,8 @@ public class ByteBuffers {
// -- Direct_Char__RO // -- Direct_Char__RO
@Benchmark @Benchmark
public int testDirectLoopGetCharRO() { public char testDirectLoopGetCharRO() {
int r = 0; char r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=2) { for (int i = 0; i < directByteBufferRO.capacity(); i+=2) {
r += directByteBufferRO.getChar(i); r += directByteBufferRO.getChar(i);
} }
@ -336,8 +336,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetChar() { public char testDirectLoopGetChar() {
int r = 0; char r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=2) { for (int i = 0; i < directByteBuffer.capacity(); i+=2) {
r += directByteBuffer.getChar(i); r += directByteBuffer.getChar(i);
} }
@ -347,8 +347,8 @@ public class ByteBuffers {
// -- Heap_Short_Swap_RO // -- Heap_Short_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetShortSwapRO() { public short testHeapLoopGetShortSwapRO() {
int r = 0; short r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=2) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=2) {
r += heapByteBufferSwapRO.getShort(i); r += heapByteBufferSwapRO.getShort(i);
} }
@ -365,8 +365,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShortSwap() { public short testHeapLoopGetShortSwap() {
int r = 0; short r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=2) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=2) {
r += heapByteBufferSwap.getShort(i); r += heapByteBufferSwap.getShort(i);
} }
@ -376,8 +376,8 @@ public class ByteBuffers {
// -- Heap_Short__RO // -- Heap_Short__RO
@Benchmark @Benchmark
public int testHeapLoopGetShortRO() { public short testHeapLoopGetShortRO() {
int r = 0; short r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=2) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=2) {
r += heapByteBufferRO.getShort(i); r += heapByteBufferRO.getShort(i);
} }
@ -394,8 +394,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShort() { public short testHeapLoopGetShort() {
int r = 0; short r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=2) { for (int i = 0; i < heapByteBuffer.capacity(); i+=2) {
r += heapByteBuffer.getShort(i); r += heapByteBuffer.getShort(i);
} }
@ -405,8 +405,8 @@ public class ByteBuffers {
// -- Direct_Short_Swap_RO // -- Direct_Short_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetShortSwapRO() { public short testDirectLoopGetShortSwapRO() {
int r = 0; short r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=2) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=2) {
r += directByteBufferSwapRO.getShort(i); r += directByteBufferSwapRO.getShort(i);
} }
@ -423,8 +423,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShortSwap() { public short testDirectLoopGetShortSwap() {
int r = 0; short r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=2) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=2) {
r += directByteBufferSwap.getShort(i); r += directByteBufferSwap.getShort(i);
} }
@ -434,8 +434,8 @@ public class ByteBuffers {
// -- Direct_Short__RO // -- Direct_Short__RO
@Benchmark @Benchmark
public int testDirectLoopGetShortRO() { public short testDirectLoopGetShortRO() {
int r = 0; short r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=2) { for (int i = 0; i < directByteBufferRO.capacity(); i+=2) {
r += directByteBufferRO.getShort(i); r += directByteBufferRO.getShort(i);
} }
@ -452,8 +452,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShort() { public short testDirectLoopGetShort() {
int r = 0; short r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=2) { for (int i = 0; i < directByteBuffer.capacity(); i+=2) {
r += directByteBuffer.getShort(i); r += directByteBuffer.getShort(i);
} }
@ -579,8 +579,8 @@ public class ByteBuffers {
// -- Heap_Long_Swap_RO // -- Heap_Long_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetLongSwapRO() { public long testHeapLoopGetLongSwapRO() {
int r = 0; long r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=8) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=8) {
r += heapByteBufferSwapRO.getLong(i); r += heapByteBufferSwapRO.getLong(i);
} }
@ -597,8 +597,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLongSwap() { public long testHeapLoopGetLongSwap() {
int r = 0; long r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=8) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=8) {
r += heapByteBufferSwap.getLong(i); r += heapByteBufferSwap.getLong(i);
} }
@ -608,8 +608,8 @@ public class ByteBuffers {
// -- Heap_Long__RO // -- Heap_Long__RO
@Benchmark @Benchmark
public int testHeapLoopGetLongRO() { public long testHeapLoopGetLongRO() {
int r = 0; long r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=8) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=8) {
r += heapByteBufferRO.getLong(i); r += heapByteBufferRO.getLong(i);
} }
@ -626,8 +626,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLong() { public long testHeapLoopGetLong() {
int r = 0; long r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=8) { for (int i = 0; i < heapByteBuffer.capacity(); i+=8) {
r += heapByteBuffer.getLong(i); r += heapByteBuffer.getLong(i);
} }
@ -637,8 +637,8 @@ public class ByteBuffers {
// -- Direct_Long_Swap_RO // -- Direct_Long_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetLongSwapRO() { public long testDirectLoopGetLongSwapRO() {
int r = 0; long r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=8) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=8) {
r += directByteBufferSwapRO.getLong(i); r += directByteBufferSwapRO.getLong(i);
} }
@ -655,8 +655,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLongSwap() { public long testDirectLoopGetLongSwap() {
int r = 0; long r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=8) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=8) {
r += directByteBufferSwap.getLong(i); r += directByteBufferSwap.getLong(i);
} }
@ -666,8 +666,8 @@ public class ByteBuffers {
// -- Direct_Long__RO // -- Direct_Long__RO
@Benchmark @Benchmark
public int testDirectLoopGetLongRO() { public long testDirectLoopGetLongRO() {
int r = 0; long r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=8) { for (int i = 0; i < directByteBufferRO.capacity(); i+=8) {
r += directByteBufferRO.getLong(i); r += directByteBufferRO.getLong(i);
} }
@ -684,8 +684,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLong() { public long testDirectLoopGetLong() {
int r = 0; long r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=8) { for (int i = 0; i < directByteBuffer.capacity(); i+=8) {
r += directByteBuffer.getLong(i); r += directByteBuffer.getLong(i);
} }
@ -695,8 +695,8 @@ public class ByteBuffers {
// -- Heap_Float_Swap_RO // -- Heap_Float_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetFloatSwapRO() { public float testHeapLoopGetFloatSwapRO() {
int r = 0; float r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=4) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=4) {
r += heapByteBufferSwapRO.getFloat(i); r += heapByteBufferSwapRO.getFloat(i);
} }
@ -713,8 +713,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloatSwap() { public float testHeapLoopGetFloatSwap() {
int r = 0; float r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=4) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=4) {
r += heapByteBufferSwap.getFloat(i); r += heapByteBufferSwap.getFloat(i);
} }
@ -724,8 +724,8 @@ public class ByteBuffers {
// -- Heap_Float__RO // -- Heap_Float__RO
@Benchmark @Benchmark
public int testHeapLoopGetFloatRO() { public float testHeapLoopGetFloatRO() {
int r = 0; float r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=4) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=4) {
r += heapByteBufferRO.getFloat(i); r += heapByteBufferRO.getFloat(i);
} }
@ -742,8 +742,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloat() { public float testHeapLoopGetFloat() {
int r = 0; float r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=4) { for (int i = 0; i < heapByteBuffer.capacity(); i+=4) {
r += heapByteBuffer.getFloat(i); r += heapByteBuffer.getFloat(i);
} }
@ -753,8 +753,8 @@ public class ByteBuffers {
// -- Direct_Float_Swap_RO // -- Direct_Float_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetFloatSwapRO() { public float testDirectLoopGetFloatSwapRO() {
int r = 0; float r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=4) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=4) {
r += directByteBufferSwapRO.getFloat(i); r += directByteBufferSwapRO.getFloat(i);
} }
@ -771,8 +771,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloatSwap() { public float testDirectLoopGetFloatSwap() {
int r = 0; float r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=4) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=4) {
r += directByteBufferSwap.getFloat(i); r += directByteBufferSwap.getFloat(i);
} }
@ -782,8 +782,8 @@ public class ByteBuffers {
// -- Direct_Float__RO // -- Direct_Float__RO
@Benchmark @Benchmark
public int testDirectLoopGetFloatRO() { public float testDirectLoopGetFloatRO() {
int r = 0; float r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=4) { for (int i = 0; i < directByteBufferRO.capacity(); i+=4) {
r += directByteBufferRO.getFloat(i); r += directByteBufferRO.getFloat(i);
} }
@ -800,8 +800,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloat() { public float testDirectLoopGetFloat() {
int r = 0; float r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=4) { for (int i = 0; i < directByteBuffer.capacity(); i+=4) {
r += directByteBuffer.getFloat(i); r += directByteBuffer.getFloat(i);
} }
@ -811,8 +811,8 @@ public class ByteBuffers {
// -- Heap_Double_Swap_RO // -- Heap_Double_Swap_RO
@Benchmark @Benchmark
public int testHeapLoopGetDoubleSwapRO() { public double testHeapLoopGetDoubleSwapRO() {
int r = 0; double r = 0;
for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=8) { for (int i = 0; i < heapByteBufferSwapRO.capacity(); i+=8) {
r += heapByteBufferSwapRO.getDouble(i); r += heapByteBufferSwapRO.getDouble(i);
} }
@ -829,8 +829,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDoubleSwap() { public double testHeapLoopGetDoubleSwap() {
int r = 0; double r = 0;
for (int i = 0; i < heapByteBufferSwap.capacity(); i+=8) { for (int i = 0; i < heapByteBufferSwap.capacity(); i+=8) {
r += heapByteBufferSwap.getDouble(i); r += heapByteBufferSwap.getDouble(i);
} }
@ -840,8 +840,8 @@ public class ByteBuffers {
// -- Heap_Double__RO // -- Heap_Double__RO
@Benchmark @Benchmark
public int testHeapLoopGetDoubleRO() { public double testHeapLoopGetDoubleRO() {
int r = 0; double r = 0;
for (int i = 0; i < heapByteBufferRO.capacity(); i+=8) { for (int i = 0; i < heapByteBufferRO.capacity(); i+=8) {
r += heapByteBufferRO.getDouble(i); r += heapByteBufferRO.getDouble(i);
} }
@ -858,8 +858,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDouble() { public double testHeapLoopGetDouble() {
int r = 0; double r = 0;
for (int i = 0; i < heapByteBuffer.capacity(); i+=8) { for (int i = 0; i < heapByteBuffer.capacity(); i+=8) {
r += heapByteBuffer.getDouble(i); r += heapByteBuffer.getDouble(i);
} }
@ -869,8 +869,8 @@ public class ByteBuffers {
// -- Direct_Double_Swap_RO // -- Direct_Double_Swap_RO
@Benchmark @Benchmark
public int testDirectLoopGetDoubleSwapRO() { public double testDirectLoopGetDoubleSwapRO() {
int r = 0; double r = 0;
for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=8) { for (int i = 0; i < directByteBufferSwapRO.capacity(); i+=8) {
r += directByteBufferSwapRO.getDouble(i); r += directByteBufferSwapRO.getDouble(i);
} }
@ -887,8 +887,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDoubleSwap() { public double testDirectLoopGetDoubleSwap() {
int r = 0; double r = 0;
for (int i = 0; i < directByteBufferSwap.capacity(); i+=8) { for (int i = 0; i < directByteBufferSwap.capacity(); i+=8) {
r += directByteBufferSwap.getDouble(i); r += directByteBufferSwap.getDouble(i);
} }
@ -898,8 +898,8 @@ public class ByteBuffers {
// -- Direct_Double__RO // -- Direct_Double__RO
@Benchmark @Benchmark
public int testDirectLoopGetDoubleRO() { public double testDirectLoopGetDoubleRO() {
int r = 0; double r = 0;
for (int i = 0; i < directByteBufferRO.capacity(); i+=8) { for (int i = 0; i < directByteBufferRO.capacity(); i+=8) {
r += directByteBufferRO.getDouble(i); r += directByteBufferRO.getDouble(i);
} }
@ -916,8 +916,8 @@ public class ByteBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDouble() { public double testDirectLoopGetDouble() {
int r = 0; double r = 0;
for (int i = 0; i < directByteBuffer.capacity(); i+=8) { for (int i = 0; i < directByteBuffer.capacity(); i+=8) {
r += directByteBuffer.getDouble(i); r += directByteBuffer.getDouble(i);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,8 @@ public class CharBuffers {
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGetChar(CharBuffer buf) { private char innerLoopGetChar(CharBuffer buf) {
int r = 0; char r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }
@ -135,7 +135,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetChar() { public char testHeapLoopGetChar() {
return innerLoopGetChar(heapCharBuffer); return innerLoopGetChar(heapCharBuffer);
} }
@ -148,7 +148,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetCharViewSwapRO() { public char testHeapLoopGetCharViewSwapRO() {
return innerLoopGetChar(heapByteBufferAsCharBufferViewSwapRO); return innerLoopGetChar(heapByteBufferAsCharBufferViewSwapRO);
} }
@ -172,7 +172,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetCharViewSwap() { public char testHeapLoopGetCharViewSwap() {
return innerLoopGetChar(heapByteBufferAsCharBufferViewSwap); return innerLoopGetChar(heapByteBufferAsCharBufferViewSwap);
} }
@ -185,7 +185,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetCharViewRO() { public char testHeapLoopGetCharViewRO() {
return innerLoopGetChar(heapByteBufferAsCharBufferViewRO); return innerLoopGetChar(heapByteBufferAsCharBufferViewRO);
} }
@ -209,7 +209,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetCharView() { public char testHeapLoopGetCharView() {
return innerLoopGetChar(heapByteBufferAsCharBufferView); return innerLoopGetChar(heapByteBufferAsCharBufferView);
} }
@ -222,7 +222,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetCharViewSwapRO() { public char testDirectLoopGetCharViewSwapRO() {
return innerLoopGetChar(directByteBufferAsCharBufferViewSwapRO); return innerLoopGetChar(directByteBufferAsCharBufferViewSwapRO);
} }
@ -246,7 +246,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetCharViewSwap() { public char testDirectLoopGetCharViewSwap() {
return innerLoopGetChar(directByteBufferAsCharBufferViewSwap); return innerLoopGetChar(directByteBufferAsCharBufferViewSwap);
} }
@ -259,7 +259,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetCharViewRO() { public char testDirectLoopGetCharViewRO() {
return innerLoopGetChar(directByteBufferAsCharBufferViewRO); return innerLoopGetChar(directByteBufferAsCharBufferViewRO);
} }
@ -283,7 +283,7 @@ public class CharBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetCharView() { public char testDirectLoopGetCharView() {
return innerLoopGetChar(directByteBufferAsCharBufferView); return innerLoopGetChar(directByteBufferAsCharBufferView);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,8 @@ public class DoubleBuffers {
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGetDouble(DoubleBuffer buf) { private double innerLoopGetDouble(DoubleBuffer buf) {
int r = 0; double r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }
@ -135,7 +135,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDouble() { public double testHeapLoopGetDouble() {
return innerLoopGetDouble(heapDoubleBuffer); return innerLoopGetDouble(heapDoubleBuffer);
} }
@ -148,7 +148,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDoubleViewSwapRO() { public double testHeapLoopGetDoubleViewSwapRO() {
return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewSwapRO); return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewSwapRO);
} }
@ -172,7 +172,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDoubleViewSwap() { public double testHeapLoopGetDoubleViewSwap() {
return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewSwap); return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewSwap);
} }
@ -185,7 +185,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDoubleViewRO() { public double testHeapLoopGetDoubleViewRO() {
return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewRO); return innerLoopGetDouble(heapByteBufferAsDoubleBufferViewRO);
} }
@ -209,7 +209,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetDoubleView() { public double testHeapLoopGetDoubleView() {
return innerLoopGetDouble(heapByteBufferAsDoubleBufferView); return innerLoopGetDouble(heapByteBufferAsDoubleBufferView);
} }
@ -222,7 +222,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDoubleViewSwapRO() { public double testDirectLoopGetDoubleViewSwapRO() {
return innerLoopGetDouble(directByteBufferAsDoubleBufferViewSwapRO); return innerLoopGetDouble(directByteBufferAsDoubleBufferViewSwapRO);
} }
@ -246,7 +246,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDoubleViewSwap() { public double testDirectLoopGetDoubleViewSwap() {
return innerLoopGetDouble(directByteBufferAsDoubleBufferViewSwap); return innerLoopGetDouble(directByteBufferAsDoubleBufferViewSwap);
} }
@ -259,7 +259,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDoubleViewRO() { public double testDirectLoopGetDoubleViewRO() {
return innerLoopGetDouble(directByteBufferAsDoubleBufferViewRO); return innerLoopGetDouble(directByteBufferAsDoubleBufferViewRO);
} }
@ -283,7 +283,7 @@ public class DoubleBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetDoubleView() { public double testDirectLoopGetDoubleView() {
return innerLoopGetDouble(directByteBufferAsDoubleBufferView); return innerLoopGetDouble(directByteBufferAsDoubleBufferView);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,8 @@ public class FloatBuffers {
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGetFloat(FloatBuffer buf) { private float innerLoopGetFloat(FloatBuffer buf) {
int r = 0; float r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }
@ -135,7 +135,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloat() { public float testHeapLoopGetFloat() {
return innerLoopGetFloat(heapFloatBuffer); return innerLoopGetFloat(heapFloatBuffer);
} }
@ -148,7 +148,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloatViewSwapRO() { public float testHeapLoopGetFloatViewSwapRO() {
return innerLoopGetFloat(heapByteBufferAsFloatBufferViewSwapRO); return innerLoopGetFloat(heapByteBufferAsFloatBufferViewSwapRO);
} }
@ -172,7 +172,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloatViewSwap() { public float testHeapLoopGetFloatViewSwap() {
return innerLoopGetFloat(heapByteBufferAsFloatBufferViewSwap); return innerLoopGetFloat(heapByteBufferAsFloatBufferViewSwap);
} }
@ -185,7 +185,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloatViewRO() { public float testHeapLoopGetFloatViewRO() {
return innerLoopGetFloat(heapByteBufferAsFloatBufferViewRO); return innerLoopGetFloat(heapByteBufferAsFloatBufferViewRO);
} }
@ -209,7 +209,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetFloatView() { public float testHeapLoopGetFloatView() {
return innerLoopGetFloat(heapByteBufferAsFloatBufferView); return innerLoopGetFloat(heapByteBufferAsFloatBufferView);
} }
@ -222,7 +222,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloatViewSwapRO() { public float testDirectLoopGetFloatViewSwapRO() {
return innerLoopGetFloat(directByteBufferAsFloatBufferViewSwapRO); return innerLoopGetFloat(directByteBufferAsFloatBufferViewSwapRO);
} }
@ -246,7 +246,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloatViewSwap() { public float testDirectLoopGetFloatViewSwap() {
return innerLoopGetFloat(directByteBufferAsFloatBufferViewSwap); return innerLoopGetFloat(directByteBufferAsFloatBufferViewSwap);
} }
@ -259,7 +259,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloatViewRO() { public float testDirectLoopGetFloatViewRO() {
return innerLoopGetFloat(directByteBufferAsFloatBufferViewRO); return innerLoopGetFloat(directByteBufferAsFloatBufferViewRO);
} }
@ -283,7 +283,7 @@ public class FloatBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetFloatView() { public float testDirectLoopGetFloatView() {
return innerLoopGetFloat(directByteBufferAsFloatBufferView); return innerLoopGetFloat(directByteBufferAsFloatBufferView);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,8 @@ public class LongBuffers {
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGetLong(LongBuffer buf) { private long innerLoopGetLong(LongBuffer buf) {
int r = 0; long r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }
@ -135,7 +135,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLong() { public long testHeapLoopGetLong() {
return innerLoopGetLong(heapLongBuffer); return innerLoopGetLong(heapLongBuffer);
} }
@ -148,7 +148,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLongViewSwapRO() { public long testHeapLoopGetLongViewSwapRO() {
return innerLoopGetLong(heapByteBufferAsLongBufferViewSwapRO); return innerLoopGetLong(heapByteBufferAsLongBufferViewSwapRO);
} }
@ -172,7 +172,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLongViewSwap() { public long testHeapLoopGetLongViewSwap() {
return innerLoopGetLong(heapByteBufferAsLongBufferViewSwap); return innerLoopGetLong(heapByteBufferAsLongBufferViewSwap);
} }
@ -185,7 +185,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLongViewRO() { public long testHeapLoopGetLongViewRO() {
return innerLoopGetLong(heapByteBufferAsLongBufferViewRO); return innerLoopGetLong(heapByteBufferAsLongBufferViewRO);
} }
@ -209,7 +209,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetLongView() { public long testHeapLoopGetLongView() {
return innerLoopGetLong(heapByteBufferAsLongBufferView); return innerLoopGetLong(heapByteBufferAsLongBufferView);
} }
@ -222,7 +222,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLongViewSwapRO() { public long testDirectLoopGetLongViewSwapRO() {
return innerLoopGetLong(directByteBufferAsLongBufferViewSwapRO); return innerLoopGetLong(directByteBufferAsLongBufferViewSwapRO);
} }
@ -246,7 +246,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLongViewSwap() { public long testDirectLoopGetLongViewSwap() {
return innerLoopGetLong(directByteBufferAsLongBufferViewSwap); return innerLoopGetLong(directByteBufferAsLongBufferViewSwap);
} }
@ -259,7 +259,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLongViewRO() { public long testDirectLoopGetLongViewRO() {
return innerLoopGetLong(directByteBufferAsLongBufferViewRO); return innerLoopGetLong(directByteBufferAsLongBufferViewRO);
} }
@ -283,7 +283,7 @@ public class LongBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetLongView() { public long testDirectLoopGetLongView() {
return innerLoopGetLong(directByteBufferAsLongBufferView); return innerLoopGetLong(directByteBufferAsLongBufferView);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,8 @@ public class ShortBuffers {
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGetShort(ShortBuffer buf) { private short innerLoopGetShort(ShortBuffer buf) {
int r = 0; short r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }
@ -135,7 +135,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShort() { public short testHeapLoopGetShort() {
return innerLoopGetShort(heapShortBuffer); return innerLoopGetShort(heapShortBuffer);
} }
@ -148,7 +148,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShortViewSwapRO() { public short testHeapLoopGetShortViewSwapRO() {
return innerLoopGetShort(heapByteBufferAsShortBufferViewSwapRO); return innerLoopGetShort(heapByteBufferAsShortBufferViewSwapRO);
} }
@ -172,7 +172,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShortViewSwap() { public short testHeapLoopGetShortViewSwap() {
return innerLoopGetShort(heapByteBufferAsShortBufferViewSwap); return innerLoopGetShort(heapByteBufferAsShortBufferViewSwap);
} }
@ -185,7 +185,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShortViewRO() { public short testHeapLoopGetShortViewRO() {
return innerLoopGetShort(heapByteBufferAsShortBufferViewRO); return innerLoopGetShort(heapByteBufferAsShortBufferViewRO);
} }
@ -209,7 +209,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testHeapLoopGetShortView() { public short testHeapLoopGetShortView() {
return innerLoopGetShort(heapByteBufferAsShortBufferView); return innerLoopGetShort(heapByteBufferAsShortBufferView);
} }
@ -222,7 +222,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShortViewSwapRO() { public short testDirectLoopGetShortViewSwapRO() {
return innerLoopGetShort(directByteBufferAsShortBufferViewSwapRO); return innerLoopGetShort(directByteBufferAsShortBufferViewSwapRO);
} }
@ -246,7 +246,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShortViewSwap() { public short testDirectLoopGetShortViewSwap() {
return innerLoopGetShort(directByteBufferAsShortBufferViewSwap); return innerLoopGetShort(directByteBufferAsShortBufferViewSwap);
} }
@ -259,7 +259,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShortViewRO() { public short testDirectLoopGetShortViewRO() {
return innerLoopGetShort(directByteBufferAsShortBufferViewRO); return innerLoopGetShort(directByteBufferAsShortBufferViewRO);
} }
@ -283,7 +283,7 @@ public class ShortBuffers {
} }
@Benchmark @Benchmark
public int testDirectLoopGetShortView() { public short testDirectLoopGetShortView() {
return innerLoopGetShort(directByteBufferAsShortBufferView); return innerLoopGetShort(directByteBufferAsShortBufferView);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -53,7 +53,7 @@ class XXX {
#end[RO] #end[RO]
@Benchmark @Benchmark
public int test$Ms$LoopGet$Type${#if[view]?View}$SWAP$$RO$() { public $type$ test$Ms$LoopGet$Type${#if[view]?View}$SWAP$$RO$() {
return innerLoopGet$Type$($ms${#if[view]?ByteBufferAs}$Type$Buffer{#if[view]?View}$SWAP$$RO$); return innerLoopGet$Type$($ms${#if[view]?ByteBufferAs}$Type$Buffer{#if[view]?View}$SWAP$$RO$);
} }
#end[byte] #end[byte]

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -133,8 +133,8 @@ public class $Type$Buffers {
#if[!byte] #if[!byte]
// ---------------- HELPER METHODS // ---------------- HELPER METHODS
private int innerLoopGet$Type$($Type$Buffer buf) { private $type$ innerLoopGet$Type$($Type$Buffer buf) {
int r = 0; $type$ r = 0;
for (int i = 0; i < buf.capacity(); i++) { for (int i = 0; i < buf.capacity(); i++) {
r += buf.get(i); r += buf.get(i);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,8 +40,8 @@ class XXX {
#end[RO] #end[RO]
@Benchmark @Benchmark
public int test$Ms$LoopGet$Type$$SWAP$$RO$() { public $type$ test$Ms$LoopGet$Type$$SWAP$$RO$() {
int r = 0; $type$ r = 0;
for (int i = 0; i < $ms$ByteBuffer$SWAP$$RO$.capacity(); i+=$CarrierBW$) { for (int i = 0; i < $ms$ByteBuffer$SWAP$$RO$.capacity(); i+=$CarrierBW$) {
r += $ms$ByteBuffer$SWAP$$RO$.get{#if[!byte]?$Type$}(i); r += $ms$ByteBuffer$SWAP$$RO$.get{#if[!byte]?$Type$}(i);
} }

View File

@ -69,7 +69,7 @@ public abstract class CipherBench extends CryptoBase {
} }
// toggle some bits in the IV to get around IV reuse defenses // toggle some bits in the IV to get around IV reuse defenses
iv[0] ^= 0xFF; iv[0] ^= (byte)0xFF;
AlgorithmParameterSpec paramSpec = makeParameterSpec(); AlgorithmParameterSpec paramSpec = makeParameterSpec();
c.init(mode, ks, paramSpec); c.init(mode, ks, paramSpec);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,8 +145,8 @@ public class PointerBenchmarkFlat {
} }
@Benchmark @Benchmark
public int test() { public long test() {
int sum = 0; long sum = 0;
for (int i = 0 ; i < ELEM_SIZE ; i++) { for (int i = 0 ; i < ELEM_SIZE ; i++) {
sum += ptr_ptr.get(i).address().toRawLongValue(); sum += ptr_ptr.get(i).address().toRawLongValue();
} }
@ -154,8 +154,8 @@ public class PointerBenchmarkFlat {
} }
@Benchmark @Benchmark
public int testFlat() { public long testFlat() {
int sum = 0; long sum = 0;
for (int i = 0 ; i < ELEM_SIZE ; i++) { for (int i = 0 ; i < ELEM_SIZE ; i++) {
sum += ptr_ptr_flat.get(i).address().toRawLongValue(); sum += ptr_ptr_flat.get(i).address().toRawLongValue();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -120,8 +120,8 @@ public class Straighten {
/** Tests how well serial constant long compares are straightened. */ /** Tests how well serial constant long compares are straightened. */
@Benchmark @Benchmark
public int testStraighten1long() throws Exception { public long testStraighten1long() throws Exception {
int dummy = 0; long dummy = 0;
long[] arr = longArr; long[] arr = longArr;
for (long l : arr) { for (long l : arr) {
dummy += innerCandidate1long(l); dummy += innerCandidate1long(l);
@ -182,8 +182,8 @@ public class Straighten {
/** Tests how well constant long definitions are straightened. */ /** Tests how well constant long definitions are straightened. */
@Benchmark @Benchmark
public int testStraighten2long() throws Exception { public long testStraighten2long() throws Exception {
int dummy = 0; long dummy = 0;
long[] arr = longArr; long[] arr = longArr;
for (long l : arr) { for (long l : arr) {
dummy += innerCandidate2long(l); dummy += innerCandidate2long(l);
@ -236,8 +236,8 @@ public class Straighten {
/** Tests how well variable long compares are straightened. */ /** Tests how well variable long compares are straightened. */
@Benchmark @Benchmark
public int testStraighten3long() throws Exception { public long testStraighten3long() throws Exception {
int dummy = 0; long dummy = 0;
long[] arr = longArr; long[] arr = longArr;
for (int i = 0; i < arr.length - 1; i++) { for (int i = 0; i < arr.length - 1; i++) {
dummy += innerCandidate3long(arr[i], arr[i + 1]); dummy += innerCandidate3long(arr[i], arr[i + 1]);