@@ -657,7 +657,7 @@ void Node::destruct(PhaseValues* phase) {
657
657
658
658
// ------------------------------grow-------------------------------------------
659
659
// Grow the input array, making space for more edges
660
- void Node::grow ( uint len ) {
660
+ void Node::grow (uint len) {
661
661
Arena* arena = Compile::current ()->node_arena ();
662
662
uint new_max = _max;
663
663
if ( new_max == 0 ) {
@@ -2263,95 +2263,55 @@ void Node::verify(Node* n, int verify_depth) {
2263
2263
}
2264
2264
#endif // not PRODUCT
2265
2265
2266
- // ------------------------------walk-------------------------------------------
2267
- // Graph walk, with both pre-order and post-order functions
2268
- void Node::walk (NFunc pre, NFunc post, void *env) {
2269
- VectorSet visited; // Setup for local walk
2270
- walk_ (pre, post, env, visited);
2271
- }
2272
-
2273
- void Node::walk_ (NFunc pre, NFunc post, void *env, VectorSet &visited) {
2274
- if ( visited.test_set (_idx) ) return ;
2275
- pre (*this ,env); // Call the pre-order walk function
2276
- for ( uint i=0 ; i<_max; i++ )
2277
- if ( in (i) ) // Input exists and is not walked?
2278
- in (i)->walk_ (pre,post,env,visited); // Walk it with pre & post functions
2279
- post (*this ,env); // Call the post-order walk function
2280
- }
2281
-
2282
- void Node::nop (Node &, void *) {}
2283
-
2284
2266
// ------------------------------Registers--------------------------------------
2285
2267
// Do we Match on this edge index or not? Generally false for Control
2286
2268
// and true for everything else. Weird for calls & returns.
2287
2269
uint Node::match_edge (uint idx) const {
2288
2270
return idx; // True for other than index 0 (control)
2289
2271
}
2290
2272
2291
- static RegMask _not_used_at_all;
2292
2273
// Register classes are defined for specific machines
2293
2274
const RegMask &Node::out_RegMask () const {
2294
2275
ShouldNotCallThis ();
2295
- return _not_used_at_all ;
2276
+ return RegMask::Empty ;
2296
2277
}
2297
2278
2298
2279
const RegMask &Node::in_RegMask (uint) const {
2299
2280
ShouldNotCallThis ();
2300
- return _not_used_at_all ;
2281
+ return RegMask::Empty ;
2301
2282
}
2302
2283
2303
- // =============================================================================
2304
- // -----------------------------------------------------------------------------
2305
- void Node_Array::reset ( Arena *new_arena ) {
2306
- _a->Afree (_nodes,_max*sizeof (Node*));
2307
- _max = 0 ;
2308
- _nodes = NULL ;
2309
- _a = new_arena;
2310
- }
2311
-
2312
- // ------------------------------clear------------------------------------------
2313
2284
// Clear all entries in _nodes to NULL but keep storage
2314
2285
void Node_Array::clear () {
2315
2286
Copy::zero_to_bytes ( _nodes, _max*sizeof (Node*) );
2316
2287
}
2317
2288
2318
- // -----------------------------------------------------------------------------
2319
- void Node_Array::grow ( uint i ) {
2320
- if ( !_max ) {
2321
- _max = 1 ;
2322
- _nodes = (Node**)_a->Amalloc ( _max * sizeof (Node*) );
2323
- _nodes[0 ] = NULL ;
2324
- }
2289
+ void Node_Array::grow (uint i) {
2290
+ assert (_max > 0 , " invariant" );
2325
2291
uint old = _max;
2326
2292
_max = next_power_of_2 (i);
2327
2293
_nodes = (Node**)_a->Arealloc ( _nodes, old*sizeof (Node*),_max*sizeof (Node*));
2328
2294
Copy::zero_to_bytes ( &_nodes[old], (_max-old)*sizeof (Node*) );
2329
2295
}
2330
2296
2331
- // -----------------------------------------------------------------------------
2332
- void Node_Array::insert ( uint i, Node *n ) {
2333
- if ( _nodes[_max-1 ] ) grow (_max); // Get more space if full
2334
- Copy::conjoint_words_to_higher ((HeapWord*)&_nodes[i], (HeapWord*)&_nodes[i+1 ], ((_max-i-1 )*sizeof (Node*)));
2297
+ void Node_Array::insert (uint i, Node* n) {
2298
+ if (_nodes[_max - 1 ]) {
2299
+ grow (_max);
2300
+ }
2301
+ Copy::conjoint_words_to_higher ((HeapWord*)&_nodes[i], (HeapWord*)&_nodes[i + 1 ], ((_max - i - 1 ) * sizeof (Node*)));
2335
2302
_nodes[i] = n;
2336
2303
}
2337
2304
2338
- // -----------------------------------------------------------------------------
2339
- void Node_Array::remove ( uint i ) {
2340
- Copy::conjoint_words_to_lower ((HeapWord*)&_nodes[i+1 ], (HeapWord*)&_nodes[i], ((_max-i-1 )*sizeof (Node*)));
2341
- _nodes[_max-1 ] = NULL ;
2342
- }
2343
-
2344
- // -----------------------------------------------------------------------------
2345
- void Node_Array::sort ( C_sort_func_t func) {
2346
- qsort ( _nodes, _max, sizeof ( Node* ), func );
2305
+ void Node_Array::remove (uint i) {
2306
+ Copy::conjoint_words_to_lower ((HeapWord*)&_nodes[i + 1 ], (HeapWord*)&_nodes[i], ((_max - i - 1 ) * sizeof (Node*)));
2307
+ _nodes[_max - 1 ] = NULL ;
2347
2308
}
2348
2309
2349
- // -----------------------------------------------------------------------------
2350
2310
void Node_Array::dump () const {
2351
2311
#ifndef PRODUCT
2352
- for ( uint i = 0 ; i < _max; i++ ) {
2353
- Node * nn = _nodes[i];
2354
- if ( nn != NULL ) {
2312
+ for ( uint i = 0 ; i < _max; i++) {
2313
+ Node* nn = _nodes[i];
2314
+ if ( nn != NULL ) {
2355
2315
tty->print (" %5d--> " ,i); nn->dump ();
2356
2316
}
2357
2317
}
@@ -2414,7 +2374,9 @@ Node* Node::unique_ctrl_out() const {
2414
2374
for (uint i = 0 ; i < outcnt (); i++) {
2415
2375
Node* use = raw_out (i);
2416
2376
if (use->is_CFG () && use != this ) {
2417
- if (found != NULL ) return NULL ;
2377
+ if (found != NULL ) {
2378
+ return NULL ;
2379
+ }
2418
2380
found = use;
2419
2381
}
2420
2382
}
@@ -2457,33 +2419,38 @@ bool Node::is_dead_loop_safe() const {
2457
2419
// Find and remove
2458
2420
void Node_List::yank ( Node *n ) {
2459
2421
uint i;
2460
- for ( i = 0 ; i < _cnt; i++ )
2461
- if ( _nodes[i] == n )
2422
+ for ( i = 0 ; i < _cnt; i++) {
2423
+ if ( _nodes[i] == n) {
2462
2424
break ;
2425
+ }
2426
+ }
2463
2427
2464
- if ( i < _cnt )
2428
+ if ( i < _cnt) {
2465
2429
_nodes[i] = _nodes[--_cnt];
2430
+ }
2466
2431
}
2467
2432
2468
2433
// ------------------------------dump-------------------------------------------
2469
2434
void Node_List::dump () const {
2470
2435
#ifndef PRODUCT
2471
- for ( uint i = 0 ; i < _cnt; i++ )
2472
- if ( _nodes[i] ) {
2473
- tty->print (" %5d--> " ,i);
2436
+ for ( uint i = 0 ; i < _cnt; i++) {
2437
+ if ( _nodes[i]) {
2438
+ tty->print (" %5d--> " , i);
2474
2439
_nodes[i]->dump ();
2475
2440
}
2441
+ }
2476
2442
#endif
2477
2443
}
2478
2444
2479
2445
void Node_List::dump_simple () const {
2480
2446
#ifndef PRODUCT
2481
- for ( uint i = 0 ; i < _cnt; i++ )
2447
+ for ( uint i = 0 ; i < _cnt; i++) {
2482
2448
if ( _nodes[i] ) {
2483
2449
tty->print (" %d" , _nodes[i]->_idx );
2484
2450
} else {
2485
2451
tty->print (" NULL" );
2486
2452
}
2453
+ }
2487
2454
#endif
2488
2455
}
2489
2456
@@ -2505,17 +2472,12 @@ void Unique_Node_List::remove(Node* n) {
2505
2472
// -----------------------remove_useless_nodes----------------------------------
2506
2473
// Remove useless nodes from worklist
2507
2474
void Unique_Node_List::remove_useless_nodes (VectorSet &useful) {
2508
-
2509
2475
for (uint i = 0 ; i < size (); ++i) {
2510
2476
Node *n = at (i);
2511
2477
assert ( n != NULL , " Did not expect null entries in worklist" );
2512
2478
if (!useful.test (n->_idx )) {
2513
2479
_in_worklist.remove (n->_idx );
2514
- map (i,Node_List::pop ());
2515
- // Node *replacement = Node_List::pop();
2516
- // if( i != size() ) { // Check if removing last entry
2517
- // _nodes[i] = replacement;
2518
- // }
2480
+ map (i, Node_List::pop ());
2519
2481
--i; // Visit popped node
2520
2482
// If it was last entry, loop terminates since size() was also reduced
2521
2483
}
@@ -2535,9 +2497,10 @@ void Node_Stack::grow() {
2535
2497
// Node_Stack is used to map nodes.
2536
2498
Node* Node_Stack::find (uint idx) const {
2537
2499
uint sz = size ();
2538
- for (uint i= 0 ; i < sz; i++) {
2539
- if (idx == index_at (i) )
2500
+ for (uint i = 0 ; i < sz; i++) {
2501
+ if (idx == index_at (i)) {
2540
2502
return node_at (i);
2503
+ }
2541
2504
}
2542
2505
return NULL ;
2543
2506
}
@@ -2546,7 +2509,7 @@ Node* Node_Stack::find(uint idx) const {
2546
2509
uint TypeNode::size_of () const { return sizeof (*this ); }
2547
2510
#ifndef PRODUCT
2548
2511
void TypeNode::dump_spec (outputStream *st) const {
2549
- if ( !Verbose && !WizardMode ) {
2512
+ if ( !Verbose && !WizardMode) {
2550
2513
// standard dump does this in Verbose and WizardMode
2551
2514
st->print (" #" ); _type->dump_on (st);
2552
2515
}
@@ -2560,9 +2523,10 @@ void TypeNode::dump_compact_spec(outputStream *st) const {
2560
2523
uint TypeNode::hash () const {
2561
2524
return Node::hash () + _type->hash ();
2562
2525
}
2563
- bool TypeNode::cmp ( const Node &n ) const
2564
- { return !Type::cmp ( _type, ((TypeNode&)n)._type ); }
2565
- const Type *TypeNode::bottom_type () const { return _type; }
2526
+ bool TypeNode::cmp (const Node& n) const {
2527
+ return !Type::cmp (_type, ((TypeNode&)n)._type );
2528
+ }
2529
+ const Type* TypeNode::bottom_type () const { return _type; }
2566
2530
const Type* TypeNode::Value (PhaseGVN* phase) const { return _type; }
2567
2531
2568
2532
// ------------------------------ideal_reg--------------------------------------
0 commit comments