JDK-6512534 : Strange behavior of Client VM (Unexpected value change on the specific situation)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic,x86
  • Submitted: 2007-01-12
  • Updated: 2010-12-03
  • Resolved: 2007-02-17
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
6u1Fixed 7Fixed hs10Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description
Please run the attached test programs(Test1.java) using Client VM or take a look at
the attached test result(result.txt). You'll notice that a variable(pre)'s value
is unexpectedly changed from true to false (at line 34 in result.txt) in the middle
of execution.
Based on circumstantial evidence, we think there is a bug in client VM.

Additional info:
  - This bug is reproducible only with Client VM. Not reproducible with -server nor -Xint.
  - This bug is not always reproducible. Please run the test program several times if you
    don't see the symptom.
  - Interestingly, this bug becomes non-reproducible
      * if you comment out the assignment expression to a variable(brk) at line 17
        or the "for" loop at line 27
      - or -
      * if you rearrange the order of two variable definitions at line 4 and 5.
            boolean brk = true;
            boolean pre = false;
According to the original bug reporter, this can be reproducible with a break statement with a label as well as a continue statement.

Comments
SUGGESTED FIX http://prt-web.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070207172045.never.6512534/workspace/webrevs/webrev-2007.02.08/index.html
08-02-2007

SUGGESTED FIX *** /tmp/geta22905 Tue Jan 16 13:53:53 2007 --- c1_LIRGenerator.cpp Tue Jan 16 13:53:51 2007 *************** *** 136,144 **** assert(node == NULL || node->operand() == opr, ""); if (node == NULL) { node = new ResolveNode(opr); - if (source) virtual_operands().append(node); vreg_table()[vreg_num] = node; } } else { assert(source, ""); node = new ResolveNode(opr); --- 136,148 ---- assert(node == NULL || node->operand() == opr, ""); if (node == NULL) { node = new ResolveNode(opr); vreg_table()[vreg_num] = node; } + // Make sure that all virtual operands show up in the list when + // they are used as the source of a move. + if (source && !virtual_operands().contains(node)) { + virtual_operands().append(node); + } } else { assert(source, ""); node = new ResolveNode(opr);
16-01-2007

EVALUATION This appears to be a problem with the processing of phis. I'm still trying to identify what's going wrong. Here's a simplified test case. public class Test1 { static int dummy; private static void error() { throw new InternalError(""); } private static void ok() { System.out.println("true"); } protected static void doSomething() { boolean brk = true; boolean pre = false; for(int i = 0; i < 2; ++i){ int j = 0; while(j < 1){ ++j; if(i == 0){ pre = brk; brk = false; continue; } if (pre == false) error(); } } for (int i = 0; i < 1000; ++i); } public static void main(String[] args) { for(int i = 0; i < 5; i++){ doSomething(); // System.out.println((i+1) + " ----------------------"); } } }
12-01-2007