1 /* 2 * Copyright (c) 2018, 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 * This test contains ldc_w instructions of condy's who generate dynamic constants 26 * of the following types: byte, char, short, int, float, boolean. 27 */ 28 super class CondyUseLDC_W 29 version 55:0 30 { 31 32 public Method "<init>":"()V" 33 stack 1 locals 1 34 { 35 aload_0; 36 invokespecial Method java/lang/Object."<init>":"()V"; 37 return; 38 } 39 40 public static Method intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;" 41 throws java/lang/Throwable 42 stack 4 locals 6 43 { 44 aload_1; 45 astore 4; 46 iconst_m1; 47 istore 5; 48 aload 4; 49 invokevirtual Method java/lang/String.hashCode:"()I"; 50 lookupswitch{ //11 51 -2001159796: L238; 52 -1538095928: L272; 53 -891985903: L255; 54 66: L108; 55 67: L124; 56 68: L140; 57 70: L156; 58 73: L172; 59 74: L188; 60 83: L204; 61 90: L221; 62 default: L286 }; 63 L108: stack_frame_type append; 64 locals_map class java/lang/String, int; 65 aload 4; 66 ldc String "B"; 67 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 68 ifeq L286; 69 iconst_0; 70 istore 5; 71 goto L286; 72 L124: stack_frame_type same; 73 aload 4; 74 ldc String "C"; 75 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 76 ifeq L286; 77 iconst_1; 78 istore 5; 79 goto L286; 80 L140: stack_frame_type same; 81 aload 4; 82 ldc String "D"; 83 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 84 ifeq L286; 85 iconst_2; 86 istore 5; 87 goto L286; 88 L156: stack_frame_type same; 89 aload 4; 90 ldc String "F"; 91 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 92 ifeq L286; 93 iconst_3; 94 istore 5; 95 goto L286; 96 L172: stack_frame_type same; 97 aload 4; 98 ldc String "I"; 99 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 100 ifeq L286; 101 iconst_4; 102 istore 5; 103 goto L286; 104 L188: stack_frame_type same; 105 aload 4; 106 ldc String "J"; 107 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 108 ifeq L286; 109 iconst_5; 110 istore 5; 111 goto L286; 112 L204: stack_frame_type same; 113 aload 4; 114 ldc String "S"; 115 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 116 ifeq L286; 117 bipush 6; 118 istore 5; 119 goto L286; 120 L221: stack_frame_type same; 121 aload 4; 122 ldc String "Z"; 123 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 124 ifeq L286; 125 bipush 7; 126 istore 5; 127 goto L286; 128 L238: stack_frame_type same; 129 aload 4; 130 ldc String "nullRef"; 131 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 132 ifeq L286; 133 bipush 8; 134 istore 5; 135 goto L286; 136 L255: stack_frame_type same; 137 aload 4; 138 ldc String "string"; 139 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 140 ifeq L286; 141 bipush 9; 142 istore 5; 143 goto L286; 144 L272: stack_frame_type same; 145 aload 4; 146 ldc String "stringArray"; 147 invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; 148 ifeq L286; 149 bipush 10; 150 istore 5; 151 L286: stack_frame_type same; 152 iload 5; 153 tableswitch{ //0 to 10 154 0: L348; 155 1: L354; 156 2: L360; 157 3: L366; 158 4: L372; 159 5: L377; 160 6: L383; 161 7: L389; 162 8: L402; 163 9: L404; 164 10: L407; 165 default: L422 }; 166 L348: stack_frame_type same; 167 iload_3; 168 i2b; 169 invokestatic Method java/lang/Byte.valueOf:"(B)Ljava/lang/Byte;"; 170 areturn; 171 L354: stack_frame_type same; 172 iload_3; 173 i2c; 174 invokestatic Method java/lang/Character.valueOf:"(C)Ljava/lang/Character;"; 175 areturn; 176 L360: stack_frame_type same; 177 iload_3; 178 i2d; 179 invokestatic Method java/lang/Double.valueOf:"(D)Ljava/lang/Double;"; 180 areturn; 181 L366: stack_frame_type same; 182 iload_3; 183 i2f; 184 invokestatic Method java/lang/Float.valueOf:"(F)Ljava/lang/Float;"; 185 areturn; 186 L372: stack_frame_type same; 187 iload_3; 188 invokestatic Method java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;"; 189 areturn; 190 L377: stack_frame_type same; 191 iload_3; 192 i2l; 193 invokestatic Method java/lang/Long.valueOf:"(J)Ljava/lang/Long;"; 194 areturn; 195 L383: stack_frame_type same; 196 iload_3; 197 i2s; 198 invokestatic Method java/lang/Short.valueOf:"(S)Ljava/lang/Short;"; 199 areturn; 200 L389: stack_frame_type same; 201 iload_3; 202 ifle L397; 203 iconst_1; 204 goto L398; 205 L397: stack_frame_type same; 206 iconst_0; 207 L398: stack_frame_type stack1; 208 stack_map int; 209 invokestatic Method java/lang/Boolean.valueOf:"(Z)Ljava/lang/Boolean;"; 210 areturn; 211 L402: stack_frame_type same; 212 aconst_null; 213 areturn; 214 L404: stack_frame_type same; 215 ldc String "string"; 216 areturn; 217 L407: stack_frame_type same; 218 iconst_2; 219 anewarray class java/lang/String; 220 dup; 221 iconst_0; 222 ldc String "string"; 223 aastore; 224 dup; 225 iconst_1; 226 ldc String "string"; 227 aastore; 228 areturn; 229 L422: stack_frame_type same; 230 new class java/lang/BootstrapMethodError; 231 dup; 232 ldc String "Failure to generate a dynamic constant"; 233 invokespecial Method java/lang/BootstrapMethodError."<init>":"(Ljava/lang/String;)V"; 234 athrow; 235 } 236 237 public static Method B:"()B" 238 stack 1 locals 0 239 { 240 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":B:"B" int 127; 241 ireturn; 242 } 243 244 public static Method C:"()C" 245 stack 1 locals 0 246 { 247 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":C:"C" int 65535; 248 ireturn; 249 } 250 251 public static Method F:"()F" 252 stack 1 locals 0 253 { 254 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":F:"F" int 2147483647; 255 freturn; 256 } 257 258 public static Method F_AsType:"()F" 259 stack 1 locals 0 260 { 261 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":I:"F" int 2147483647; 262 freturn; 263 } 264 265 public static Method I:"()I" 266 stack 1 locals 0 267 { 268 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":I:"I" int 2147483647; 269 ireturn; 270 } 271 272 public static Method S:"()S" 273 stack 1 locals 0 274 { 275 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":S:"S" int 32767; 276 ireturn; 277 } 278 279 public static Method Z_F:"()Z" 280 stack 1 locals 0 281 { 282 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":Z:"Z" int 0; 283 ireturn; 284 } 285 286 public static Method Z_T:"()Z" 287 stack 1 locals 0 288 { 289 ldc_w Dynamic REF_invokeStatic:CondyUseLDC_W.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":Z:"Z" int 1; 290 ireturn; 291 } 292 293 public static Method main:"([Ljava/lang/String;)V" 294 stack 8 locals 1 295 { 296 invokestatic Method B:"()B"; 297 invokestatic Method C:"()C"; 298 invokestatic Method S:"()S"; 299 invokestatic Method F:"()F"; 300 invokestatic Method F_AsType:"()F"; 301 invokestatic Method Z_F:"()Z"; 302 invokestatic Method Z_T:"()Z"; 303 invokestatic Method I:"()I"; 304 return; 305 } 306 307 } // end Class CondyUseLDC_W