1 /*
  2  * Copyright (c) 2022, 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  */
 24 
 25 public final primitive value class runtime/valhalla/inlinetypes/WithFieldPoint
 26     version 64:0
 27 {
 28 
 29     private final Field x:I;
 30     private final Field y:I;
 31 
 32     public static Method make:"(II)Qruntime/valhalla/inlinetypes/WithFieldPoint;"
 33         stack 4
 34     {
 35         aconst_init runtime/valhalla/inlinetypes/WithFieldPoint;
 36         dup;
 37         iconst_0;
 38         iconst_0;
 39         invokevirtual checkFields:"(II)V";
 40 
 41         iload_0;
 42         withfield x:I;
 43         dup;
 44         iload_0;
 45         iconst_0;
 46         invokevirtual checkFields:"(II)V";
 47 
 48         iload_1;
 49         withfield y:I;
 50         dup;
 51         iload_0;
 52         iload_1;
 53         invokevirtual checkFields:"(II)V";
 54 
 55         areturn;
 56     }
 57 
 58     public Method getX:"()I" stack 1 {
 59         aload_0;
 60         getfield x:I;
 61         ireturn;
 62     }
 63 
 64     public Method getY:"()I" stack 1 {
 65         aload_0;
 66         getfield y:I;
 67         ireturn;
 68     }
 69 
 70     public Method withX:"(I)Qruntime/valhalla/inlinetypes/WithFieldPoint;" stack 2 {
 71         aload_0;
 72         iload_1;
 73         withfield x:I;
 74         areturn;
 75     }
 76 
 77     public Method withY:"(I)Qruntime/valhalla/inlinetypes/WithFieldPoint;" stack 2 {
 78         aload_0;
 79         iload_1;
 80         withfield y:I;
 81         areturn;
 82     }
 83 
 84     public Method checkFields:"(II)V" stack 3 {
 85         aload_0;
 86         getfield x:I;
 87         invokestatic java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;";
 88         iload_1;
 89         invokestatic java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;";
 90         ldc "invalid x value";
 91         invokestatic jdk/test/lib/Asserts.assertEquals:"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/String;)V";
 92 
 93         aload_0;
 94         getfield y:I;
 95         invokestatic java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;";
 96         iload_2;
 97         invokestatic java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;";
 98         ldc "invalid y value";
 99         invokestatic jdk/test/lib/Asserts.assertEquals:"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/String;)V";
100 
101         return;
102     }
103 
104 }
105 
106 public final primitive value class runtime/valhalla/inlinetypes/AllTypes
107     version 64:0
108 {
109 
110     public final Field z:Z;
111     public final Field b:B;
112     public final Field s:S;
113     public final Field c:C;
114     public final Field i:I;
115     public final Field l:J;
116     public final Field f:F;
117     public final Field d:D;
118     public final Field o:"Ljava/lang/Object;";
119     public final Field p:"Qruntime/valhalla/inlinetypes/Point;";
120 
121     public Method set_z:"(Z)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
122         aload_0;
123         iload_1;
124         withfield z:Z;
125         areturn;
126     }
127 
128     public Method set_b:"(B)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
129         aload_0;
130         iload_1;
131         withfield b:B;
132         areturn;
133     }
134 
135     public Method set_s:"(S)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
136         aload_0;
137         iload_1;
138         withfield s:S;
139         areturn;
140     }
141 
142     public Method set_c:"(C)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
143         aload_0;
144         iload_1;
145         withfield c:C;
146         areturn;
147     }
148 
149     public Method set_i:"(I)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
150         aload_0;
151         iload_1;
152         withfield i:I;
153         areturn;
154     }
155 
156     public Method set_l:"(J)Qruntime/valhalla/inlinetypes/AllTypes;" stack 3 {
157         aload_0;
158         lload_1;
159         withfield l:J;
160         areturn;
161     }
162 
163     public Method set_f:"(F)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
164         aload_0;
165         fload_1;
166         withfield f:F;
167         areturn;
168     }
169 
170     public Method set_d:"(D)Qruntime/valhalla/inlinetypes/AllTypes;" stack 3 {
171         aload_0;
172         dload_1;
173         withfield d:D;
174         areturn;
175     }
176 
177     public Method set_o:"(Ljava/lang/Object;)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
178         aload_0;
179         aload_1;
180         withfield o:"Ljava/lang/Object;";
181         areturn;
182     }
183 
184     public Method set_p:"(Qruntime/valhalla/inlinetypes/Point;)Qruntime/valhalla/inlinetypes/AllTypes;" stack 2 {
185         aload_0;
186         aload_1;
187         withfield p:"Qruntime/valhalla/inlinetypes/Point;";
188         areturn;
189     }
190 
191 }