1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "ci/ciReplay.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/exceptionHandlerTable.hpp"
31 #include "code/nmethod.hpp"
32 #include "compiler/compileBroker.hpp"
33 #include "compiler/compileLog.hpp"
34 #include "compiler/disassembler.hpp"
35 #include "compiler/oopMap.hpp"
36 #include "gc/shared/barrierSet.hpp"
37 #include "gc/shared/c2/barrierSetC2.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "opto/addnode.hpp"
40 #include "opto/block.hpp"
41 #include "opto/c2compiler.hpp"
42 #include "opto/callGenerator.hpp"
43 #include "opto/callnode.hpp"
44 #include "opto/castnode.hpp"
45 #include "opto/cfgnode.hpp"
46 #include "opto/chaitin.hpp"
47 #include "opto/compile.hpp"
48 #include "opto/connode.hpp"
49 #include "opto/convertnode.hpp"
50 #include "opto/divnode.hpp"
51 #include "opto/escape.hpp"
52 #include "opto/idealGraphPrinter.hpp"
53 #include "opto/loopnode.hpp"
54 #include "opto/machnode.hpp"
55 #include "opto/macro.hpp"
56 #include "opto/matcher.hpp"
57 #include "opto/mathexactnode.hpp"
4543 NodeCloneInfo ni(val);
4544 ni.dump();
4545 }
4546 }
4547
4548 // Move Allocate nodes to the start of the list
4549 void Compile::sort_macro_nodes() {
4550 int count = macro_count();
4551 int allocates = 0;
4552 for (int i = 0; i < count; i++) {
4553 Node* n = macro_node(i);
4554 if (n->is_Allocate()) {
4555 if (i != allocates) {
4556 Node* tmp = macro_node(allocates);
4557 _macro_nodes->at_put(allocates, n);
4558 _macro_nodes->at_put(i, tmp);
4559 }
4560 allocates++;
4561 }
4562 }
4563 }
4564
4565
4566 #ifndef PRODUCT
4567 IdealGraphPrinter* Compile::_debug_file_printer = NULL;
4568 IdealGraphPrinter* Compile::_debug_network_printer = NULL;
4569
4570 // Called from debugger. Prints method to the default file with the default phase name.
4571 // This works regardless of any Ideal Graph Visualizer flags set or not.
4572 void igv_print() {
4573 Compile::current()->igv_print_method_to_file();
4574 }
4575
4576 // Same as igv_print() above but with a specified phase name.
4577 void igv_print(const char* phase_name) {
4578 Compile::current()->igv_print_method_to_file(phase_name);
4579 }
4580
4581 // Called from debugger. Prints method with the default phase name to the default network or the one specified with
4582 // the network flags for the Ideal Graph Visualizer, or to the default file depending on the 'network' argument.
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "ci/ciReplay.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/exceptionHandlerTable.hpp"
31 #include "code/nmethod.hpp"
32 #include "compiler/compileBroker.hpp"
33 #include "compiler/compileLog.hpp"
34 #include "compiler/disassembler.hpp"
35 #include "compiler/oopMap.hpp"
36 #include "gc/shared/barrierSet.hpp"
37 #include "gc/shared/c2/barrierSetC2.hpp"
38 #include "jfr/jfrEvents.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "opto/addnode.hpp"
41 #include "opto/block.hpp"
42 #include "opto/c2compiler.hpp"
43 #include "opto/callGenerator.hpp"
44 #include "opto/callnode.hpp"
45 #include "opto/castnode.hpp"
46 #include "opto/cfgnode.hpp"
47 #include "opto/chaitin.hpp"
48 #include "opto/compile.hpp"
49 #include "opto/connode.hpp"
50 #include "opto/convertnode.hpp"
51 #include "opto/divnode.hpp"
52 #include "opto/escape.hpp"
53 #include "opto/idealGraphPrinter.hpp"
54 #include "opto/loopnode.hpp"
55 #include "opto/machnode.hpp"
56 #include "opto/macro.hpp"
57 #include "opto/matcher.hpp"
58 #include "opto/mathexactnode.hpp"
4544 NodeCloneInfo ni(val);
4545 ni.dump();
4546 }
4547 }
4548
4549 // Move Allocate nodes to the start of the list
4550 void Compile::sort_macro_nodes() {
4551 int count = macro_count();
4552 int allocates = 0;
4553 for (int i = 0; i < count; i++) {
4554 Node* n = macro_node(i);
4555 if (n->is_Allocate()) {
4556 if (i != allocates) {
4557 Node* tmp = macro_node(allocates);
4558 _macro_nodes->at_put(allocates, n);
4559 _macro_nodes->at_put(i, tmp);
4560 }
4561 allocates++;
4562 }
4563 }
4564 }
4565
4566 void Compile::print_method(CompilerPhaseType cpt, int level, int idx) {
4567 EventCompilerPhase event;
4568 if (event.should_commit()) {
4569 CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, cpt, C->_compile_id, level);
4570 }
4571
4572 #ifndef PRODUCT
4573 if (should_print(level)) {
4574 char output[1024];
4575 if (idx != 0) {
4576 jio_snprintf(output, sizeof(output), "%s:%d", CompilerPhaseTypeHelper::to_string(cpt), idx);
4577 } else {
4578 jio_snprintf(output, sizeof(output), "%s", CompilerPhaseTypeHelper::to_string(cpt));
4579 }
4580 _printer->print_method(output, level);
4581 }
4582 #endif
4583 C->_latest_stage_start_counter.stamp();
4584 }
4585
4586 void Compile::end_method(int level) {
4587 EventCompilerPhase event;
4588 if (event.should_commit()) {
4589 CompilerEvent::PhaseEvent::post(event, C->_latest_stage_start_counter, PHASE_END, C->_compile_id, level);
4590 }
4591
4592 #ifndef PRODUCT
4593 if (_printer && _printer->should_print(level)) {
4594 _printer->end_method();
4595 }
4596 #endif
4597 }
4598
4599
4600 #ifndef PRODUCT
4601 IdealGraphPrinter* Compile::_debug_file_printer = NULL;
4602 IdealGraphPrinter* Compile::_debug_network_printer = NULL;
4603
4604 // Called from debugger. Prints method to the default file with the default phase name.
4605 // This works regardless of any Ideal Graph Visualizer flags set or not.
4606 void igv_print() {
4607 Compile::current()->igv_print_method_to_file();
4608 }
4609
4610 // Same as igv_print() above but with a specified phase name.
4611 void igv_print(const char* phase_name) {
4612 Compile::current()->igv_print_method_to_file(phase_name);
4613 }
4614
4615 // Called from debugger. Prints method with the default phase name to the default network or the one specified with
4616 // the network flags for the Ideal Graph Visualizer, or to the default file depending on the 'network' argument.
|