7123108: C1: assert(if_state != NULL) failed: states do not match up

Thu, 22 Dec 2011 10:55:53 +0100

author
roland
date
Thu, 22 Dec 2011 10:55:53 +0100
changeset 3393
e5ac210043cd
parent 3392
1dc233a8c7fe
child 3394
b642b49f9738

7123108: C1: assert(if_state != NULL) failed: states do not match up
Summary: In CEE, ensure if and common successor state are at the same inline level
Reviewed-by: never

src/share/vm/c1/c1_Optimizer.cpp file | annotate | diff | comparison | revisions
test/compiler/7123108/Test7123108.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/c1/c1_Optimizer.cpp	Tue Dec 20 16:56:50 2011 +0100
     1.2 +++ b/src/share/vm/c1/c1_Optimizer.cpp	Thu Dec 22 10:55:53 2011 +0100
     1.3 @@ -125,9 +125,16 @@
     1.4    // inlining depths must match
     1.5    ValueStack* if_state = if_->state();
     1.6    ValueStack* sux_state = sux->state();
     1.7 -  while (sux_state->scope() != if_state->scope()) {
     1.8 -    if_state = if_state->caller_state();
     1.9 -    assert(if_state != NULL, "states do not match up");
    1.10 +  if (if_state->scope()->level() > sux_state->scope()->level()) {
    1.11 +    while (sux_state->scope() != if_state->scope()) {
    1.12 +      if_state = if_state->caller_state();
    1.13 +      assert(if_state != NULL, "states do not match up");
    1.14 +    }
    1.15 +  } else if (if_state->scope()->level() < sux_state->scope()->level()) {
    1.16 +    while (sux_state->scope() != if_state->scope()) {
    1.17 +      sux_state = sux_state->caller_state();
    1.18 +      assert(sux_state != NULL, "states do not match up");
    1.19 +    }
    1.20    }
    1.21  
    1.22    if (sux_state->stack_size() <= if_state->stack_size()) return;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/compiler/7123108/Test7123108.java	Thu Dec 22 10:55:53 2011 +0100
     2.3 @@ -0,0 +1,60 @@
     2.4 +/*
     2.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.
    2.11 + *
    2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 + * version 2 for more details (a copy is included in the LICENSE file that
    2.16 + * accompanied this code).
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License version
    2.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 + *
    2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.23 + * or visit www.oracle.com if you need additional information or have any
    2.24 + * questions.
    2.25 + *
    2.26 + */
    2.27 +
    2.28 +/**
    2.29 + * @test
    2.30 + * @bug 7123108
    2.31 + * @summary C1 crashes with assert(if_state != NULL) failed: states do not match up
    2.32 + *
    2.33 + * @run main/othervm -Xcomp Test7123108
    2.34 + */
    2.35 +
    2.36 +public class Test7123108 {
    2.37 +
    2.38 +    static class Test_Class_0 {
    2.39 +        final static byte var_2 = 67;
    2.40 +        byte var_3;
    2.41 +    }
    2.42 +
    2.43 +    Object var_25 = "kgfpyhcms";
    2.44 +    static long var_27 = 6899666748616086528L;
    2.45 +
    2.46 +    static float func_1()
    2.47 +    {
    2.48 +        return 0.0F;
    2.49 +    }
    2.50 +
    2.51 +    private void test()
    2.52 +    {
    2.53 +        "dlwq".charAt(((short)'x' > var_27 | func_1() <= (((Test_Class_0)var_25).var_3) ? true : true) ? Test_Class_0.var_2 & (short)-1.1173839E38F : 'Y');
    2.54 +    }
    2.55 +
    2.56 +    public static void main(String[] args)
    2.57 +    {
    2.58 +        Test7123108 t = new Test7123108();
    2.59 +        try {
    2.60 +            t.test();
    2.61 +        } catch (Throwable e) { }
    2.62 +    }
    2.63 +}

mercurial