JDK-6761594 : framesize rounding code rounds using wrong units leading to slightly oversized frames
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2008-10-20
  • Updated: 2010-04-02
  • Resolved: 2008-11-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u14Fixed 7Fixed hs14Fixed
Description
I believe that I have found a minor bug in the framesize calculation in chaitin.cpp:
 
  // Convert that to a frame_slot number.
  if( _max_reg <= _matcher._new_SP )
    _framesize = C->out_preserve_stack_slots();
  else _framesize = _max_reg -_matcher._new_SP;
  assert((int)(_matcher._new_SP+_framesize) >= (int)_matcher._out_arg_limit, "framesize must be large enough");
 
  // This frame must preserve the required fp alignment
  const int stack_alignment_in_words = Matcher::stack_alignment_in_slots();
  if (stack_alignment_in_words > 0)
    _framesize = round_to(_framesize, Matcher::stack_alignment_in_bytes());
  assert( _framesize >= 0 && _framesize <= 1000000, "sanity check" );
 
The granularity of _framesize at this point is OptoReg slots and so should it be aligned to Matcher::stack_alignment_in_slots() instead of Matcher::stack_alignment_in_bytes()? This is causing the minimum framesize on Itanium to be 80 bytes instead of 32 (2 words scratch, 1 word for the original_pc offset, and 1 word for alignment).

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/0bf25c4807f9
07-11-2008

SUGGESTED FIX diff --git a/src/share/vm/opto/chaitin.cpp b/src/share/vm/opto/chaitin.cpp --- a/src/share/vm/opto/chaitin.cpp +++ b/src/share/vm/opto/chaitin.cpp @@ -442,7 +442,7 @@ void PhaseChaitin::Register_Allocate() { // This frame must preserve the required fp alignment const int stack_alignment_in_words = Matcher::stack_alignment_in_slots(); if (stack_alignment_in_words > 0) - _framesize = round_to(_framesize, Matcher::stack_alignment_in_bytes()); + _framesize = round_to(_framesize, stack_alignment_in_words); assert( _framesize >= 0 && _framesize <= 1000000, "sanity check" ); #ifndef PRODUCT _total_framesize += _framesize;
20-10-2008

EVALUATION That's correct.
20-10-2008