< prev index next >

test/hotspot/jtreg/runtime/Thread/TooSmallStackSize.java

Print this page


   1 /*
   2  * Copyright (c) 2016, 2019, 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  */


 170         checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "16");
 171 
 172         /*
 173          * Try with a 64k stack size, which is the size that the launcher will
 174          * set to if you try setting to anything smaller. This should produce the same
 175          * result as setting to 16k if the fix for 6762191 is in place.
 176          */
 177         String min_stack_allowed = checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "64");
 178 
 179         /*
 180          * Try again with a the minimum stack size that was given in the error message
 181          */
 182         checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, min_stack_allowed);
 183 
 184         /*
 185          * Now try with a stack size that is not page aligned.
 186          */
 187         checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, "513");
 188 
 189         /*
 190          * Try with 0k which indicates that the default thread stack size from JVM will be used.
 191          */
 192         checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, "0");
 193 
 194         /*
 195          * Now redo the same tests with the compiler thread stack size:
 196          */
 197         checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "16");
 198         min_stack_allowed = checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "64");
 199         checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, min_stack_allowed);
 200         checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "513");
 201         checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "0");
 202 
 203         /*
 204          * Now redo the same tests with the VM thread stack size:
 205          */
 206         checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "16");
 207         min_stack_allowed = checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "64");
 208         checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, min_stack_allowed);
 209         checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, "513");
 210         checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, "0");
 211     }
 212 }
   1 /*
   2  * Copyright (c) 2016, 2017, 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  */


 170         checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "16");
 171 
 172         /*
 173          * Try with a 64k stack size, which is the size that the launcher will
 174          * set to if you try setting to anything smaller. This should produce the same
 175          * result as setting to 16k if the fix for 6762191 is in place.
 176          */
 177         String min_stack_allowed = checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "64");
 178 
 179         /*
 180          * Try again with a the minimum stack size that was given in the error message
 181          */
 182         checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, min_stack_allowed);
 183 
 184         /*
 185          * Now try with a stack size that is not page aligned.
 186          */
 187         checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, "513");
 188 
 189         /*





 190          * Now redo the same tests with the compiler thread stack size:
 191          */
 192         checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "16");
 193         min_stack_allowed = checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "64");
 194         checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, min_stack_allowed);
 195         checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "513");

 196 
 197         /*
 198          * Now redo the same tests with the VM thread stack size:
 199          */
 200         checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "16");
 201         min_stack_allowed = checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "64");
 202         checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, min_stack_allowed);
 203         checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, "513");

 204     }
 205 }
< prev index next >