Wed, 24 Oct 2018 10:42:54 +0200
8209639: assert failure in coalesce.cpp: attempted to spill a non-spillable item
Reviewed-by: neliasso, kvn
src/share/vm/opto/coalesce.cpp | file | annotate | diff | comparison | revisions | |
test/compiler/c2/SubsumingLoadsCauseFlagSpill.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/opto/coalesce.cpp Mon Oct 15 11:00:27 2018 +0200 1.2 +++ b/src/share/vm/opto/coalesce.cpp Wed Oct 24 10:42:54 2018 +0200 1.3 @@ -25,6 +25,7 @@ 1.4 #include "precompiled.hpp" 1.5 #include "memory/allocation.inline.hpp" 1.6 #include "opto/block.hpp" 1.7 +#include "opto/c2compiler.hpp" 1.8 #include "opto/cfgnode.hpp" 1.9 #include "opto/chaitin.hpp" 1.10 #include "opto/coalesce.hpp" 1.11 @@ -294,9 +295,13 @@ 1.12 } else { 1.13 int ireg = m->ideal_reg(); 1.14 if (ireg == 0 || ireg == Op_RegFlags) { 1.15 - assert(false, err_msg("attempted to spill a non-spillable item: %d: %s, ireg = %d", 1.16 - m->_idx, m->Name(), ireg)); 1.17 - C->record_method_not_compilable("attempted to spill a non-spillable item"); 1.18 + if (C->subsume_loads()) { 1.19 + C->record_failure(C2Compiler::retry_no_subsuming_loads()); 1.20 + } else { 1.21 + assert(false, err_msg("attempted to spill a non-spillable item: %d: %s, ireg = %d", 1.22 + m->_idx, m->Name(), ireg)); 1.23 + C->record_method_not_compilable("attempted to spill a non-spillable item"); 1.24 + } 1.25 return; 1.26 } 1.27 const RegMask *rm = C->matcher()->idealreg2spillmask[ireg];
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/compiler/c2/SubsumingLoadsCauseFlagSpill.java Wed Oct 24 10:42:54 2018 +0200 2.3 @@ -0,0 +1,72 @@ 2.4 +/* 2.5 + * Copyright (c) 2018, Red Hat, Inc. 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 + * @test 2.29 + * @bug 8209639 2.30 + * @summary assert failure in coalesce.cpp: attempted to spill a non-spillable item 2.31 + * 2.32 + * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,SubsumingLoadsCauseFlagSpill::not_inlined -Xmx1024m SubsumingLoadsCauseFlagSpill 2.33 + * 2.34 + */ 2.35 + 2.36 +public class SubsumingLoadsCauseFlagSpill { 2.37 + private static Object field; 2.38 + private static boolean do_throw; 2.39 + private static volatile boolean barrier; 2.40 + 2.41 + public static void main(String[] args) { 2.42 + for (int i = 0; i < 20_000; i++) { 2.43 + do_throw = true; 2.44 + field = null; 2.45 + test(0); 2.46 + do_throw = false; 2.47 + field = new Object(); 2.48 + test(0); 2.49 + } 2.50 + } 2.51 + 2.52 + private static float test(float f) { 2.53 + Object v = null; 2.54 + try { 2.55 + not_inlined(); 2.56 + v = field; 2.57 + } catch (MyException me) { 2.58 + v = field; 2.59 + barrier = true; 2.60 + } 2.61 + if (v == null) { 2.62 + return f * f; 2.63 + } 2.64 + return f; 2.65 + } 2.66 + 2.67 + private static void not_inlined() throws MyException{ 2.68 + if (do_throw) { 2.69 + throw new MyException(); 2.70 + } 2.71 + } 2.72 + 2.73 + private static class MyException extends Throwable { 2.74 + } 2.75 +}