annotate test/compiler/7116216/StackOverflow.java @ 6842:b9a9ed0f8eeb

7197424: update copyright year to match last edit in jdk8 hotspot repository Summary: Update copyright year to 2012 for relevant files Reviewed-by: dholmes, coleenp
author mikael
date Tue, 09 Oct 2012 10:09:34 -0700
parents 35acf8f0a2e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4743
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
1 /*
6842
b9a9ed0f8eeb 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 4778
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
4743
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
4 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
7 * published by the Free Software Foundation.
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
8 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
13 * accompanied this code).
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
14 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
18 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
21 * questions.
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
22 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
23 */
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
24
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
25 /**
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
26 * @test
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
27 * @bug 7116216
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
28 * @summary The vm crashes when GC happens during throwing a StackOverflow exception
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
29 *
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
30 * @run main/othervm -Xcomp -Xbatch StackOverflow
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
31 */
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
32
4778
35acf8f0a2e4 7128352: assert(obj_node == obj) failed
kvn
parents: 4743
diff changeset
33 public class StackOverflow {
4743
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
34 static String stackOverflow_largeFrame_liveOopForGC;
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
35
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
36 public static int stackOverflow_largeFrame(int call_count, String liveOopForGC) {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
37 try {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
38 int return_count = stackOverflow_largeFrame(++call_count, liveOopForGC);
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
39 if (return_count == 0) {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
40 try {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
41 LargeFrame.method_with_many_locals(liveOopForGC, 2,3,4,5,6,7,liveOopForGC);
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
42 } catch (StackOverflowError e2) {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
43 // access liveOopForGC to make it a live variable
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
44 stackOverflow_largeFrame_liveOopForGC = liveOopForGC;
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
45 }
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
46 }
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
47 return return_count - 1;
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
48 } catch (StackOverflowError e) {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
49 // Return a value that is large enough such that no unrecoverable
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
50 // stack overflow will occur afterwards, but that is small enough
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
51 // such that calling LargeFrame.method_with_many_locals() will
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
52 // cause a StackOverflowError.
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
53 // Don't use a call here because we're out of stack space anyway!
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
54 int tmp = call_count / 2;
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
55 return (tmp < 100 ? tmp : 100);
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
56 }
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
57 }
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
58 public static void main(String args[]) {
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
59 LargeFrame.method_with_many_locals(new Object(), 2,3,4,5,6,7,new Object());
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
60
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
61 stackOverflow_largeFrame(0, "this is a live oop to test GC");
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
62 System.out.println("finished ok!");
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
63 }
dca455dea3a7 7116216: StackOverflow GC crash
bdelsart
parents:
diff changeset
64 }