src/share/vm/opto/c2compiler.cpp

Thu, 20 Jun 2013 16:30:44 -0700

author
goetz
date
Thu, 20 Jun 2013 16:30:44 -0700
changeset 6441
d2907f74462e
parent 5110
6f3fd5150b67
child 6472
2b8e28fdf503
permissions
-rw-r--r--

8016586: PPC64 (part 3): basic changes for PPC64
Summary: added #includes needed for ppc64 port. Renamed _MODEL_ppc to _MODEL_ppc_32 and renamed corresponding old _ppc files to _ppc_32.
Reviewed-by: dholmes, kvn

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

mercurial