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.field.copy; 24 25 import org.openjdk.bench.valhalla.field.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 Inline64long extends StatesQ64long { 32 33 @Benchmark 34 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 35 public void Obj_to_Obj_copy(ObjState s, ObjState d) { 36 ObjWrapper[] src = s.arr; 37 ObjWrapper[] dst = d.arr; 38 for (int i = 0; i < src.length; i++) { 39 dst[i].f = src[i].f; 40 } 41 } 42 43 @Benchmark 44 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 45 public void Obj_to_Int_copy(ObjState s, IntState d) { 46 ObjWrapper[] src = s.arr; 47 IntWrapper[] dst = d.arr; 48 for (int i = 0; i < src.length; i++) { 49 dst[i].f = (Int64) src[i].f; 50 } 51 } 52 53 @Benchmark 54 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 55 public void Obj_to_Ref_copy(ObjState s, RefState d) { 56 ObjWrapper[] src = s.arr; 57 RefWrapper[] dst = d.arr; 58 for (int i = 0; i < src.length; i++) { 59 dst[i].f = (Q64long)src[i].f; 60 } 61 } 62 63 @Benchmark 64 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 65 public void Obj_to_Val_copy(ObjState s, ValState d) { 66 ObjWrapper[] src = s.arr; 67 ValWrapper[] dst = d.arr; 68 for (int i = 0; i < src.length; i++) { 69 dst[i].f = (Q64long) src[i].f; 70 } 71 } 72 73 @Benchmark 74 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 75 public void Int_to_Obj_copy(IntState s, ObjState d) { 76 IntWrapper[] src = s.arr; 77 ObjWrapper[] dst = d.arr; 78 for (int i = 0; i < src.length; i++) { 79 dst[i].f = src[i].f; 80 } 81 } 82 83 @Benchmark 84 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 85 public void Int_to_Int_copy(IntState s, IntState d) { 86 IntWrapper[] src = s.arr; 87 IntWrapper[] dst = d.arr; 88 for (int i = 0; i < src.length; i++) { 89 dst[i].f = src[i].f; 90 } 91 } 92 93 @Benchmark 94 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 95 public void Int_to_Ref_copy(IntState s, RefState d) { 96 IntWrapper[] src = s.arr; 97 RefWrapper[] dst = d.arr; 98 for (int i = 0; i < src.length; i++) { 99 dst[i].f = (Q64long)src[i].f; 100 } 101 } 102 103 @Benchmark 104 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 105 public void Int_to_Val_copy(IntState s, ValState d) { 106 IntWrapper[] src = s.arr; 107 ValWrapper[] dst = d.arr; 108 for (int i = 0; i < src.length; i++) { 109 dst[i].f = (Q64long) src[i].f; 110 } 111 } 112 113 @Benchmark 114 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 115 public void Ref_to_Obj_copy(RefState s, ObjState d) { 116 RefWrapper[] src = s.arr; 117 ObjWrapper[] dst = d.arr; 118 for (int i = 0; i < src.length; i++) { 119 dst[i].f = src[i].f; 120 } 121 } 122 123 @Benchmark 124 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 125 public void Ref_to_Int_copy(RefState s, IntState d) { 126 RefWrapper[] src = s.arr; 127 IntWrapper[] dst = d.arr; 128 for (int i = 0; i < src.length; i++) { 129 dst[i].f = src[i].f; 130 } 131 } 132 133 @Benchmark 134 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 135 public void Ref_to_Ref_copy(RefState s, RefState d) { 136 RefWrapper[] src = s.arr; 137 RefWrapper[] dst = d.arr; 138 for (int i = 0; i < src.length; i++) { 139 dst[i].f = src[i].f; 140 } 141 } 142 143 @Benchmark 144 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 145 public void Ref_to_Val_copy(RefState s, ValState d) { 146 RefWrapper[] src = s.arr; 147 ValWrapper[] dst = d.arr; 148 for (int i = 0; i < src.length; i++) { 149 dst[i].f = src[i].f; 150 } 151 } 152 153 @Benchmark 154 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 155 public void Val_to_Obj_copy(ValState s, ObjState d) { 156 ValWrapper[] src = s.arr; 157 ObjWrapper[] dst = d.arr; 158 for (int i = 0; i < src.length; i++) { 159 dst[i].f = src[i].f; 160 } 161 } 162 163 @Benchmark 164 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 165 public void Val_to_Int_copy(ValState s, IntState d) { 166 ValWrapper[] src = s.arr; 167 IntWrapper[] dst = d.arr; 168 for (int i = 0; i < src.length; i++) { 169 dst[i].f = src[i].f; 170 } 171 } 172 173 @Benchmark 174 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 175 public void Val_to_Ref_copy(ValState s, RefState d) { 176 ValWrapper[] src = s.arr; 177 RefWrapper[] dst = d.arr; 178 for (int i = 0; i < src.length; i++) { 179 dst[i].f = src[i].f; 180 } 181 } 182 183 @Benchmark 184 @CompilerControl(CompilerControl.Mode.DONT_INLINE) 185 public void Val_to_Val_copy(ValState s, ValState d) { 186 ValWrapper[] src = s.arr; 187 ValWrapper[] dst = d.arr; 188 for (int i = 0; i < src.length; i++) { 189 dst[i].f = src[i].f; 190 } 191 } 192 193 194 }