Mercurial > hg > graal-compiler
annotate src/share/vm/c1/c1_Compilation.cpp @ 1751:2528b5bd749c
6980262: Memory leak when exception is thrown in static initializer
Summary: Use resource memory instead of c-heap for the exception message
Reviewed-by: phh, jmasa
author | kamg |
---|---|
date | Fri, 27 Aug 2010 15:05:28 -0400 |
parents | 4a665be40fd3 |
children | 3e8fbc61cee8 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_c1_Compilation.cpp.incl" | |
27 | |
28 | |
29 typedef enum { | |
30 _t_compile, | |
31 _t_setup, | |
32 _t_optimizeIR, | |
33 _t_buildIR, | |
34 _t_emit_lir, | |
35 _t_linearScan, | |
36 _t_lirGeneration, | |
37 _t_lir_schedule, | |
38 _t_codeemit, | |
39 _t_codeinstall, | |
40 max_phase_timers | |
41 } TimerName; | |
42 | |
43 static const char * timer_name[] = { | |
44 "compile", | |
45 "setup", | |
46 "optimizeIR", | |
47 "buildIR", | |
48 "emit_lir", | |
49 "linearScan", | |
50 "lirGeneration", | |
51 "lir_schedule", | |
52 "codeemit", | |
53 "codeinstall" | |
54 }; | |
55 | |
56 static elapsedTimer timers[max_phase_timers]; | |
57 static int totalInstructionNodes = 0; | |
58 | |
59 class PhaseTraceTime: public TraceTime { | |
60 private: | |
61 JavaThread* _thread; | |
62 | |
63 public: | |
64 PhaseTraceTime(TimerName timer): | |
65 TraceTime("", &timers[timer], CITime || CITimeEach, Verbose) { | |
66 } | |
67 }; | |
68 | |
69 // Implementation of Compilation | |
70 | |
71 | |
72 #ifndef PRODUCT | |
73 | |
74 void Compilation::maybe_print_current_instruction() { | |
75 if (_current_instruction != NULL && _last_instruction_printed != _current_instruction) { | |
76 _last_instruction_printed = _current_instruction; | |
77 _current_instruction->print_line(); | |
78 } | |
79 } | |
80 #endif // PRODUCT | |
81 | |
82 | |
83 DebugInformationRecorder* Compilation::debug_info_recorder() const { | |
84 return _env->debug_info(); | |
85 } | |
86 | |
87 | |
88 Dependencies* Compilation::dependency_recorder() const { | |
89 return _env->dependencies(); | |
90 } | |
91 | |
92 | |
93 void Compilation::initialize() { | |
94 // Use an oop recorder bound to the CI environment. | |
95 // (The default oop recorder is ignorant of the CI.) | |
96 OopRecorder* ooprec = new OopRecorder(_env->arena()); | |
97 _env->set_oop_recorder(ooprec); | |
98 _env->set_debug_info(new DebugInformationRecorder(ooprec)); | |
99 debug_info_recorder()->set_oopmaps(new OopMapSet()); | |
100 _env->set_dependencies(new Dependencies(_env)); | |
101 } | |
102 | |
103 | |
104 void Compilation::build_hir() { | |
105 CHECK_BAILOUT(); | |
106 | |
107 // setup ir | |
108 _hir = new IR(this, method(), osr_bci()); | |
109 if (!_hir->is_valid()) { | |
110 bailout("invalid parsing"); | |
111 return; | |
112 } | |
113 | |
114 #ifndef PRODUCT | |
115 if (PrintCFGToFile) { | |
116 CFGPrinter::print_cfg(_hir, "After Generation of HIR", true, false); | |
117 } | |
118 #endif | |
119 | |
120 #ifndef PRODUCT | |
121 if (PrintCFG || PrintCFG0) { tty->print_cr("CFG after parsing"); _hir->print(true); } | |
122 if (PrintIR || PrintIR0 ) { tty->print_cr("IR after parsing"); _hir->print(false); } | |
123 #endif | |
124 | |
125 _hir->verify(); | |
126 | |
127 if (UseC1Optimizations) { | |
128 NEEDS_CLEANUP | |
129 // optimization | |
130 PhaseTraceTime timeit(_t_optimizeIR); | |
131 | |
132 _hir->optimize(); | |
133 } | |
134 | |
135 _hir->verify(); | |
136 | |
137 _hir->split_critical_edges(); | |
138 | |
139 #ifndef PRODUCT | |
140 if (PrintCFG || PrintCFG1) { tty->print_cr("CFG after optimizations"); _hir->print(true); } | |
141 if (PrintIR || PrintIR1 ) { tty->print_cr("IR after optimizations"); _hir->print(false); } | |
142 #endif | |
143 | |
144 _hir->verify(); | |
145 | |
146 // compute block ordering for code generation | |
147 // the control flow must not be changed from here on | |
148 _hir->compute_code(); | |
149 | |
150 if (UseGlobalValueNumbering) { | |
151 ResourceMark rm; | |
152 int instructions = Instruction::number_of_instructions(); | |
153 GlobalValueNumbering gvn(_hir); | |
154 assert(instructions == Instruction::number_of_instructions(), | |
155 "shouldn't have created an instructions"); | |
156 } | |
157 | |
158 // compute use counts after global value numbering | |
159 _hir->compute_use_counts(); | |
160 | |
161 #ifndef PRODUCT | |
162 if (PrintCFG || PrintCFG2) { tty->print_cr("CFG before code generation"); _hir->code()->print(true); } | |
163 if (PrintIR || PrintIR2 ) { tty->print_cr("IR before code generation"); _hir->code()->print(false, true); } | |
164 #endif | |
165 | |
166 _hir->verify(); | |
167 } | |
168 | |
169 | |
170 void Compilation::emit_lir() { | |
171 CHECK_BAILOUT(); | |
172 | |
173 LIRGenerator gen(this, method()); | |
174 { | |
175 PhaseTraceTime timeit(_t_lirGeneration); | |
176 hir()->iterate_linear_scan_order(&gen); | |
177 } | |
178 | |
179 CHECK_BAILOUT(); | |
180 | |
181 { | |
182 PhaseTraceTime timeit(_t_linearScan); | |
183 | |
184 LinearScan* allocator = new LinearScan(hir(), &gen, frame_map()); | |
185 set_allocator(allocator); | |
186 // Assign physical registers to LIR operands using a linear scan algorithm. | |
187 allocator->do_linear_scan(); | |
188 CHECK_BAILOUT(); | |
189 | |
190 _max_spills = allocator->max_spills(); | |
191 } | |
192 | |
193 if (BailoutAfterLIR) { | |
194 if (PrintLIR && !bailed_out()) { | |
195 print_LIR(hir()->code()); | |
196 } | |
197 bailout("Bailing out because of -XX:+BailoutAfterLIR"); | |
198 } | |
199 } | |
200 | |
201 | |
202 void Compilation::emit_code_epilog(LIR_Assembler* assembler) { | |
203 CHECK_BAILOUT(); | |
204 | |
1204 | 205 CodeOffsets* code_offsets = assembler->offsets(); |
206 | |
0 | 207 // generate code or slow cases |
208 assembler->emit_slow_case_stubs(); | |
209 CHECK_BAILOUT(); | |
210 | |
211 // generate exception adapters | |
212 assembler->emit_exception_entries(exception_info_list()); | |
213 CHECK_BAILOUT(); | |
214 | |
1204 | 215 // Generate code for exception handler. |
216 code_offsets->set_value(CodeOffsets::Exceptions, assembler->emit_exception_handler()); | |
0 | 217 CHECK_BAILOUT(); |
1204 | 218 |
219 // Generate code for deopt handler. | |
220 code_offsets->set_value(CodeOffsets::Deopt, assembler->emit_deopt_handler()); | |
221 CHECK_BAILOUT(); | |
222 | |
1691
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
223 // Emit the MethodHandle deopt handler code (if required). |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
224 if (has_method_handle_invokes()) { |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
225 // We can use the same code as for the normal deopt handler, we |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
226 // just need a different entry point address. |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
227 code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler()); |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
228 CHECK_BAILOUT(); |
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
229 } |
0 | 230 |
1378
9f5b60a14736
6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents:
1204
diff
changeset
|
231 // Emit the handler to remove the activation from the stack and |
9f5b60a14736
6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents:
1204
diff
changeset
|
232 // dispatch to the caller. |
9f5b60a14736
6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents:
1204
diff
changeset
|
233 offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler()); |
9f5b60a14736
6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents:
1204
diff
changeset
|
234 |
0 | 235 // done |
236 masm()->flush(); | |
237 } | |
238 | |
239 | |
1584 | 240 void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { |
241 // Preinitialize the consts section to some large size: | |
242 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo)); | |
243 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size); | |
244 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer, | |
245 locs_buffer_size / sizeof(relocInfo)); | |
246 code->initialize_consts_size(Compilation::desired_max_constant_size()); | |
1617
9887b5e57f9e
6962980: C1: stub area should take into account method handle deopt stub
iveresov
parents:
1584
diff
changeset
|
247 // Call stubs + two deopt handlers (regular and MH) + exception handler |
1584 | 248 code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) + |
249 LIR_Assembler::exception_handler_size + | |
1617
9887b5e57f9e
6962980: C1: stub area should take into account method handle deopt stub
iveresov
parents:
1584
diff
changeset
|
250 2 * LIR_Assembler::deopt_handler_size); |
1584 | 251 } |
252 | |
253 | |
0 | 254 int Compilation::emit_code_body() { |
255 // emit code | |
1584 | 256 setup_code_buffer(code(), allocator()->num_calls()); |
0 | 257 code()->initialize_oop_recorder(env()->oop_recorder()); |
258 | |
259 _masm = new C1_MacroAssembler(code()); | |
260 _masm->set_oop_recorder(env()->oop_recorder()); | |
261 | |
262 LIR_Assembler lir_asm(this); | |
263 | |
264 lir_asm.emit_code(hir()->code()); | |
265 CHECK_BAILOUT_(0); | |
266 | |
267 emit_code_epilog(&lir_asm); | |
268 CHECK_BAILOUT_(0); | |
269 | |
270 generate_exception_handler_table(); | |
271 | |
272 #ifndef PRODUCT | |
273 if (PrintExceptionHandlers && Verbose) { | |
274 exception_handler_table()->print(); | |
275 } | |
276 #endif /* PRODUCT */ | |
277 | |
278 return frame_map()->framesize(); | |
279 } | |
280 | |
281 | |
282 int Compilation::compile_java_method() { | |
283 assert(!method()->is_native(), "should not reach here"); | |
284 | |
285 if (BailoutOnExceptionHandlers) { | |
286 if (method()->has_exception_handlers()) { | |
287 bailout("linear scan can't handle exception handlers"); | |
288 } | |
289 } | |
290 | |
291 CHECK_BAILOUT_(no_frame_size); | |
292 | |
293 { | |
294 PhaseTraceTime timeit(_t_buildIR); | |
295 build_hir(); | |
296 } | |
297 if (BailoutAfterHIR) { | |
298 BAILOUT_("Bailing out because of -XX:+BailoutAfterHIR", no_frame_size); | |
299 } | |
300 | |
301 | |
302 { | |
303 PhaseTraceTime timeit(_t_emit_lir); | |
304 | |
305 _frame_map = new FrameMap(method(), hir()->number_of_locks(), MAX2(4, hir()->max_stack())); | |
306 emit_lir(); | |
307 } | |
308 CHECK_BAILOUT_(no_frame_size); | |
309 | |
310 { | |
311 PhaseTraceTime timeit(_t_codeemit); | |
312 return emit_code_body(); | |
313 } | |
314 } | |
315 | |
316 void Compilation::install_code(int frame_size) { | |
317 // frame_size is in 32-bit words so adjust it intptr_t words | |
318 assert(frame_size == frame_map()->framesize(), "must match"); | |
319 assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned"); | |
320 _env->register_method( | |
321 method(), | |
322 osr_bci(), | |
323 &_offsets, | |
324 in_bytes(_frame_map->sp_offset_for_orig_pc()), | |
325 code(), | |
326 in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t), | |
327 debug_info_recorder()->_oopmaps, | |
328 exception_handler_table(), | |
329 implicit_exception_table(), | |
330 compiler(), | |
331 _env->comp_level(), | |
1397
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
1378
diff
changeset
|
332 true, |
0 | 333 has_unsafe_access() |
334 ); | |
335 } | |
336 | |
337 | |
338 void Compilation::compile_method() { | |
339 // setup compilation | |
340 initialize(); | |
341 | |
342 if (!method()->can_be_compiled()) { | |
343 // Prevent race condition 6328518. | |
344 // This can happen if the method is obsolete or breakpointed. | |
345 bailout("Bailing out because method is not compilable"); | |
346 return; | |
347 } | |
348 | |
780
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
349 if (_env->jvmti_can_hotswap_or_post_breakpoint()) { |
0 | 350 // We can assert evol_method because method->can_be_compiled is true. |
351 dependency_recorder()->assert_evol_method(method()); | |
352 } | |
353 | |
354 if (method()->break_at_execute()) { | |
355 BREAKPOINT; | |
356 } | |
357 | |
358 #ifndef PRODUCT | |
359 if (PrintCFGToFile) { | |
360 CFGPrinter::print_compilation(this); | |
361 } | |
362 #endif | |
363 | |
364 // compile method | |
365 int frame_size = compile_java_method(); | |
366 | |
367 // bailout if method couldn't be compiled | |
368 // Note: make sure we mark the method as not compilable! | |
369 CHECK_BAILOUT(); | |
370 | |
371 if (InstallMethods) { | |
372 // install code | |
373 PhaseTraceTime timeit(_t_codeinstall); | |
374 install_code(frame_size); | |
375 } | |
376 totalInstructionNodes += Instruction::number_of_instructions(); | |
377 } | |
378 | |
379 | |
380 void Compilation::generate_exception_handler_table() { | |
381 // Generate an ExceptionHandlerTable from the exception handler | |
382 // information accumulated during the compilation. | |
383 ExceptionInfoList* info_list = exception_info_list(); | |
384 | |
385 if (info_list->length() == 0) { | |
386 return; | |
387 } | |
388 | |
389 // allocate some arrays for use by the collection code. | |
390 const int num_handlers = 5; | |
391 GrowableArray<intptr_t>* bcis = new GrowableArray<intptr_t>(num_handlers); | |
392 GrowableArray<intptr_t>* scope_depths = new GrowableArray<intptr_t>(num_handlers); | |
393 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t>(num_handlers); | |
394 | |
395 for (int i = 0; i < info_list->length(); i++) { | |
396 ExceptionInfo* info = info_list->at(i); | |
397 XHandlers* handlers = info->exception_handlers(); | |
398 | |
399 // empty the arrays | |
400 bcis->trunc_to(0); | |
401 scope_depths->trunc_to(0); | |
402 pcos->trunc_to(0); | |
403 | |
404 for (int i = 0; i < handlers->length(); i++) { | |
405 XHandler* handler = handlers->handler_at(i); | |
406 assert(handler->entry_pco() != -1, "must have been generated"); | |
407 | |
408 int e = bcis->find(handler->handler_bci()); | |
409 if (e >= 0 && scope_depths->at(e) == handler->scope_count()) { | |
410 // two different handlers are declared to dispatch to the same | |
411 // catch bci. During parsing we created edges for each | |
412 // handler but we really only need one. The exception handler | |
413 // table will also get unhappy if we try to declare both since | |
414 // it's nonsensical. Just skip this handler. | |
415 continue; | |
416 } | |
417 | |
418 bcis->append(handler->handler_bci()); | |
419 if (handler->handler_bci() == -1) { | |
420 // insert a wildcard handler at scope depth 0 so that the | |
421 // exception lookup logic with find it. | |
422 scope_depths->append(0); | |
423 } else { | |
424 scope_depths->append(handler->scope_count()); | |
425 } | |
426 pcos->append(handler->entry_pco()); | |
427 | |
428 // stop processing once we hit a catch any | |
429 if (handler->is_catch_all()) { | |
430 assert(i == handlers->length() - 1, "catch all must be last handler"); | |
431 } | |
432 } | |
433 exception_handler_table()->add_subtable(info->pco(), bcis, scope_depths, pcos); | |
434 } | |
435 } | |
436 | |
437 | |
1584 | 438 Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, |
439 int osr_bci, BufferBlob* buffer_blob) | |
0 | 440 : _compiler(compiler) |
441 , _env(env) | |
442 , _method(method) | |
443 , _osr_bci(osr_bci) | |
444 , _hir(NULL) | |
445 , _max_spills(-1) | |
446 , _frame_map(NULL) | |
447 , _masm(NULL) | |
448 , _has_exception_handlers(false) | |
449 , _has_fpu_code(true) // pessimistic assumption | |
450 , _has_unsafe_access(false) | |
1691
4a665be40fd3
6975855: don't emit deopt MH handler in C1 if not required
twisti
parents:
1617
diff
changeset
|
451 , _has_method_handle_invokes(false) |
0 | 452 , _bailout_msg(NULL) |
453 , _exception_info_list(NULL) | |
454 , _allocator(NULL) | |
1584 | 455 , _next_id(0) |
456 , _next_block_id(0) | |
457 , _code(buffer_blob->instructions_begin(), | |
458 buffer_blob->instructions_size()) | |
0 | 459 , _current_instruction(NULL) |
460 #ifndef PRODUCT | |
461 , _last_instruction_printed(NULL) | |
462 #endif // PRODUCT | |
463 { | |
464 PhaseTraceTime timeit(_t_compile); | |
465 | |
466 _arena = Thread::current()->resource_area(); | |
1584 | 467 _env->set_compiler_data(this); |
0 | 468 _exception_info_list = new ExceptionInfoList(); |
469 _implicit_exception_table.set_size(0); | |
470 compile_method(); | |
471 } | |
472 | |
473 Compilation::~Compilation() { | |
1584 | 474 _env->set_compiler_data(NULL); |
0 | 475 } |
476 | |
477 | |
478 void Compilation::add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers) { | |
479 #ifndef PRODUCT | |
480 if (PrintExceptionHandlers && Verbose) { | |
481 tty->print_cr(" added exception scope for pco %d", pco); | |
482 } | |
483 #endif | |
484 // Note: we do not have program counters for these exception handlers yet | |
485 exception_info_list()->push(new ExceptionInfo(pco, exception_handlers)); | |
486 } | |
487 | |
488 | |
489 void Compilation::notice_inlined_method(ciMethod* method) { | |
490 _env->notice_inlined_method(method); | |
491 } | |
492 | |
493 | |
494 void Compilation::bailout(const char* msg) { | |
495 assert(msg != NULL, "bailout message must exist"); | |
496 if (!bailed_out()) { | |
497 // keep first bailout message | |
498 if (PrintBailouts) tty->print_cr("compilation bailout: %s", msg); | |
499 _bailout_msg = msg; | |
500 } | |
501 } | |
502 | |
503 | |
504 void Compilation::print_timers() { | |
505 // tty->print_cr(" Native methods : %6.3f s, Average : %2.3f", CompileBroker::_t_native_compilation.seconds(), CompileBroker::_t_native_compilation.seconds() / CompileBroker::_total_native_compile_count); | |
506 float total = timers[_t_setup].seconds() + timers[_t_buildIR].seconds() + timers[_t_emit_lir].seconds() + timers[_t_lir_schedule].seconds() + timers[_t_codeemit].seconds() + timers[_t_codeinstall].seconds(); | |
507 | |
508 | |
509 tty->print_cr(" Detailed C1 Timings"); | |
510 tty->print_cr(" Setup time: %6.3f s (%4.1f%%)", timers[_t_setup].seconds(), (timers[_t_setup].seconds() / total) * 100.0); | |
511 tty->print_cr(" Build IR: %6.3f s (%4.1f%%)", timers[_t_buildIR].seconds(), (timers[_t_buildIR].seconds() / total) * 100.0); | |
512 tty->print_cr(" Optimize: %6.3f s (%4.1f%%)", timers[_t_optimizeIR].seconds(), (timers[_t_optimizeIR].seconds() / total) * 100.0); | |
513 tty->print_cr(" Emit LIR: %6.3f s (%4.1f%%)", timers[_t_emit_lir].seconds(), (timers[_t_emit_lir].seconds() / total) * 100.0); | |
514 tty->print_cr(" LIR Gen: %6.3f s (%4.1f%%)", timers[_t_lirGeneration].seconds(), (timers[_t_lirGeneration].seconds() / total) * 100.0); | |
515 tty->print_cr(" Linear Scan: %6.3f s (%4.1f%%)", timers[_t_linearScan].seconds(), (timers[_t_linearScan].seconds() / total) * 100.0); | |
516 NOT_PRODUCT(LinearScan::print_timers(timers[_t_linearScan].seconds())); | |
517 tty->print_cr(" LIR Schedule: %6.3f s (%4.1f%%)", timers[_t_lir_schedule].seconds(), (timers[_t_lir_schedule].seconds() / total) * 100.0); | |
518 tty->print_cr(" Code Emission: %6.3f s (%4.1f%%)", timers[_t_codeemit].seconds(), (timers[_t_codeemit].seconds() / total) * 100.0); | |
519 tty->print_cr(" Code Installation: %6.3f s (%4.1f%%)", timers[_t_codeinstall].seconds(), (timers[_t_codeinstall].seconds() / total) * 100.0); | |
520 tty->print_cr(" Instruction Nodes: %6d nodes", totalInstructionNodes); | |
521 | |
522 NOT_PRODUCT(LinearScan::print_statistics()); | |
523 } | |
524 | |
525 | |
526 #ifndef PRODUCT | |
527 void Compilation::compile_only_this_method() { | |
528 ResourceMark rm; | |
529 fileStream stream(fopen("c1_compile_only", "wt")); | |
530 stream.print_cr("# c1 compile only directives"); | |
531 compile_only_this_scope(&stream, hir()->top_scope()); | |
532 } | |
533 | |
534 | |
535 void Compilation::compile_only_this_scope(outputStream* st, IRScope* scope) { | |
536 st->print("CompileOnly="); | |
537 scope->method()->holder()->name()->print_symbol_on(st); | |
538 st->print("."); | |
539 scope->method()->name()->print_symbol_on(st); | |
540 st->cr(); | |
541 } | |
542 | |
543 | |
544 void Compilation::exclude_this_method() { | |
545 fileStream stream(fopen(".hotspot_compiler", "at")); | |
546 stream.print("exclude "); | |
547 method()->holder()->name()->print_symbol_on(&stream); | |
548 stream.print(" "); | |
549 method()->name()->print_symbol_on(&stream); | |
550 stream.cr(); | |
551 stream.cr(); | |
552 } | |
553 #endif |