annotate test/runtime/7160757/Test7160757.java @ 12690:c3bdd186e6cf

fix possible NPE in TruffleCompiler with TraceTruffleCompilation and background compilation enabled. With background compilation, the installed code can already be invalidated when compiledMethod.getCode() is called, in which case it returns null.
author Andreas Woess <andreas.woess@jku.at>
date Wed, 06 Nov 2013 13:31:28 +0100
parents d558e01a72c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6155
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
1 /*
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
4 *
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
7 * published by the Free Software Foundation.
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
8 *
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
13 * accompanied this code).
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
14 *
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
18 *
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
21 * questions.
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
22 */
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
23
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
24 /*
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
25 * @test Test7160757.java
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
26 * @bug 7160757
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
27 * @summary Tests that superclass initialization is not skipped
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
28 */
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
29
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
30 public class Test7160757 {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
31
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
32 public static void main(String args[]) throws Exception {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
33
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
34 ClassLoader loader = new SLoader();
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
35 try {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
36 Class.forName("S", true, loader);
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
37 System.out.println("FAILED");
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
38 throw new Exception("Should have thrown a VerifyError.");
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
39 } catch (VerifyError e) {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
40 System.out.println(e);
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
41 System.out.println("PASSED");
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
42 }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
43 }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
44
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
45 static class SLoader extends ClassLoader {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
46
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
47 /**
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
48 * public class S extends Throwable {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
49 * public S() {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
50 * aload_0
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
51 * invokespecial Object.<init>()
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
52 * return
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
53 * }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
54 * }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
55 */
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
56 static byte b(int i) { return (byte)i; }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
57 static byte S_class[] = {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
58 b(0xca), b(0xfe), b(0xba), b(0xbe), 0x00, 0x00, 0x00, 0x32,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
59 0x00, 0x0c, 0x0a, 0x00, 0x0b, 0x00, 0x07, 0x07,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
60 0x00, 0x08, 0x07, 0x00, 0x09, 0x01, 0x00, 0x06,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
61 0x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e, 0x01, 0x00,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
62 0x03, 0x28, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
63 0x6f, 0x64, 0x65, 0x0c, 0x00, 0x04, 0x00, 0x05,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
64 0x01, 0x00, 0x01, 0x53, 0x01, 0x00, 0x13, 0x6a,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
65 0x61, 0x76, 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
66 0x2f, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x61, 0x62,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
67 0x6c, 0x65, 0x01, 0x00, 0x10, 0x6a, 0x61, 0x76,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
68 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x4f,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
69 0x62, 0x6a, 0x65, 0x63, 0x74, 0x07, 0x00, 0x0a,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
70 0x00, 0x21, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
71 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
72 0x00, 0x05, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
73 0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
74 0x00, 0x05, 0x2a, b(0xb7), 0x00, 0x01, b(0xb1), 0x00,
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
75 0x00, 0x00, 0x00, 0x00, 0x00
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
76 };
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
77
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
78 public Class findClass(String name) throws ClassNotFoundException {
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
79 return defineClass(name, S_class, 0, S_class.length);
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
80 }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
81 }
d558e01a72c0 7160757: Problem with hotspot/runtime_classfile
kamg
parents:
diff changeset
82 }