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.util;
 24 
 25 import org.openjdk.bench.valhalla.types.Int32;
 26 import org.openjdk.bench.valhalla.types.Q32int;
 27 import org.openjdk.bench.valhalla.util.SizeBase;
 28 import org.openjdk.jmh.annotations.Setup;
 29 
 30 public class StatesQ32int extends SizeBase {
 31 
 32     public static class ObjWrapper {
 33         public Object f;
 34 
 35         public ObjWrapper(Object f) {
 36             this.f = f;
 37         }
 38     }
 39 
 40     public static class ObjState extends SizeState {
 41         public ObjWrapper[] arr;
 42         @Setup
 43         public void setup() {
 44             arr = new ObjWrapper[size];
 45             for (int i = 0; i < arr.length; i++) {
 46                 arr[i] = new ObjWrapper(new Q32int(i));
 47             }
 48         }
 49     }
 50 
 51     public static class IntWrapper {
 52         public Int32 f;
 53 
 54         public IntWrapper(Int32 f) {
 55             this.f = f;
 56         }
 57     }
 58 
 59     public static class IntState extends SizeState {
 60         public IntWrapper[] arr;
 61         @Setup
 62         public void setup() {
 63             arr = new IntWrapper[size];
 64             for (int i = 0; i < arr.length; i++) {
 65                 arr[i] = new IntWrapper(new Q32int(i));
 66             }
 67         }
 68     }
 69 
 70 
 71     public static class RefWrapper {
 72         public Q32int f;
 73 
 74         public RefWrapper(Q32int f) {
 75             this.f = f;
 76         }
 77     }
 78 
 79     public static class RefState extends SizeState {
 80         public RefWrapper[] arr;
 81         @Setup
 82         public void setup() {
 83             arr = new RefWrapper[size];
 84             for (int i = 0; i < arr.length; i++) {
 85                 arr[i] = new RefWrapper(new Q32int(i));
 86             }
 87         }
 88     }
 89 
 90 
 91     public static class ValWrapper {
 92         public Q32int f;
 93 
 94         public ValWrapper(Q32int f) {
 95             this.f = f;
 96         }
 97     }
 98 
 99     public static class ValState extends SizeState {
100         public ValWrapper[] arr;
101         @Setup
102         public void setup() {
103             arr = new ValWrapper[size];
104             for (int i = 0; i < arr.length; i++) {
105                 arr[i] = new ValWrapper(new Q32int(i));
106             }
107         }
108     }
109 
110 
111 }