@@ -503,7 +503,6 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
503
503
uint bidx, pidx, slidx, insidx, inpidx, twoidx;
504
504
uint non_phi = 1 , spill_cnt = 0 ;
505
505
Node *n1, *n2, *n3;
506
- Node_List *defs,*phis;
507
506
bool *UPblock;
508
507
bool u1, u2, u3;
509
508
Block *b, *pred;
@@ -519,9 +518,6 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
519
518
// ----------Setup Code----------
520
519
// Create a convenient mapping from lrg numbers to reaches/leaves indices
521
520
uint *lrg2reach = NEW_SPLIT_ARRAY (uint , maxlrg);
522
- // Keep track of DEFS & Phis for later passes
523
- defs = new Node_List ();
524
- phis = new Node_List ();
525
521
// Gather info on which LRG's are spilling, and build maps
526
522
for (bidx = 1 ; bidx < maxlrg; bidx++) {
527
523
if (lrgs (bidx).alive () && lrgs (bidx).reg () >= LRG::SPILL_REG) {
@@ -569,8 +565,14 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
569
565
#undef NEW_SPLIT_ARRAY
570
566
571
567
// Initialize to array of empty vectorsets
572
- for ( slidx = 0 ; slidx < spill_cnt; slidx++ )
573
- UP_entry[slidx] = new VectorSet (split_arena);
568
+ // Each containing at most spill_cnt * _cfg.number_of_blocks() entries.
569
+ for (slidx = 0 ; slidx < spill_cnt; slidx++) {
570
+ UP_entry[slidx] = new (split_arena) VectorSet (split_arena);
571
+ }
572
+
573
+ // Keep track of DEFS & Phis for later passes
574
+ Node_List defs (split_arena, 8 );
575
+ Node_List phis (split_arena, 16 );
574
576
575
577
// ----------PASS 1----------
576
578
// ----------Propagation & Node Insertion Code----------
@@ -702,7 +704,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
702
704
} // end if not found correct phi
703
705
// Here you have either found or created the Phi, so record it
704
706
assert (phi != nullptr ," Must have a Phi Node here" );
705
- phis-> push (phi);
707
+ phis. push (phi);
706
708
// PhiNodes should either force the LRG UP or DOWN depending
707
709
// on its inputs and the register pressure in the Phi's block.
708
710
UPblock[slidx] = true ; // Assume new DEF is UP
@@ -1189,7 +1191,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
1189
1191
if ( deflrg.reg () >= LRG::SPILL_REG ) { // Spilled?
1190
1192
uint slidx = lrg2reach[defidx];
1191
1193
// Add to defs list for later assignment of new live range number
1192
- defs-> push (n);
1194
+ defs. push (n);
1193
1195
// Set a flag on the Node indicating it has already spilled.
1194
1196
// Only do it for capacity spills not conflict spills.
1195
1197
if ( !deflrg._direct_conflict )
@@ -1308,9 +1310,9 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
1308
1310
1309
1311
// ----------PASS 2----------
1310
1312
// Reset all DEF live range numbers here
1311
- for ( insidx = 0 ; insidx < defs-> size (); insidx++ ) {
1313
+ for ( insidx = 0 ; insidx < defs. size (); insidx++ ) {
1312
1314
// Grab the def
1313
- n1 = defs-> at (insidx);
1315
+ n1 = defs. at (insidx);
1314
1316
// Set new lidx for DEF
1315
1317
new_lrg (n1, maxlrg++);
1316
1318
}
@@ -1320,8 +1322,8 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
1320
1322
// info for each spilled LRG and update edges.
1321
1323
// Walk the phis list to patch inputs, split phis, and name phis
1322
1324
uint lrgs_before_phi_split = maxlrg;
1323
- for ( insidx = 0 ; insidx < phis-> size (); insidx++ ) {
1324
- Node *phi = phis-> at (insidx);
1325
+ for ( insidx = 0 ; insidx < phis. size (); insidx++ ) {
1326
+ Node *phi = phis. at (insidx);
1325
1327
assert (phi->is_Phi ()," This list must only contain Phi Nodes" );
1326
1328
Block *b = _cfg.get_block_for_node (phi);
1327
1329
// Grab the live range number
@@ -1389,8 +1391,8 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
1389
1391
1390
1392
// ----------PASS 3----------
1391
1393
// Pass over all Phi's to union the live ranges
1392
- for ( insidx = 0 ; insidx < phis-> size (); insidx++ ) {
1393
- Node *phi = phis-> at (insidx);
1394
+ for ( insidx = 0 ; insidx < phis. size (); insidx++ ) {
1395
+ Node *phi = phis. at (insidx);
1394
1396
assert (phi->is_Phi ()," This list must only contain Phi Nodes" );
1395
1397
// Walk all inputs to Phi and Union input live range with Phi live range
1396
1398
for ( uint i = 1 ; i < phi->req (); i++ ) {
@@ -1408,9 +1410,9 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
1408
1410
} // End for all inputs to the Phi Node
1409
1411
} // End for all Phi Nodes
1410
1412
// Now union all two address instructions
1411
- for (insidx = 0 ; insidx < defs-> size (); insidx++) {
1413
+ for (insidx = 0 ; insidx < defs. size (); insidx++) {
1412
1414
// Grab the def
1413
- n1 = defs-> at (insidx);
1415
+ n1 = defs. at (insidx);
1414
1416
// Set new lidx for DEF & handle 2-addr instructions
1415
1417
if (n1->is_Mach () && ((twoidx = n1->as_Mach ()->two_adr ()) != 0 )) {
1416
1418
assert (_lrg_map.find (n1->in (twoidx)) < maxlrg," Assigning bad live range index" );
0 commit comments