hotspot/test/runtime/InitialThreadOverflow/DoOverflow.java
author weijun
Thu, 08 May 2014 22:30:24 +0800
changeset 24270 12b6bc57472d
parent 19694 84bcddefd0d7
permissions -rw-r--r--
8040068: SolarisSystem should be @Deprecated and @jdk.Exported(false) Reviewed-by: alanb, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19694
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     1
/*
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     4
 *
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     7
 * published by the Free Software Foundation.
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     8
 *
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    13
 * accompanied this code).
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    14
 *
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    18
 *
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    21
 * questions.
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    22
 */
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    23
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    24
public class DoOverflow {
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    25
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    26
    static int count;
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    27
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    28
    public void overflow() {
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    29
        count+=1;
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    30
        overflow();
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    31
    }
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    32
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    33
    public static void printIt() {
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    34
        System.out.println("Going to overflow stack");
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    35
        try {
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    36
            new DoOverflow().overflow();
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    37
        } catch(java.lang.StackOverflowError e) {
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    38
            System.out.println("Overflow OK " + count);
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    39
        }
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    40
    }
84bcddefd0d7 8009062: poor performance of JNI AttachCurrentThread after fix for 7017193
dsamersoff
parents:
diff changeset
    41
}