1
1
/*
2
- * Copyright (c) 1997, 2016 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1997, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -329,6 +329,7 @@ Node::Node(uint req)
329
329
: _idx(Init(req))
330
330
#ifdef ASSERT
331
331
, _parse_idx(_idx)
332
+ , _indent(0 )
332
333
#endif
333
334
{
334
335
assert ( req < Compile::current ()->max_node_limit () - NodeLimitFudgeFactor, " Input limit exceeded" );
@@ -349,6 +350,7 @@ Node::Node(Node *n0)
349
350
: _idx(Init(1 ))
350
351
#ifdef ASSERT
351
352
, _parse_idx(_idx)
353
+ , _indent(0 )
352
354
#endif
353
355
{
354
356
debug_only ( verify_construction () );
@@ -362,6 +364,7 @@ Node::Node(Node *n0, Node *n1)
362
364
: _idx(Init(2 ))
363
365
#ifdef ASSERT
364
366
, _parse_idx(_idx)
367
+ , _indent(0 )
365
368
#endif
366
369
{
367
370
debug_only ( verify_construction () );
@@ -377,6 +380,7 @@ Node::Node(Node *n0, Node *n1, Node *n2)
377
380
: _idx(Init(3 ))
378
381
#ifdef ASSERT
379
382
, _parse_idx(_idx)
383
+ , _indent(0 )
380
384
#endif
381
385
{
382
386
debug_only ( verify_construction () );
@@ -394,6 +398,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3)
394
398
: _idx(Init(4 ))
395
399
#ifdef ASSERT
396
400
, _parse_idx(_idx)
401
+ , _indent(0 )
397
402
#endif
398
403
{
399
404
debug_only ( verify_construction () );
@@ -413,6 +418,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4)
413
418
: _idx(Init(5 ))
414
419
#ifdef ASSERT
415
420
, _parse_idx(_idx)
421
+ , _indent(0 )
416
422
#endif
417
423
{
418
424
debug_only ( verify_construction () );
@@ -435,6 +441,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3,
435
441
: _idx(Init(6 ))
436
442
#ifdef ASSERT
437
443
, _parse_idx(_idx)
444
+ , _indent(0 )
438
445
#endif
439
446
{
440
447
debug_only ( verify_construction () );
@@ -459,6 +466,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3,
459
466
: _idx(Init(7 ))
460
467
#ifdef ASSERT
461
468
, _parse_idx(_idx)
469
+ , _indent(0 )
462
470
#endif
463
471
{
464
472
debug_only ( verify_construction () );
@@ -1718,7 +1726,12 @@ void Node::dump(const char* suffix, bool mark, outputStream *st) const {
1718
1726
Compile* C = Compile::current ();
1719
1727
bool is_new = C->node_arena ()->contains (this );
1720
1728
C->_in_dump_cnt ++;
1721
- st->print (" %c%d%s\t %s\t === " , is_new ? ' ' : ' o' , _idx, mark ? " >" : " " , Name ());
1729
+
1730
+ if (_indent > 0 ) {
1731
+ st->print (" %*s" , (_indent << 1 ), " " );
1732
+ }
1733
+
1734
+ st->print (" %c%d%s%s === " , is_new ? ' ' : ' o' , _idx, mark ? " >" : " " , Name ());
1722
1735
1723
1736
// Dump the required and precedence inputs
1724
1737
dump_req (st);
@@ -1843,23 +1856,26 @@ void Node::dump_out(outputStream *st) const {
1843
1856
// moving in a given direction until a certain depth (distance from the start
1844
1857
// node) is reached. Duplicates are ignored.
1845
1858
// Arguments:
1846
- // nstack: the nodes are collected into this array.
1859
+ // queue: the nodes are collected into this array.
1847
1860
// start: the node at which to start collecting.
1848
1861
// direction: if this is a positive number, collect input nodes; if it is
1849
1862
// a negative number, collect output nodes.
1850
1863
// depth: collect nodes up to this distance from the start node.
1851
1864
// include_start: whether to include the start node in the result collection.
1852
1865
// only_ctrl: whether to regard control edges only during traversal.
1853
1866
// only_data: whether to regard data edges only during traversal.
1854
- static void collect_nodes_i (GrowableArray<Node*> *nstack, const Node* start, int direction, uint depth, bool include_start, bool only_ctrl, bool only_data) {
1867
+ static void collect_nodes_i (GrowableArray<Node*>* queue, const Node* start, int direction, uint depth, bool include_start, bool only_ctrl, bool only_data) {
1868
+ bool indent = depth <= PrintIdealIndentThreshold;
1855
1869
Node* s = (Node*) start; // remove const
1856
- nstack ->append (s);
1870
+ queue ->append (s);
1857
1871
int begin = 0 ;
1858
1872
int end = 0 ;
1873
+
1874
+ s->set_indent (0 );
1859
1875
for (uint i = 0 ; i < depth; i++) {
1860
- end = nstack ->length ();
1876
+ end = queue ->length ();
1861
1877
for (int j = begin; j < end; j++) {
1862
- Node* tp = nstack ->at (j);
1878
+ Node* tp = queue ->at (j);
1863
1879
uint limit = direction > 0 ? tp->len () : tp->outcnt ();
1864
1880
for (uint k = 0 ; k < limit; k++) {
1865
1881
Node* n = direction > 0 ? tp->in (k) : tp->raw_out (k);
@@ -1869,35 +1885,35 @@ static void collect_nodes_i(GrowableArray<Node*> *nstack, const Node* start, int
1869
1885
if (n->is_Root () || n->is_top ()) continue ;
1870
1886
if (only_ctrl && !n->is_CFG ()) continue ;
1871
1887
if (only_data && n->is_CFG ()) continue ;
1872
-
1873
- bool on_stack = nstack-> contains (n);
1874
- if (!on_stack) {
1875
- nstack-> append (n );
1888
+ bool in_queue = queue-> contains (n);
1889
+ if (!in_queue) {
1890
+ queue-> append (n);
1891
+ n-> set_indent (indent ? (i + 1 ) : 0 );
1876
1892
}
1877
1893
}
1878
1894
}
1879
1895
begin = end;
1880
1896
}
1881
1897
if (!include_start) {
1882
- nstack ->remove (s);
1898
+ queue ->remove (s);
1883
1899
}
1884
1900
}
1885
1901
1886
1902
// ------------------------------dump_nodes-------------------------------------
1887
1903
static void dump_nodes (const Node* start, int d, bool only_ctrl) {
1888
1904
if (NotANode (start)) return ;
1889
1905
1890
- GrowableArray <Node *> nstack (Compile::current ()->live_nodes ());
1891
- collect_nodes_i (&nstack , start, d, (uint ) ABS (d), true , only_ctrl, false );
1906
+ GrowableArray <Node *> queue (Compile::current ()->live_nodes ());
1907
+ collect_nodes_i (&queue , start, d, (uint ) ABS (d), true , only_ctrl, false );
1892
1908
1893
- int end = nstack .length ();
1909
+ int end = queue .length ();
1894
1910
if (d > 0 ) {
1895
1911
for (int j = end-1 ; j >= 0 ; j--) {
1896
- nstack .at (j)->dump ();
1912
+ queue .at (j)->dump ();
1897
1913
}
1898
1914
} else {
1899
1915
for (int j = 0 ; j < end; j++) {
1900
- nstack .at (j)->dump ();
1916
+ queue .at (j)->dump ();
1901
1917
}
1902
1918
}
1903
1919
}
0 commit comments