1 /* 2 * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.openjdk.bench.valhalla.arraytotal.fill; 24 25 import org.openjdk.bench.valhalla.arraytotal.util.StatesQ64long; 26 import org.openjdk.bench.valhalla.types.Int64; 27 import org.openjdk.bench.valhalla.types.Q64long; 28 import org.openjdk.jmh.annotations.Benchmark; 29 import org.openjdk.jmh.annotations.CompilerControl; 30 31 import java.util.Arrays; 32 33 public class Inline64longFillNew extends StatesQ64long { 34 35 @Benchmark 36 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 37 public void New_to_Val_as_Val_fill0(Val_as_Val st) { 38 Q64long[] arr = st.arr; 39 Q64long v = new Q64long(42); 40 for (int i = 0; i < arr.length; i++) { 41 arr[i] = v; 42 } 43 } 44 45 @Benchmark 46 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 47 public void New_to_Val_as_Val_fill1(Val_as_Val st) { 48 int len = st.arr.length; 49 Q64long v = new Q64long(42); 50 for (int i = 0; i < len; i++) { 51 st.arr[i] = v; 52 } 53 } 54 55 @Benchmark 56 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 57 public void New_to_Val_as_Ref_fill0(Val_as_Ref st) { 58 Q64long[] arr = st.arr; 59 Q64long v = new Q64long(42); 60 for (int i = 0; i < arr.length; i++) { 61 arr[i] = v; 62 } 63 } 64 65 @Benchmark 66 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 67 public void New_to_Val_as_Ref_fill1(Val_as_Ref st) { 68 int len = st.arr.length; 69 Q64long v = new Q64long(42); 70 for (int i = 0; i < len; i++) { 71 st.arr[i] = v; 72 } 73 } 74 75 @Benchmark 76 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 77 public void New_to_Ref_as_Ref_fill0(Ref_as_Ref st) { 78 Q64long[] arr = st.arr; 79 Q64long v = new Q64long(42); 80 for (int i = 0; i < arr.length; i++) { 81 arr[i] = v; 82 } 83 } 84 85 @Benchmark 86 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 87 public void New_to_Ref_as_Ref_fill1(Ref_as_Ref st) { 88 int len = st.arr.length; 89 Q64long v = new Q64long(42); 90 for (int i = 0; i < len; i++) { 91 st.arr[i] = v; 92 } 93 } 94 95 @Benchmark 96 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 97 public void New_to_Val_as_Int_fill0(Val_as_Int st) { 98 Int64[] arr = st.arr; 99 Q64long v = new Q64long(42); 100 for (int i = 0; i < arr.length; i++) { 101 arr[i] = v; 102 } 103 } 104 105 @Benchmark 106 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 107 public void New_to_Val_as_Int_fill1(Val_as_Int st) { 108 int len = st.arr.length; 109 Q64long v = new Q64long(42); 110 for (int i = 0; i < len; i++) { 111 st.arr[i] = v; 112 } 113 } 114 115 @Benchmark 116 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 117 public void New_to_Ref_as_Int_fill0(Ref_as_Int st) { 118 Int64[] arr = st.arr; 119 Q64long v = new Q64long(42); 120 for (int i = 0; i < arr.length; i++) { 121 arr[i] = v; 122 } 123 } 124 125 @Benchmark 126 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 127 public void New_to_Ref_as_Int_fill1(Ref_as_Int st) { 128 int len = st.arr.length; 129 Q64long v = new Q64long(42); 130 for (int i = 0; i < len; i++) { 131 st.arr[i] = v; 132 } 133 } 134 135 @Benchmark 136 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 137 public void New_to_Int_as_Int_fill0(Int_as_Int st) { 138 Int64[] arr = st.arr; 139 Q64long v = new Q64long(42); 140 for (int i = 0; i < arr.length; i++) { 141 arr[i] = v; 142 } 143 } 144 145 @Benchmark 146 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 147 public void New_to_Int_as_Int_fill1(Int_as_Int st) { 148 int len = st.arr.length; 149 Q64long v = new Q64long(42); 150 for (int i = 0; i < len; i++) { 151 st.arr[i] = v; 152 } 153 } 154 155 @Benchmark 156 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 157 public void New_to_Val_as_Obj_fill0(Val_as_Obj st) { 158 Object[] arr = st.arr; 159 Q64long v = new Q64long(42); 160 for (int i = 0; i < arr.length; i++) { 161 arr[i] = v; 162 } 163 } 164 165 @Benchmark 166 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 167 public void New_to_Val_as_Obj_fill1(Val_as_Obj st) { 168 int len = st.arr.length; 169 Q64long v = new Q64long(42); 170 for (int i = 0; i < len; i++) { 171 st.arr[i] = v; 172 } 173 } 174 175 @Benchmark 176 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 177 public void New_to_Ref_as_Obj_fill0(Ref_as_Obj st) { 178 Object[] arr = st.arr; 179 Q64long v = new Q64long(42); 180 for (int i = 0; i < arr.length; i++) { 181 arr[i] = v; 182 } 183 } 184 185 @Benchmark 186 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 187 public void New_to_Ref_as_Obj_fill1(Ref_as_Obj st) { 188 int len = st.arr.length; 189 Q64long v = new Q64long(42); 190 for (int i = 0; i < len; i++) { 191 st.arr[i] = v; 192 } 193 } 194 195 @Benchmark 196 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 197 public void New_to_Int_as_Obj_fill0(Int_as_Obj st) { 198 Object[] arr = st.arr; 199 Q64long v = new Q64long(42); 200 for (int i = 0; i < arr.length; i++) { 201 arr[i] = v; 202 } 203 } 204 205 @Benchmark 206 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 207 public void New_to_Int_as_Obj_fill1(Int_as_Obj st) { 208 int len = st.arr.length; 209 Q64long v = new Q64long(42); 210 for (int i = 0; i < len; i++) { 211 st.arr[i] = v; 212 } 213 } 214 215 @Benchmark 216 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 217 public void New_to_Obj_as_Obj_fill0(Obj_as_Obj st) { 218 Object[] arr = st.arr; 219 Q64long v = new Q64long(42); 220 for (int i = 0; i < arr.length; i++) { 221 arr[i] = v; 222 } 223 } 224 225 @Benchmark 226 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 227 public void New_to_Obj_as_Obj_fill1(Obj_as_Obj st) { 228 int len = st.arr.length; 229 Q64long v = new Q64long(42); 230 for (int i = 0; i < len; i++) { 231 st.arr[i] = v; 232 } 233 } 234 235 @Benchmark 236 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 237 public void New_to_Val_as_Val_arrayfill(Val_as_Val st) { 238 Arrays.fill(st.arr, new Q64long(42)); 239 } 240 241 @Benchmark 242 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 243 public void New_to_Val_as_Ref_arrayfill(Val_as_Ref st) { 244 Arrays.fill(st.arr, new Q64long(42)); 245 } 246 247 @Benchmark 248 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 249 public void New_to_Ref_as_Ref_arrayfill(Ref_as_Ref st) { 250 Arrays.fill(st.arr, new Q64long(42)); 251 } 252 253 @Benchmark 254 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 255 public void New_to_Val_as_Int_arrayfill(Val_as_Int st) { 256 Arrays.fill(st.arr, new Q64long(42)); 257 } 258 259 @Benchmark 260 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 261 public void New_to_Ref_as_Int_arrayfill(Ref_as_Int st) { 262 Arrays.fill(st.arr, new Q64long(42)); 263 } 264 265 @Benchmark 266 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 267 public void New_to_Int_as_Int_arrayfill(Int_as_Int st) { 268 Arrays.fill(st.arr, new Q64long(42)); 269 } 270 271 @Benchmark 272 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 273 public void New_to_Val_as_Obj_arrayfill(Val_as_Obj st) { 274 Arrays.fill(st.arr, new Q64long(42)); 275 } 276 277 @Benchmark 278 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 279 public void New_to_Ref_as_Obj_arrayfill(Ref_as_Obj st) { 280 Arrays.fill(st.arr, new Q64long(42)); 281 } 282 283 @Benchmark 284 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 285 public void New_to_Int_as_Obj_arrayfill(Int_as_Obj st) { 286 Arrays.fill(st.arr, new Q64long(42)); 287 } 288 289 @Benchmark 290 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 291 public void New_to_Obj_as_Obj_arrayfill(Obj_as_Obj st) { 292 Arrays.fill(st.arr, new Q64long(42)); 293 } 294 295 }