comparison src/share/vm/opto/compile.hpp @ 4802:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 6f3fd5150b67
children edb5ab0f3fe5
comparison
equal deleted inserted replaced
34:70288436e561 35:05054f080935
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
34 #include "libadt/dict.hpp" 34 #include "libadt/dict.hpp"
35 #include "libadt/port.hpp" 35 #include "libadt/port.hpp"
36 #include "libadt/vectset.hpp" 36 #include "libadt/vectset.hpp"
37 #include "memory/resourceArea.hpp" 37 #include "memory/resourceArea.hpp"
38 #include "opto/idealGraphPrinter.hpp" 38 #include "opto/idealGraphPrinter.hpp"
39 #include "opto/phasetype.hpp"
39 #include "opto/phase.hpp" 40 #include "opto/phase.hpp"
40 #include "opto/regmask.hpp" 41 #include "opto/regmask.hpp"
41 #include "runtime/deoptimization.hpp" 42 #include "runtime/deoptimization.hpp"
42 #include "runtime/vmThread.hpp" 43 #include "runtime/vmThread.hpp"
44 #include "trace/tracing.hpp"
43 45
44 class Block; 46 class Block;
45 class Bundle; 47 class Bundle;
46 class C2Compiler; 48 class C2Compiler;
47 class CallGenerator; 49 class CallGenerator;
319 GrowableArray<Node*>* _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common 321 GrowableArray<Node*>* _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
320 ConnectionGraph* _congraph; 322 ConnectionGraph* _congraph;
321 #ifndef PRODUCT 323 #ifndef PRODUCT
322 IdealGraphPrinter* _printer; 324 IdealGraphPrinter* _printer;
323 #endif 325 #endif
326
324 327
325 // Node management 328 // Node management
326 uint _unique; // Counter for unique Node indices 329 uint _unique; // Counter for unique Node indices
327 VectorSet _dead_node_list; // Set of dead nodes 330 VectorSet _dead_node_list; // Set of dead nodes
328 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N). 331 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N).
571 574
572 // JSR 292 575 // JSR 292
573 bool has_method_handle_invokes() const { return _has_method_handle_invokes; } 576 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
574 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } 577 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
575 578
579 jlong _latest_stage_start_counter;
580
576 void begin_method() { 581 void begin_method() {
577 #ifndef PRODUCT 582 #ifndef PRODUCT
578 if (_printer) _printer->begin_method(this); 583 if (_printer) _printer->begin_method(this);
579 #endif 584 #endif
580 } 585 C->_latest_stage_start_counter = os::elapsed_counter();
581 void print_method(const char * name, int level = 1) { 586 }
587
588 void print_method(CompilerPhaseType cpt, int level = 1) {
589 EventCompilerPhase event(UNTIMED);
590 if (event.should_commit()) {
591 event.set_starttime(C->_latest_stage_start_counter);
592 event.set_endtime(os::elapsed_counter());
593 event.set_phase((u1) cpt);
594 event.set_compileID(C->_compile_id);
595 event.set_phaseLevel(level);
596 event.commit();
597 }
598
599
582 #ifndef PRODUCT 600 #ifndef PRODUCT
583 if (_printer) _printer->print_method(this, name, level); 601 if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
584 #endif 602 #endif
585 } 603 C->_latest_stage_start_counter = os::elapsed_counter();
586 void end_method() { 604 }
605
606 void end_method(int level = 1) {
607 EventCompilerPhase event(UNTIMED);
608 if (event.should_commit()) {
609 event.set_starttime(C->_latest_stage_start_counter);
610 event.set_endtime(os::elapsed_counter());
611 event.set_phase((u1) PHASE_END);
612 event.set_compileID(C->_compile_id);
613 event.set_phaseLevel(level);
614 event.commit();
615 }
587 #ifndef PRODUCT 616 #ifndef PRODUCT
588 if (_printer) _printer->end_method(); 617 if (_printer) _printer->end_method();
589 #endif 618 #endif
590 } 619 }
591 620