United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4864683 default CompilerThreadStackSize computation too small in 64bit sparc VM
JDK-4864683 : default CompilerThreadStackSize computation too small in 64bit sparc VM

Details
Type:
Bug
Submit Date:
2003-05-15
Status:
Resolved
Updated Date:
2004-04-07
Project Name:
JDK
Resolved Date:
2003-06-05
Component:
hotspot
OS:
solaris_8
Sub-Component:
compiler
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2
Fixed Versions:
1.4.2_05 (05)

Related Reports
Backport:
Relates:

Sub Tasks

Description
Name: cl74495			Date: 05/15/2003


In a 64 bit VM built from 1.4.1.02 sources, I am running out of thread
stack in PhaseCFG::set_pinned , with a recursion depth of about 2800

In the 1.4.1.02 hotspot sources, in os_solaris.cpp there is this code

    768 #ifdef COMPILER2
    769   // Compiler2 requires a large stack size to handle recursive routines.
    770   else if (thr_type == compiler_thread) {
    771     // stack size in units of Kbytes; 2M total needed as default.
    772     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 2 * K;
    773     stack_size = MAX2((size_t)(default_size * K), os::Solaris::min_stack_allowed);
    774   }
    775 #endif


I think the default_size computation
needs adjustment for 64 bit VMs, if you intend for a 64 bit compiler2 to
be able to have as many levels of recursion as a 32 bit compiler2 .

Perhaps something like this:
     
#ifdef _LP64
     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 4 * K;
#else
     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 2 * K;
endif

The 1.4.2 beta 22 sources appear to have the same code in this area and
would need the same fix.
(Review ID: 185729) 
======================================================================

                                    

Comments
SUGGESTED FIX

###@###.### 2004-03-03

The fix diffs:

src/os/solaris/vm/os_solaris.cpp

*** 858,865 ****
  #ifdef COMPILER2
    // Compiler2 requires a large stack size to handle recursive routines.
    else if (thr_type == compiler_thread) {
!     // stack size in units of Kbytes; 2M total needed as default.
!     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 2 * K;
      stack_size = MAX2((size_t)(default_size * K), os::Solaris::min_stack_allowed);
    }
  #endif
--- 858,865 ----
  #ifdef COMPILER2
    // Compiler2 requires a large stack size to handle recursive routines.
    else if (thr_type == compiler_thread) {
!     // stack size in units of Kbytes; 2M (4M for LP64) total needed as default.
!     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : (BytesPerWord >> 1) * K;
      stack_size = MAX2((size_t)(default_size * K), os::Solaris::min_stack_allowed);
    }
  #endif

src/os_cpu/linux_ia64/vm/os_linux_ia64.cpp
*** 545,552 ****
  #ifdef COMPILER2
    // Compiler2 requires a large stack size to handle recursive routines.
    else if (thr_type == compiler_thread) {
!     // stack size in units of Kbytes; 2M total needed as default.
!     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 2 * K;
      stack_size = MAX2((size_t)(default_size * K), os::Linux::min_stack_allowed);
    }
  #endif
--- 545,552 ----
  #ifdef COMPILER2
    // Compiler2 requires a large stack size to handle recursive routines.
    else if (thr_type == compiler_thread) {
!     // stack size in units of Kbytes; 4M total needed as default for ia64.
!     int default_size = (CompilerThreadStackSize > 0) ? CompilerThreadStackSize : 4 * K;
      stack_size = MAX2((size_t)(default_size * K), os::Linux::min_stack_allowed);
    }
  #endif
                                     
2004-06-11
WORK AROUND

Name: cl74495			Date: 05/15/2003


Use -XX:CompilerThreadStackSize to adjust the stack size
======================================================================
                                     
2004-06-11
EVALUATION

###@###.### 2003-05-15

Stack overflow in PhaseCFG::set_pinned() has been fixed in tiger by using an 
iterative implementation.  However, this bug applies generally to all 64-bit 
compilation in that the compilation thread's default stack size should be scaled 
up from the default value for 32-bit execution.

Due to scheduling constraints, and the existence of a command-line workaround, 
this will not be fixed in mantis.
-----
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_05
generic
tiger

FIXED IN:
1.4.2_05
tiger

INTEGRATED IN:
1.4.2_05
tiger
tiger-b08


                                     
2004-06-14



Hardware and Software, Engineered to Work Together