comparison src/share/vm/opto/c2compiler.cpp @ 14422:2b8e28fdf503

Merge
author kvn
date Tue, 05 Nov 2013 17:38:04 -0800
parents d2907f74462e 469216acdb28
children abec000618bf
comparison
equal deleted inserted replaced
14421:3068270ba476 14422:2b8e28fdf503
45 #endif 45 #endif
46 #ifdef TARGET_ARCH_MODEL_ppc_64 46 #ifdef TARGET_ARCH_MODEL_ppc_64
47 # include "adfiles/ad_ppc_64.hpp" 47 # include "adfiles/ad_ppc_64.hpp"
48 #endif 48 #endif
49 49
50
51 volatile int C2Compiler::_runtimes = uninitialized;
52
53 // register information defined by ADLC 50 // register information defined by ADLC
54 extern const char register_save_policy[]; 51 extern const char register_save_policy[];
55 extern const int register_save_type[]; 52 extern const int register_save_type[];
56 53
57 const char* C2Compiler::retry_no_subsuming_loads() { 54 const char* C2Compiler::retry_no_subsuming_loads() {
58 return "retry without subsuming loads"; 55 return "retry without subsuming loads";
59 } 56 }
60 const char* C2Compiler::retry_no_escape_analysis() { 57 const char* C2Compiler::retry_no_escape_analysis() {
61 return "retry without escape analysis"; 58 return "retry without escape analysis";
62 } 59 }
63 void C2Compiler::initialize_runtime() { 60 bool C2Compiler::init_c2_runtime() {
64 61
65 // Check assumptions used while running ADLC 62 // Check assumptions used while running ADLC
66 Compile::adlc_verification(); 63 Compile::adlc_verification();
67 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts"); 64 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts");
68 65
91 88
92 Compile::pd_compiler2_init(); 89 Compile::pd_compiler2_init();
93 90
94 CompilerThread* thread = CompilerThread::current(); 91 CompilerThread* thread = CompilerThread::current();
95 92
96 HandleMark handle_mark(thread); 93 HandleMark handle_mark(thread);
97 94 return OptoRuntime::generate(thread->env());
98 OptoRuntime::generate(thread->env());
99
100 } 95 }
101 96
102 97
103 void C2Compiler::initialize() { 98 void C2Compiler::initialize() {
104
105 // This method can only be called once per C2Compiler object
106 // The first compiler thread that gets here will initialize the 99 // The first compiler thread that gets here will initialize the
107 // small amount of global state (and runtime stubs) that c2 needs. 100 // small amount of global state (and runtime stubs) that C2 needs.
108 101
109 // There is a race possible once at startup and then we're fine 102 // There is a race possible once at startup and then we're fine
110 103
111 // Note that this is being called from a compiler thread not the 104 // Note that this is being called from a compiler thread not the
112 // main startup thread. 105 // main startup thread.
113 106 if (should_perform_init()) {
114 if (_runtimes != initialized) { 107 bool successful = C2Compiler::init_c2_runtime();
115 initialize_runtimes( initialize_runtime, &_runtimes); 108 int new_state = (successful) ? initialized : failed;
109 set_state(new_state);
116 } 110 }
117
118 // Mark this compiler object as ready to roll
119 mark_initialized();
120 } 111 }
121 112
122 void C2Compiler::compile_method(ciEnv* env, 113 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
123 ciMethod* target, 114 assert(is_initialized(), "Compiler thread must be initialized");
124 int entry_bci) { 115
125 if (!is_initialized()) {
126 initialize();
127 }
128 bool subsume_loads = SubsumeLoads; 116 bool subsume_loads = SubsumeLoads;
129 bool do_escape_analysis = DoEscapeAnalysis && 117 bool do_escape_analysis = DoEscapeAnalysis && !env->jvmti_can_access_local_variables();
130 !env->jvmti_can_access_local_variables();
131 bool eliminate_boxing = EliminateAutoBox; 118 bool eliminate_boxing = EliminateAutoBox;
132 while (!env->failing()) { 119 while (!env->failing()) {
133 // Attempt to compile while subsuming loads into machine instructions. 120 // Attempt to compile while subsuming loads into machine instructions.
134 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing); 121 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
135 122