Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6394462
Votes 1
Synopsis Hotspot prints "*** Unlock prevents locking optimization"
Category hotspot:compiler2
Reported Against
Release Fixed hs10(b03), 6u4(b03) (Bug ID:2171788) , 7(b03) (Bug ID:2176729)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 06-MAR-2006
Description
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta2-b74)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b74, mixed mode, sharing)


FULL OS VERSION :
 customer  Windows XP [Version 5.1.2600]


A DESCRIPTION OF THE PROBLEM :
When sample program is run with "-server -XX:+DoEscapeAnalysis" Hotspot prints "*** Unlock prevents locking optimization" messages.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class UnlockPrevents
{
    public static void main(String args[])
    {
	for (int n = 0; n < 5; n++)
	    doit();
    }

    public static void doit()
    {
        for (int n = 0; n < 10000; n++) {
	    Histogram h = new Histogram();

	    assertTrue(h.foo() == 1);
	    h.add(3);
	    assertTrue(h.bar() == 0);
	}
    }

    static void assertTrue(boolean x)
    {
    }
}

class Histogram
{
    private int count;
    private double min;

    public synchronized void add(double value)
    {
        if (count++ == 0) {
            min = value;
        } else {
            if (min > value)
                min = value;
        }
    }

    public int foo()
    {
        return 1;
    }

    public synchronized int bar()
    {
        return 0;
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Don't use -XX:+DoEscapeAnalysis.
Posted Date : 2006-03-06 19:20:14.0
Work Around
N/A
Evaluation
extraneous print statement that should have been removed, and was accidentally left in.
Posted Date : 2006-11-14 01:53:58.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang