United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6519515 Loop-opts incorrectly removed a safepoint poll from a loop with an early exit
JDK-6519515 : Loop-opts incorrectly removed a safepoint poll from a loop with an early exit

Details
Type:
Bug
Submit Date:
2007-01-31
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
solaris_9,linux,windows_xp
Sub-Component:
compiler
CPU:
x86,sparc
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0,5.0u12
Fixed Versions:
hs11 (b04)

Related Reports
Backport:
Backport:
Backport:
Backport:
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
Safepoint incorrectly removed from loop L2
   L1: loop
    L2: loop
      safepoint
      if test goto L1
      call xx
    endloop L2
  endloop L1

See method Starve9B::Starvee in attachment.

Instructions for running:

/java/re/jdk/1.6.0/latest/binaries/solaris-sparc/bin/java -server Starve9B
 /java/re/jdk/1.5.0_10/latest/binaries/solaris-sparc/bin/java -server Starve9B

Simply run the program with no arguments.  Wait for about a minute.  It'll
report some meaningless information on stdout which you should ignore (residual
code from the program's original intended task of tracking down a solaris
scheduling issue that results in LWP starvation).  Enter CTRL-c.  The program
should hang and not exit.  You'll need to use kill -9 to get rid of it.
Another simple test case will soon be found in the j2se workspace, under:

    j2se/test/sun/security/ssl/SSLEngineImpl/SSLEngineDeadlock.java

Simply remove the Thread.yield() line in the doTask() method, and let it run in c2.  Should fail after 10-70 iterations.

                                    

Comments
EVALUATION

Safepoint is removed by code in
 file loopnode.cpp @ line 2106
in method build_loop_early.
                                     
2007-01-31
EVALUATION

The function check_inner_safepts() marks a loop with _has_sfpt if a safepoint is found that dominates the loop's tail.  This check is insufficient to ensure that the safepoint is encountered on each iteration since a loop may have multiple exits, some of which do not go through the tail.  If we want to fix the bug by correcting check_inner_safepts(), C2 must check that a safepoint dominates every loop exit.
                                     
2007-03-22
SUGGESTED FIX

/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070731085637.nips.bug6519515/
Webrev:                 http://prt-web.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070731085637.nips.bug6519515/workspace/webrevs/webrev-2007.07.31/index.html
                                     
2007-07-31



Hardware and Software, Engineered to Work Together