src/share/vm/opto/c2compiler.cpp

changeset 6472
2b8e28fdf503
parent 6441
d2907f74462e
parent 5919
469216acdb28
child 6503
a9becfeecd1b
     1.1 --- a/src/share/vm/opto/c2compiler.cpp	Wed Oct 16 10:52:41 2013 +0200
     1.2 +++ b/src/share/vm/opto/c2compiler.cpp	Tue Nov 05 17:38:04 2013 -0800
     1.3 @@ -47,9 +47,6 @@
     1.4  # include "adfiles/ad_ppc_64.hpp"
     1.5  #endif
     1.6  
     1.7 -
     1.8 -volatile int C2Compiler::_runtimes = uninitialized;
     1.9 -
    1.10  // register information defined by ADLC
    1.11  extern const char register_save_policy[];
    1.12  extern const int  register_save_type[];
    1.13 @@ -60,7 +57,7 @@
    1.14  const char* C2Compiler::retry_no_escape_analysis() {
    1.15    return "retry without escape analysis";
    1.16  }
    1.17 -void C2Compiler::initialize_runtime() {
    1.18 +bool C2Compiler::init_c2_runtime() {
    1.19  
    1.20    // Check assumptions used while running ADLC
    1.21    Compile::adlc_verification();
    1.22 @@ -93,41 +90,31 @@
    1.23  
    1.24    CompilerThread* thread = CompilerThread::current();
    1.25  
    1.26 -  HandleMark  handle_mark(thread);
    1.27 -
    1.28 -  OptoRuntime::generate(thread->env());
    1.29 -
    1.30 +  HandleMark handle_mark(thread);
    1.31 +  return OptoRuntime::generate(thread->env());
    1.32  }
    1.33  
    1.34  
    1.35  void C2Compiler::initialize() {
    1.36 -
    1.37 -  // This method can only be called once per C2Compiler object
    1.38    // The first compiler thread that gets here will initialize the
    1.39 -  // small amount of global state (and runtime stubs) that c2 needs.
    1.40 +  // small amount of global state (and runtime stubs) that C2 needs.
    1.41  
    1.42    // There is a race possible once at startup and then we're fine
    1.43  
    1.44    // Note that this is being called from a compiler thread not the
    1.45    // main startup thread.
    1.46 -
    1.47 -  if (_runtimes != initialized) {
    1.48 -    initialize_runtimes( initialize_runtime, &_runtimes);
    1.49 +  if (should_perform_init()) {
    1.50 +    bool successful = C2Compiler::init_c2_runtime();
    1.51 +    int new_state = (successful) ? initialized : failed;
    1.52 +    set_state(new_state);
    1.53    }
    1.54 -
    1.55 -  // Mark this compiler object as ready to roll
    1.56 -  mark_initialized();
    1.57  }
    1.58  
    1.59 -void C2Compiler::compile_method(ciEnv* env,
    1.60 -                                ciMethod* target,
    1.61 -                                int entry_bci) {
    1.62 -  if (!is_initialized()) {
    1.63 -    initialize();
    1.64 -  }
    1.65 +void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
    1.66 +  assert(is_initialized(), "Compiler thread must be initialized");
    1.67 +
    1.68    bool subsume_loads = SubsumeLoads;
    1.69 -  bool do_escape_analysis = DoEscapeAnalysis &&
    1.70 -    !env->jvmti_can_access_local_variables();
    1.71 +  bool do_escape_analysis = DoEscapeAnalysis && !env->jvmti_can_access_local_variables();
    1.72    bool eliminate_boxing = EliminateAutoBox;
    1.73    while (!env->failing()) {
    1.74      // Attempt to compile while subsuming loads into machine instructions.

mercurial