/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ // This file contains multiple illegal value type classes that should cause // ClassFormatError exceptions when attempted to be loaded. // // The .jcod classes were originally generated from this Java file and then // modified to cause ClassFormatError or ClassCircularityError exceptions. The // '(bad)' comments in most of the tests show where the modifications were made. // // final __ByValue class Value { // static final Value VT = makeValue(0x01234567); // final int int_v; // Value() { // int_v = 1; // } // static Value makeValue(int x) { // Value v = __MakeDefault Value(); // v = __WithField(v.int_v, x); // return v; // } // } ////////////////////////////////////////////////////////////////////// // Test that a defaultvalue opcodes causes a VerifyError exception if // -XX:+EnableValhalla is not specified. // class HasDefaultvalue { 0xCAFEBABE; 0; // minor version 55; // version [28] { // Constant Pool ; // first element is empty Method #7 #23; // #1 at 0x0A Field #3 #24; // #2 at 0x0F class #9; // #3 at 0x14 int 0x01234567; // #4 at 0x17 Method #3 #25; // #5 at 0x1C Field #3 #26; // #6 at 0x21 class #27; // #7 at 0x26 Utf8 "VT"; // #8 at 0x29 Utf8 "HasDefaultvalue"; // #9 at 0x2E Utf8 "ValueTypes"; // #10 at 0x36 Utf8 "LHasDefaultvalue;"; // #11 at 0x43 Utf8 "int_v"; // #12 at 0x4D Utf8 "I"; // #13 at 0x55 Utf8 ""; // #14 at 0x59 Utf8 "()V"; // #15 at 0x62 Utf8 "Code"; // #16 at 0x68 Utf8 "LineNumberTable"; // #17 at 0x6F Utf8 "makeHasDefaultvalue"; // #18 at 0x81 Utf8 "(I)LHasDefaultvalue;"; // #19 at 0x8D Utf8 ""; // #20 at 0x9A Utf8 "SourceFile"; // #21 at 0xA5 Utf8 "HasDefaultvalue.java"; // #22 at 0xB2 NameAndType #14 #15; // #23 at 0xBF NameAndType #12 #13; // #24 at 0xC4 NameAndType #18 #19; // #25 at 0xC9 NameAndType #8 #11; // #26 at 0xCE Utf8 "java/lang/Object"; // #27 at 0xD3 } // Constant Pool 0x0130; // access [ ACC_VALUE ACC_SUPER ACC_FINAL ] #3;// this_cpx #7;// super_cpx [0] { // Interfaces } // Interfaces [2] { // fields { // Member at 0xF0 0x0118; // access #8; // name_cpx #11; // sig_cpx [0] { // Attributes } // Attributes } // Member ; { // Member at 0xF8 0x0010; // access [ ACC_FINAL ] #12; // name_cpx #13; // sig_cpx [0] { // Attributes } // Attributes } // Member } // fields [3] { // methods { // Member at 0x0102 0x0000; // access #14; // name_cpx #15; // sig_cpx [1] { // Attributes Attr(#16, 42) { // Code at 0x010A 2; // max_stack 1; // max_locals Bytes[10]{ 0x2AB700012A04B500; 0x02B1; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 14) { // LineNumberTable at 0x0126 [3] { // LineNumberTable 0 4; // at 0x0132 4 5; // at 0x0136 9 6; // at 0x013A } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member at 0x013A 0x0008; // access #18; // name_cpx #19; // sig_cpx [1] { // Attributes Attr(#16, 44) { // Code at 0x0142 2; // max_stack 2; // max_locals Bytes[12]{ 0xCB00034C2B1ACC00; 0x024C2BB0; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 14) { // LineNumberTable at 0x0160 [3] { // LineNumberTable 0 8; // at 0x016C 4 9; // at 0x0170 10 10; // at 0x0174 } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member at 0x0174 0x0008; // access #20; // name_cpx #15; // sig_cpx [1] { // Attributes Attr(#16, 33) { // Code at 0x017C 1; // max_stack 0; // max_locals Bytes[9]{ 0x1204B80005B30006; 0xB1; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 6) { // LineNumberTable at 0x0197 [1] { // LineNumberTable 0 2; // at 0x01A3 } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [2] { // Attributes Attr(#21, 2) { // SourceFile at 0x01A5 #22; } // end SourceFile ; Attr(#10, 4) { // ValueTypes at 0x01AD 0x00010003; } // end ValueTypes } // Attributes } ////////////////////////////////////////////////////////////////////// // Test that a withfield opcode causes a VerifyError exception if // -XX:+EnableValhalla is not specified. // class HasWithfield { 0xCAFEBABE; 0; // minor version 55; // version [28] { // Constant Pool ; // first element is empty Method #7 #23; // #1 at 0x0A Field #3 #24; // #2 at 0x0F class #9; // #3 at 0x14 int 0x01234567; // #4 at 0x17 Method #3 #25; // #5 at 0x1C Field #3 #26; // #6 at 0x21 class #27; // #7 at 0x26 Utf8 "VT"; // #8 at 0x29 Utf8 "HasWithfield"; // #9 at 0x2E Utf8 "ValueTypes"; // #10 at 0x36 Utf8 "LHasWithfield;"; // #11 at 0x43 Utf8 "int_v"; // #12 at 0x4D Utf8 "I"; // #13 at 0x55 Utf8 ""; // #14 at 0x59 Utf8 "()V"; // #15 at 0x62 Utf8 "Code"; // #16 at 0x68 Utf8 "LineNumberTable"; // #17 at 0x6F Utf8 "makeHasWithfield"; // #18 at 0x81 Utf8 "(I)LHasWithfield;"; // #19 at 0x8D Utf8 ""; // #20 at 0x9A Utf8 "SourceFile"; // #21 at 0xA5 Utf8 "HasWithfield.java"; // #22 at 0xB2 NameAndType #14 #15; // #23 at 0xBF NameAndType #12 #13; // #24 at 0xC4 NameAndType #18 #19; // #25 at 0xC9 NameAndType #8 #11; // #26 at 0xCE Utf8 "java/lang/Object"; // #27 at 0xD3 } // Constant Pool 0x0130; // access [ ACC_VALUE ACC_SUPER ACC_FINAL ] #3;// this_cpx #7;// super_cpx [0] { // Interfaces } // Interfaces [2] { // fields { // Member at 0xF0 0x0118; // access #8; // name_cpx #11; // sig_cpx [0] { // Attributes } // Attributes } // Member ; { // Member at 0xF8 0x0010; // access [ ACC_FINAL ] #12; // name_cpx #13; // sig_cpx [0] { // Attributes } // Attributes } // Member } // fields [3] { // methods { // Member at 0x0102 0x0000; // access #14; // name_cpx #15; // sig_cpx [1] { // Attributes Attr(#16, 42) { // Code at 0x010A 2; // max_stack 1; // max_locals Bytes[10]{ 0x2AB700012A04B500; 0x02B1; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 14) { // LineNumberTable at 0x0126 [3] { // LineNumberTable 0 4; // at 0x0132 4 5; // at 0x0136 9 6; // at 0x013A } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member at 0x013A 0x0008; // access #18; // name_cpx #19; // sig_cpx [1] { // Attributes Attr(#16, 44) { // Code at 0x0142 2; // max_stack 2; // max_locals Bytes[12]{ 0xCC00034C2B1ACC00; // Change defaultvalue (oxCB) to withfield (0xCC) 0x024C2BB0; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 14) { // LineNumberTable at 0x0160 [3] { // LineNumberTable 0 8; // at 0x016C 4 9; // at 0x0170 10 10; // at 0x0174 } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member ; { // Member at 0x0174 0x0008; // access #20; // name_cpx #15; // sig_cpx [1] { // Attributes Attr(#16, 33) { // Code at 0x017C 1; // max_stack 0; // max_locals Bytes[9]{ 0x1204B80005B30006; 0xB1; }; [0] { // Traps } // end Traps [1] { // Attributes Attr(#17, 6) { // LineNumberTable at 0x0197 [1] { // LineNumberTable 0 2; // at 0x01A3 } } // end LineNumberTable } // Attributes } // end Code } // Attributes } // Member } // methods [2] { // Attributes Attr(#21, 2) { // SourceFile at 0x01A5 #22; } // end SourceFile ; Attr(#10, 4) { // ValueTypes at 0x01AD 0x00010003; } // end ValueTypes } // Attributes } // end class HasWithfield