94
95 void C2Compiler::initialize() {
96 // The first compiler thread that gets here will initialize the
97 // small amount of global state (and runtime stubs) that C2 needs.
98
99 // There is a race possible once at startup and then we're fine
100
101 // Note that this is being called from a compiler thread not the
102 // main startup thread.
103 if (should_perform_init()) {
104 bool successful = C2Compiler::init_c2_runtime();
105 int new_state = (successful) ? initialized : failed;
106 set_state(new_state);
107 }
108 }
109
110 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
111 assert(is_initialized(), "Compiler thread must be initialized");
112
113 bool subsume_loads = SubsumeLoads;
114 bool do_escape_analysis = DoEscapeAnalysis && !env->jvmti_can_access_local_variables();
115 bool eliminate_boxing = EliminateAutoBox;
116 while (!env->failing()) {
117 // Attempt to compile while subsuming loads into machine instructions.
118 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
119
120
121 // Check result and retry if appropriate.
122 if (C.failure_reason() != NULL) {
123 if (C.failure_reason_is(retry_no_subsuming_loads())) {
124 assert(subsume_loads, "must make progress");
125 subsume_loads = false;
126 continue; // retry
127 }
128 if (C.failure_reason_is(retry_no_escape_analysis())) {
129 assert(do_escape_analysis, "must make progress");
130 do_escape_analysis = false;
131 continue; // retry
132 }
133 if (C.has_boxed_value()) {
134 // Recompile without boxing elimination regardless failure reason.
|
94
95 void C2Compiler::initialize() {
96 // The first compiler thread that gets here will initialize the
97 // small amount of global state (and runtime stubs) that C2 needs.
98
99 // There is a race possible once at startup and then we're fine
100
101 // Note that this is being called from a compiler thread not the
102 // main startup thread.
103 if (should_perform_init()) {
104 bool successful = C2Compiler::init_c2_runtime();
105 int new_state = (successful) ? initialized : failed;
106 set_state(new_state);
107 }
108 }
109
110 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
111 assert(is_initialized(), "Compiler thread must be initialized");
112
113 bool subsume_loads = SubsumeLoads;
114 bool do_escape_analysis = DoEscapeAnalysis && !env->should_retain_local_variables();
115 bool eliminate_boxing = EliminateAutoBox;
116 while (!env->failing()) {
117 // Attempt to compile while subsuming loads into machine instructions.
118 Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
119
120
121 // Check result and retry if appropriate.
122 if (C.failure_reason() != NULL) {
123 if (C.failure_reason_is(retry_no_subsuming_loads())) {
124 assert(subsume_loads, "must make progress");
125 subsume_loads = false;
126 continue; // retry
127 }
128 if (C.failure_reason_is(retry_no_escape_analysis())) {
129 assert(do_escape_analysis, "must make progress");
130 do_escape_analysis = false;
131 continue; // retry
132 }
133 if (C.has_boxed_value()) {
134 // Recompile without boxing elimination regardless failure reason.
|