< prev index next >

test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java

Print this page

  1 /*
  2  * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */

223             long l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19;
224             long l20, l21, l22, l23, l24, l25, l26, l27, l28, l30, l31, l32, l33, l34, l35, l36, l37;
225             counter++;
226             try {
227                 recursiveCall();
228             } catch (StackOverflowError e) {
229             }
230             decounter--;
231             if (decounter == 0) {
232                 setupSOEFrame = counter;
233                 testStartFrame = counter - deframe;
234                 test.run();
235             }
236         }
237     }
238 
239     private static boolean isAlwaysSupportedPlatform() {
240         return Platform.isAix() ||
241             (Platform.isLinux() &&
242              (Platform.isPPC() || Platform.isS390x() || Platform.isX64() ||
243               Platform.isX86() || Platform.isAArch64())) ||
244             Platform.isOSX();
245     }
246 
247     private static boolean isNeverSupportedPlatform() {
248         return !isAlwaysSupportedPlatform();
249     }
250 
251     private static boolean isSupportedPlatform;
252 
253     private static void initIsSupportedPlatform() throws Exception {
254         // In order to dynamicaly determine if the platform supports the reserved
255         // stack area, run with -XX:StackReservedPages=1 and see if we get the
256         // expected warning message for platforms that don't support it.
257         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:StackReservedPages=1", "-version");
258         OutputAnalyzer output = new OutputAnalyzer(pb.start());
259         System.out.println("StackReservedPages=1 log: [" + output.getOutput() + "]");
260         if (output.getExitValue() != 0) {
261             String msg = "Could not launch with -XX:StackReservedPages=1: exit " + output.getExitValue();
262             System.err.println("FAILED: " + msg);
263             throw new RuntimeException(msg);

  1 /*
  2  * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */

223             long l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19;
224             long l20, l21, l22, l23, l24, l25, l26, l27, l28, l30, l31, l32, l33, l34, l35, l36, l37;
225             counter++;
226             try {
227                 recursiveCall();
228             } catch (StackOverflowError e) {
229             }
230             decounter--;
231             if (decounter == 0) {
232                 setupSOEFrame = counter;
233                 testStartFrame = counter - deframe;
234                 test.run();
235             }
236         }
237     }
238 
239     private static boolean isAlwaysSupportedPlatform() {
240         return Platform.isAix() ||
241             (Platform.isLinux() &&
242              (Platform.isPPC() || Platform.isS390x() || Platform.isX64() ||
243               Platform.isX86() || Platform.isAArch64() || Platform.isRiscv64())) ||
244             Platform.isOSX();
245     }
246 
247     private static boolean isNeverSupportedPlatform() {
248         return !isAlwaysSupportedPlatform();
249     }
250 
251     private static boolean isSupportedPlatform;
252 
253     private static void initIsSupportedPlatform() throws Exception {
254         // In order to dynamicaly determine if the platform supports the reserved
255         // stack area, run with -XX:StackReservedPages=1 and see if we get the
256         // expected warning message for platforms that don't support it.
257         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:StackReservedPages=1", "-version");
258         OutputAnalyzer output = new OutputAnalyzer(pb.start());
259         System.out.println("StackReservedPages=1 log: [" + output.getOutput() + "]");
260         if (output.getExitValue() != 0) {
261             String msg = "Could not launch with -XX:StackReservedPages=1: exit " + output.getExitValue();
262             System.err.println("FAILED: " + msg);
263             throw new RuntimeException(msg);
< prev index next >