< prev index next >

test/hotspot/jtreg/runtime/whitebox/WBStackSize.java

Print this page
rev 49527 : 8198756: Lazy allocation of compiler threads
Reviewed-by: kvn


  65         if (stackSizeOnOverflow > MIN_STACK_SIZE) {
  66 
  67             try {
  68                 testStackOverflow();
  69             } catch (StackOverflowError e) {
  70                 // We caught SOE too early. The error will be reported in main()
  71             }
  72 
  73         } else {
  74 
  75             try {
  76                 eatAllStack();
  77                 throw new RuntimeException("Haven't caught StackOverflowError at all");
  78             } catch (StackOverflowError e) {
  79                 // OK: we caught the anticipated error
  80             }
  81         }
  82     }
  83 
  84     public static void main(String[] args) {
  85         long configStackSize = wb.getIntxVMFlag("ThreadStackSize") * K;


  86         System.out.println("ThreadStackSize VM option: " + configStackSize);
  87 
  88         long stackProtectionSize = wb.getIntxVMFlag("StackShadowPages") * wb.getVMPageSize();
  89         System.out.println("Size of protected shadow pages: " + stackProtectionSize);
  90 
  91         long actualStackSize = wb.getThreadStackSize();
  92         System.out.println("Full stack size: " + actualStackSize);
  93 
  94         if (Math.abs(actualStackSize - configStackSize) > configStackSize * 0.1) {
  95             throw new RuntimeException("getThreadFullStackSize value [" + actualStackSize
  96                                      + "] should be within 90%..110% of the value returned by HotSpotDiagnosticMXBean");
  97         }
  98 
  99         long remainingStackSize = wb.getThreadRemainingStackSize();
 100         System.out.println("Remaining stack size in main(): " + remainingStackSize);
 101 
 102         // Up to 150k can be already allocated by VM and some space is used for stack protection.
 103         long spaceAlreadyOccupied = MAX_STACK_SIZE_ALLOCATED_IN_MAIN + stackProtectionSize;
 104 
 105         if (remainingStackSize > configStackSize


  65         if (stackSizeOnOverflow > MIN_STACK_SIZE) {
  66 
  67             try {
  68                 testStackOverflow();
  69             } catch (StackOverflowError e) {
  70                 // We caught SOE too early. The error will be reported in main()
  71             }
  72 
  73         } else {
  74 
  75             try {
  76                 eatAllStack();
  77                 throw new RuntimeException("Haven't caught StackOverflowError at all");
  78             } catch (StackOverflowError e) {
  79                 // OK: we caught the anticipated error
  80             }
  81         }
  82     }
  83 
  84     public static void main(String[] args) {
  85         boolean isCompilerThread = Thread.currentThread().getName().indexOf(" CompilerThread") > 0;
  86         long configStackSize = isCompilerThread ? wb.getIntxVMFlag("CompilerThreadStackSize") * K
  87                                                 : wb.getIntxVMFlag("ThreadStackSize") * K;
  88         System.out.println("ThreadStackSize VM option: " + configStackSize);
  89 
  90         long stackProtectionSize = wb.getIntxVMFlag("StackShadowPages") * wb.getVMPageSize();
  91         System.out.println("Size of protected shadow pages: " + stackProtectionSize);
  92 
  93         long actualStackSize = wb.getThreadStackSize();
  94         System.out.println("Full stack size: " + actualStackSize);
  95 
  96         if (Math.abs(actualStackSize - configStackSize) > configStackSize * 0.1) {
  97             throw new RuntimeException("getThreadFullStackSize value [" + actualStackSize
  98                                      + "] should be within 90%..110% of the value returned by HotSpotDiagnosticMXBean");
  99         }
 100 
 101         long remainingStackSize = wb.getThreadRemainingStackSize();
 102         System.out.println("Remaining stack size in main(): " + remainingStackSize);
 103 
 104         // Up to 150k can be already allocated by VM and some space is used for stack protection.
 105         long spaceAlreadyOccupied = MAX_STACK_SIZE_ALLOCATED_IN_MAIN + stackProtectionSize;
 106 
 107         if (remainingStackSize > configStackSize
< prev index next >