comparison src/share/vm/opto/compile.hpp @ 13400:86e6d691f2e1

8028128: Add a type safe alternative for working with counter based data Reviewed-by: dholmes, egahlin
author mgronlun
date Sat, 23 Nov 2013 12:25:13 +0100
parents 94a83e0f9ce1
children 183bd5c00828 1174c8abbdb6
comparison
equal deleted inserted replaced
13399:260ac69dc096 13400:86e6d691f2e1
40 #include "opto/phase.hpp" 40 #include "opto/phase.hpp"
41 #include "opto/regmask.hpp" 41 #include "opto/regmask.hpp"
42 #include "runtime/deoptimization.hpp" 42 #include "runtime/deoptimization.hpp"
43 #include "runtime/vmThread.hpp" 43 #include "runtime/vmThread.hpp"
44 #include "trace/tracing.hpp" 44 #include "trace/tracing.hpp"
45 #include "utilities/ticks.hpp"
45 46
46 class Block; 47 class Block;
47 class Bundle; 48 class Bundle;
48 class C2Compiler; 49 class C2Compiler;
49 class CallGenerator; 50 class CallGenerator;
595 596
596 // JSR 292 597 // JSR 292
597 bool has_method_handle_invokes() const { return _has_method_handle_invokes; } 598 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
598 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } 599 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
599 600
600 jlong _latest_stage_start_counter; 601 Ticks _latest_stage_start_counter;
601 602
602 void begin_method() { 603 void begin_method() {
603 #ifndef PRODUCT 604 #ifndef PRODUCT
604 if (_printer) _printer->begin_method(this); 605 if (_printer) _printer->begin_method(this);
605 #endif 606 #endif
606 C->_latest_stage_start_counter = os::elapsed_counter(); 607 C->_latest_stage_start_counter.stamp();
607 } 608 }
608 609
609 void print_method(CompilerPhaseType cpt, int level = 1) { 610 void print_method(CompilerPhaseType cpt, int level = 1) {
610 EventCompilerPhase event(UNTIMED); 611 EventCompilerPhase event;
611 if (event.should_commit()) { 612 if (event.should_commit()) {
612 event.set_starttime(C->_latest_stage_start_counter); 613 event.set_starttime(C->_latest_stage_start_counter);
613 event.set_endtime(os::elapsed_counter());
614 event.set_phase((u1) cpt); 614 event.set_phase((u1) cpt);
615 event.set_compileID(C->_compile_id); 615 event.set_compileID(C->_compile_id);
616 event.set_phaseLevel(level); 616 event.set_phaseLevel(level);
617 event.commit(); 617 event.commit();
618 } 618 }
619 619
620 620
621 #ifndef PRODUCT 621 #ifndef PRODUCT
622 if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level); 622 if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
623 #endif 623 #endif
624 C->_latest_stage_start_counter = os::elapsed_counter(); 624 C->_latest_stage_start_counter.stamp();
625 } 625 }
626 626
627 void end_method(int level = 1) { 627 void end_method(int level = 1) {
628 EventCompilerPhase event(UNTIMED); 628 EventCompilerPhase event;
629 if (event.should_commit()) { 629 if (event.should_commit()) {
630 event.set_starttime(C->_latest_stage_start_counter); 630 event.set_starttime(C->_latest_stage_start_counter);
631 event.set_endtime(os::elapsed_counter());
632 event.set_phase((u1) PHASE_END); 631 event.set_phase((u1) PHASE_END);
633 event.set_compileID(C->_compile_id); 632 event.set_compileID(C->_compile_id);
634 event.set_phaseLevel(level); 633 event.set_phaseLevel(level);
635 event.commit(); 634 event.commit();
636 } 635 }