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.set; 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 public class Inline64longSetNew extends StatesQ64long { 32 33 @Benchmark 34 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 35 public void New_to_Val_as_Val_set0(Val_as_Val st) { 36 Q64long[] arr = st.arr; 37 for (int i = 0; i < arr.length; i++) { 38 arr[i] = new Q64long(i); 39 } 40 } 41 42 @Benchmark 43 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 44 public void New_to_Val_as_Val_set1(Val_as_Val st) { 45 int len = st.arr.length; 46 for (int i = 0; i < len; i++) { 47 st.arr[i] = new Q64long(i); 48 } 49 } 50 51 @Benchmark 52 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 53 public void New_to_Val_as_Ref_set0(Val_as_Ref st) { 54 Q64long[] arr = st.arr; 55 for (int i = 0; i < arr.length; i++) { 56 arr[i] = new Q64long(i); 57 } 58 } 59 60 @Benchmark 61 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 62 public void New_to_Val_as_Ref_set1(Val_as_Ref st) { 63 int len = st.arr.length; 64 for (int i = 0; i < len; i++) { 65 st.arr[i] = new Q64long(i); 66 } 67 } 68 69 @Benchmark 70 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 71 public void New_to_Ref_as_Ref_set0(Ref_as_Ref st) { 72 Q64long[] arr = st.arr; 73 for (int i = 0; i < arr.length; i++) { 74 arr[i] = new Q64long(i); 75 } 76 } 77 78 @Benchmark 79 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 80 public void New_to_Ref_as_Ref_set1(Ref_as_Ref st) { 81 int len = st.arr.length; 82 for (int i = 0; i < len; i++) { 83 st.arr[i] = new Q64long(i); 84 } 85 } 86 87 @Benchmark 88 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 89 public void New_to_Val_as_Int_set0(Val_as_Int st) { 90 Int64[] arr = st.arr; 91 for (int i = 0; i < arr.length; i++) { 92 arr[i] = new Q64long(i); 93 } 94 } 95 96 @Benchmark 97 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 98 public void New_to_Val_as_Int_set1(Val_as_Int st) { 99 int len = st.arr.length; 100 for (int i = 0; i < len; i++) { 101 st.arr[i] = new Q64long(i); 102 } 103 } 104 105 @Benchmark 106 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 107 public void New_to_Ref_as_Int_set0(Ref_as_Int st) { 108 Int64[] arr = st.arr; 109 for (int i = 0; i < arr.length; i++) { 110 arr[i] = new Q64long(i); 111 } 112 } 113 114 @Benchmark 115 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 116 public void New_to_Ref_as_Int_set1(Ref_as_Int st) { 117 int len = st.arr.length; 118 for (int i = 0; i < len; i++) { 119 st.arr[i] = new Q64long(i); 120 } 121 } 122 123 @Benchmark 124 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 125 public void New_to_Int_as_Int_set0(Int_as_Int st) { 126 Int64[] arr = st.arr; 127 for (int i = 0; i < arr.length; i++) { 128 arr[i] = new Q64long(i); 129 } 130 } 131 132 @Benchmark 133 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 134 public void New_to_Int_as_Int_set1(Int_as_Int st) { 135 int len = st.arr.length; 136 for (int i = 0; i < len; i++) { 137 st.arr[i] = new Q64long(i); 138 } 139 } 140 141 @Benchmark 142 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 143 public void New_to_Val_as_Obj_set0(Val_as_Obj st) { 144 Object[] arr = st.arr; 145 for (int i = 0; i < arr.length; i++) { 146 arr[i] = new Q64long(i); 147 } 148 } 149 150 @Benchmark 151 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 152 public void New_to_Val_as_Obj_set1(Val_as_Obj st) { 153 int len = st.arr.length; 154 for (int i = 0; i < len; i++) { 155 st.arr[i] = new Q64long(i); 156 } 157 } 158 159 @Benchmark 160 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 161 public void New_to_Ref_as_Obj_set0(Ref_as_Obj st) { 162 Object[] arr = st.arr; 163 for (int i = 0; i < arr.length; i++) { 164 arr[i] = new Q64long(i); 165 } 166 } 167 168 @Benchmark 169 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 170 public void New_to_Ref_as_Obj_set1(Ref_as_Obj st) { 171 int len = st.arr.length; 172 for (int i = 0; i < len; i++) { 173 st.arr[i] = new Q64long(i); 174 } 175 } 176 177 @Benchmark 178 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 179 public void New_to_Int_as_Obj_set0(Int_as_Obj st) { 180 Object[] arr = st.arr; 181 for (int i = 0; i < arr.length; i++) { 182 arr[i] = new Q64long(i); 183 } 184 } 185 186 @Benchmark 187 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 188 public void New_to_Int_as_Obj_set1(Int_as_Obj st) { 189 int len = st.arr.length; 190 for (int i = 0; i < len; i++) { 191 st.arr[i] = new Q64long(i); 192 } 193 } 194 195 @Benchmark 196 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 197 public void New_to_Obj_as_Obj_set0(Obj_as_Obj st) { 198 Object[] arr = st.arr; 199 for (int i = 0; i < arr.length; i++) { 200 arr[i] = new Q64long(i); 201 } 202 } 203 204 @Benchmark 205 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 206 public void New_to_Obj_as_Obj_set1(Obj_as_Obj st) { 207 int len = st.arr.length; 208 for (int i = 0; i < len; i++) { 209 st.arr[i] = new Q64long(i); 210 } 211 } 212 213 }