src/share/vm/opto/c2compiler.cpp

Fri, 15 Apr 2016 12:02:37 +0530

author
shshahma
date
Fri, 15 Apr 2016 12:02:37 +0530
changeset 8421
3e1cd663c2d3
parent 7598
ddce0b7cee93
child 8604
04d83ba48607
child 9942
eddd586d1a4c
permissions
-rw-r--r--

8055530: assert(_exits.control()->is_top() || !_gvn.type(ret_phi)->empty()) failed: return value must be well defined
Summary: concurrent class loading causes return phi to become top
Reviewed-by: kvn

duke@435 1 /*
dlong@7598 2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "opto/c2compiler.hpp"
stefank@2314 27 #include "opto/runtime.hpp"
dlong@7598 28 #if defined AD_MD_HPP
dlong@7598 29 # include AD_MD_HPP
dlong@7598 30 #elif defined TARGET_ARCH_MODEL_x86_32
stefank@2314 31 # include "adfiles/ad_x86_32.hpp"
dlong@7598 32 #elif defined TARGET_ARCH_MODEL_x86_64
stefank@2314 33 # include "adfiles/ad_x86_64.hpp"
dlong@7598 34 #elif defined TARGET_ARCH_MODEL_sparc
stefank@2314 35 # include "adfiles/ad_sparc.hpp"
dlong@7598 36 #elif defined TARGET_ARCH_MODEL_zero
stefank@2314 37 # include "adfiles/ad_zero.hpp"
dlong@7598 38 #elif defined TARGET_ARCH_MODEL_ppc_64
goetz@6441 39 # include "adfiles/ad_ppc_64.hpp"
bobv@2508 40 #endif
duke@435 41
duke@435 42 // register information defined by ADLC
duke@435 43 extern const char register_save_policy[];
duke@435 44 extern const int register_save_type[];
duke@435 45
duke@435 46 const char* C2Compiler::retry_no_subsuming_loads() {
duke@435 47 return "retry without subsuming loads";
duke@435 48 }
kvn@473 49 const char* C2Compiler::retry_no_escape_analysis() {
kvn@473 50 return "retry without escape analysis";
kvn@473 51 }
shshahma@8421 52 const char* C2Compiler::retry_class_loading_during_parsing() {
shshahma@8421 53 return "retry class loading during parsing";
shshahma@8421 54 }
anoll@5919 55 bool C2Compiler::init_c2_runtime() {
duke@435 56
duke@435 57 // Check assumptions used while running ADLC
duke@435 58 Compile::adlc_verification();
duke@435 59 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts");
duke@435 60
duke@435 61 for (int i = 0; i < ConcreteRegisterImpl::number_of_registers ; i++ ) {
duke@435 62 OptoReg::vm2opto[i] = OptoReg::Bad;
duke@435 63 }
duke@435 64
duke@435 65 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(REG_COUNT); i = OptoReg::add(i,1) ) {
duke@435 66 VMReg r = OptoReg::as_VMReg(i);
duke@435 67 if (r->is_valid()) {
duke@435 68 OptoReg::vm2opto[r->value()] = i;
duke@435 69 }
duke@435 70 }
duke@435 71
duke@435 72 // Check that runtime and architecture description agree on callee-saved-floats
duke@435 73 bool callee_saved_floats = false;
duke@435 74 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) {
duke@435 75 // Is there a callee-saved float or double?
duke@435 76 if( register_save_policy[i] == 'E' /* callee-saved */ &&
duke@435 77 (register_save_type[i] == Op_RegF || register_save_type[i] == Op_RegD) ) {
duke@435 78 callee_saved_floats = true;
duke@435 79 }
duke@435 80 }
duke@435 81
duke@435 82 DEBUG_ONLY( Node::init_NodeProperty(); )
duke@435 83
duke@435 84 Compile::pd_compiler2_init();
duke@435 85
duke@435 86 CompilerThread* thread = CompilerThread::current();
duke@435 87
anoll@5919 88 HandleMark handle_mark(thread);
anoll@5919 89 return OptoRuntime::generate(thread->env());
duke@435 90 }
duke@435 91
duke@435 92
duke@435 93 void C2Compiler::initialize() {
duke@435 94 // The first compiler thread that gets here will initialize the
anoll@5919 95 // small amount of global state (and runtime stubs) that C2 needs.
duke@435 96
duke@435 97 // There is a race possible once at startup and then we're fine
duke@435 98
duke@435 99 // Note that this is being called from a compiler thread not the
duke@435 100 // main startup thread.
anoll@5919 101 if (should_perform_init()) {
anoll@5919 102 bool successful = C2Compiler::init_c2_runtime();
anoll@5919 103 int new_state = (successful) ? initialized : failed;
anoll@5919 104 set_state(new_state);
duke@435 105 }
duke@435 106 }
duke@435 107
anoll@5919 108 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
anoll@5919 109 assert(is_initialized(), "Compiler thread must be initialized");
anoll@5919 110
kvn@2040 111 bool subsume_loads = SubsumeLoads;
anoll@5919 112 bool do_escape_analysis = DoEscapeAnalysis && !env->jvmti_can_access_local_variables();
kvn@5110 113 bool eliminate_boxing = EliminateAutoBox;
duke@435 114 while (!env->failing()) {
duke@435 115 // Attempt to compile while subsuming loads into machine instructions.
kvn@5110 116 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
duke@435 117
kvn@2040 118
duke@435 119 // Check result and retry if appropriate.
duke@435 120 if (C.failure_reason() != NULL) {
shshahma@8421 121 if (C.failure_reason_is(retry_class_loading_during_parsing())) {
shshahma@8421 122 env->record_failure(C.failure_reason());
shshahma@8421 123 continue; // retry
shshahma@8421 124 }
kvn@473 125 if (C.failure_reason_is(retry_no_subsuming_loads())) {
duke@435 126 assert(subsume_loads, "must make progress");
duke@435 127 subsume_loads = false;
duke@435 128 continue; // retry
duke@435 129 }
kvn@473 130 if (C.failure_reason_is(retry_no_escape_analysis())) {
kvn@473 131 assert(do_escape_analysis, "must make progress");
kvn@473 132 do_escape_analysis = false;
kvn@473 133 continue; // retry
kvn@473 134 }
kvn@5110 135 if (C.has_boxed_value()) {
kvn@5110 136 // Recompile without boxing elimination regardless failure reason.
kvn@5110 137 assert(eliminate_boxing, "must make progress");
kvn@5110 138 eliminate_boxing = false;
kvn@5110 139 continue; // retry
kvn@5110 140 }
duke@435 141 // Pass any other failure reason up to the ciEnv.
duke@435 142 // Note that serious, irreversible failures are already logged
duke@435 143 // on the ciEnv via env->record_method_not_compilable().
duke@435 144 env->record_failure(C.failure_reason());
duke@435 145 }
kvn@2040 146 if (StressRecompilation) {
kvn@2040 147 if (subsume_loads) {
kvn@2040 148 subsume_loads = false;
kvn@2040 149 continue; // retry
kvn@2040 150 }
kvn@2040 151 if (do_escape_analysis) {
kvn@2040 152 do_escape_analysis = false;
kvn@2040 153 continue; // retry
kvn@2040 154 }
kvn@2040 155 }
duke@435 156
duke@435 157 // No retry; just break the loop.
duke@435 158 break;
duke@435 159 }
duke@435 160 }
duke@435 161
duke@435 162
duke@435 163 void C2Compiler::print_timers() {
duke@435 164 // do nothing
duke@435 165 }

mercurial