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 "ci/ciConstant.hpp"
27 #include "ci/ciField.hpp"
28 #include "ci/ciMethod.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "ci/ciObjArrayKlass.hpp"
31 #include "ci/ciStreams.hpp"
32 #include "ci/ciTypeArrayKlass.hpp"
33 #include "ci/ciTypeFlow.hpp"
34 #include "compiler/compileLog.hpp"
35 #include "interpreter/bytecode.hpp"
36 #include "interpreter/bytecodes.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "runtime/deoptimization.hpp"
39 #include "utilities/growableArray.hpp"
40
41 // ciTypeFlow::JsrSet
42 //
43 // A JsrSet represents some set of JsrRecords. This class
44 // is used to record a set of all jsr routines which we permit
45 // execution to return (ret) from.
46 //
47 // During abstract interpretation, JsrSets are used to determine
48 // whether two paths which reach a given block are unique, and
49 // should be cloned apart, or are compatible, and should merge
50 // together.
51
52 // ------------------------------------------------------------------
53 // ciTypeFlow::JsrSet::JsrSet
54 ciTypeFlow::JsrSet::JsrSet(Arena* arena, int default_len) {
55 if (arena != NULL) {
56 // Allocate growable array in Arena.
57 _set = new (arena) GrowableArray<JsrRecord*>(arena, default_len, 0, NULL);
2629 root_head->set_post_order(0);
2630 root_tail->set_pre_order(max_jint);
2631 root_tail->set_post_order(max_jint);
2632 set_loop_tree_root(new (arena()) Loop(root_head, root_tail));
2633
2634 stk.push(start);
2635
2636 _next_pre_order = 0; // initialize pre_order counter
2637 _rpo_list = NULL;
2638 int next_po = 0; // initialize post_order counter
2639
2640 // Compute RPO and the control flow graph
2641 int size;
2642 while ((size = stk.length()) > 0) {
2643 Block* blk = stk.top(); // Leave node on stack
2644 if (!blk->is_visited()) {
2645 // forward arc in graph
2646 assert (!blk->has_pre_order(), "");
2647 blk->set_next_pre_order();
2648
2649 if (_next_pre_order >= MaxNodeLimit / 2) {
2650 // Too many basic blocks. Bail out.
2651 // This can happen when try/finally constructs are nested to depth N,
2652 // and there is O(2**N) cloning of jsr bodies. See bug 4697245!
2653 // "MaxNodeLimit / 2" is used because probably the parser will
2654 // generate at least twice that many nodes and bail out.
2655 record_failure("too many basic blocks");
2656 return;
2657 }
2658 if (do_flow) {
2659 flow_block(blk, temp_vector, temp_set);
2660 if (failing()) return; // Watch for bailouts.
2661 }
2662 } else if (!blk->is_post_visited()) {
2663 // cross or back arc
2664 for (SuccIter iter(blk); !iter.done(); iter.next()) {
2665 Block* succ = iter.succ();
2666 if (!succ->is_visited()) {
2667 stk.push(succ);
2668 }
2669 }
|
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 "ci/ciConstant.hpp"
27 #include "ci/ciField.hpp"
28 #include "ci/ciMethod.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "ci/ciObjArrayKlass.hpp"
31 #include "ci/ciStreams.hpp"
32 #include "ci/ciTypeArrayKlass.hpp"
33 #include "ci/ciTypeFlow.hpp"
34 #include "compiler/compileLog.hpp"
35 #include "interpreter/bytecode.hpp"
36 #include "interpreter/bytecodes.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "opto/compile.hpp"
39 #include "runtime/deoptimization.hpp"
40 #include "utilities/growableArray.hpp"
41
42 // ciTypeFlow::JsrSet
43 //
44 // A JsrSet represents some set of JsrRecords. This class
45 // is used to record a set of all jsr routines which we permit
46 // execution to return (ret) from.
47 //
48 // During abstract interpretation, JsrSets are used to determine
49 // whether two paths which reach a given block are unique, and
50 // should be cloned apart, or are compatible, and should merge
51 // together.
52
53 // ------------------------------------------------------------------
54 // ciTypeFlow::JsrSet::JsrSet
55 ciTypeFlow::JsrSet::JsrSet(Arena* arena, int default_len) {
56 if (arena != NULL) {
57 // Allocate growable array in Arena.
58 _set = new (arena) GrowableArray<JsrRecord*>(arena, default_len, 0, NULL);
2630 root_head->set_post_order(0);
2631 root_tail->set_pre_order(max_jint);
2632 root_tail->set_post_order(max_jint);
2633 set_loop_tree_root(new (arena()) Loop(root_head, root_tail));
2634
2635 stk.push(start);
2636
2637 _next_pre_order = 0; // initialize pre_order counter
2638 _rpo_list = NULL;
2639 int next_po = 0; // initialize post_order counter
2640
2641 // Compute RPO and the control flow graph
2642 int size;
2643 while ((size = stk.length()) > 0) {
2644 Block* blk = stk.top(); // Leave node on stack
2645 if (!blk->is_visited()) {
2646 // forward arc in graph
2647 assert (!blk->has_pre_order(), "");
2648 blk->set_next_pre_order();
2649
2650 if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) {
2651 // Too many basic blocks. Bail out.
2652 // This can happen when try/finally constructs are nested to depth N,
2653 // and there is O(2**N) cloning of jsr bodies. See bug 4697245!
2654 // "MaxNodeLimit / 2" is used because probably the parser will
2655 // generate at least twice that many nodes and bail out.
2656 record_failure("too many basic blocks");
2657 return;
2658 }
2659 if (do_flow) {
2660 flow_block(blk, temp_vector, temp_set);
2661 if (failing()) return; // Watch for bailouts.
2662 }
2663 } else if (!blk->is_post_visited()) {
2664 // cross or back arc
2665 for (SuccIter iter(blk); !iter.done(); iter.next()) {
2666 Block* succ = iter.succ();
2667 if (!succ->is_visited()) {
2668 stk.push(succ);
2669 }
2670 }
|