annotate test/runtime/memory/MultiAllocateNullCheck.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 efe8b7d64424
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10379
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
1 /*
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
4 *
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
7 * published by the Free Software Foundation.
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
8 *
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
13 * accompanied this code).
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
14 *
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
18 *
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
21 * questions.
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
22 */
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
23
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
24 /*
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
25 * @test MultiAllocateNullCheck
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
26 * @bug 6726963
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
27 * @summary multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
28 * @run main/othervm -Xmx32m MultiAllocateNullCheck
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
29 */
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
30
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
31 import java.lang.reflect.Array;
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
32
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
33 public class MultiAllocateNullCheck {
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
34 public static void main(String[] args) throws Exception {
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
35 Object x = null;
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
36 try
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
37 {
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
38 x = Array.newInstance(String.class, new int[]
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
39 {Integer.MAX_VALUE, Integer.MAX_VALUE});
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
40 System.out.println("Array was created");
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
41 } catch (OutOfMemoryError e) {
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
42 System.out.println("Out of memory occured, which is OK in this case");
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
43 }
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
44 }
efe8b7d64424 6726963: multi_allocate() call does not CHECK_NULL and causes crash in fastdebug bits
ctornqvi
parents:
diff changeset
45 }