1 /*
2 * Copyright (c) 2000, 2018, 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 *
1261 return 0;
1262 }
1263 Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, use,use_rm,def_rm);
1264 n->set_req(copyidx,spill);
1265 n->as_MachSpillCopy()->set_in_RegMask(def_rm);
1266 // Put the spill just before the copy
1267 insert_proj( b, insidx++, spill, maxlrg++ );
1268 }
1269 }
1270 }
1271 }
1272 } // End For All Instructions in Block - Non-PHI Pass
1273
1274 // Check if each LRG is live out of this block so as not to propagate
1275 // beyond the last use of a LRG.
1276 for( slidx = 0; slidx < spill_cnt; slidx++ ) {
1277 uint defidx = lidxs.at(slidx);
1278 IndexSet *liveout = _live->live(b);
1279 if( !liveout->member(defidx) ) {
1280 #ifdef ASSERT
1281 // The index defidx is not live. Check the liveout array to ensure that
1282 // it contains no members which compress to defidx. Finding such an
1283 // instance may be a case to add liveout adjustment in compress_uf_map().
1284 // See 5063219.
1285 uint member;
1286 IndexSetIterator isi(liveout);
1287 while ((member = isi.next()) != 0) {
1288 assert(defidx != _lrg_map.find_const(member), "Live out member has not been compressed");
1289 }
1290 #endif
1291 Reachblock[slidx] = NULL;
1292 } else {
1293 assert(Reachblock[slidx] != NULL,"No reaching definition for liveout value");
1294 }
1295 }
1296 #ifndef PRODUCT
1297 if( trace_spilling() )
1298 b->dump();
1299 #endif
1300 } // End For All Blocks
1301
1302 //----------PASS 2----------
1303 // Reset all DEF live range numbers here
1304 for( insidx = 0; insidx < defs->size(); insidx++ ) {
1305 // Grab the def
1306 n1 = defs->at(insidx);
1307 // Set new lidx for DEF
1308 new_lrg(n1, maxlrg++);
|
1 /*
2 * Copyright (c) 2000, 2021, 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 *
1261 return 0;
1262 }
1263 Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, use,use_rm,def_rm);
1264 n->set_req(copyidx,spill);
1265 n->as_MachSpillCopy()->set_in_RegMask(def_rm);
1266 // Put the spill just before the copy
1267 insert_proj( b, insidx++, spill, maxlrg++ );
1268 }
1269 }
1270 }
1271 }
1272 } // End For All Instructions in Block - Non-PHI Pass
1273
1274 // Check if each LRG is live out of this block so as not to propagate
1275 // beyond the last use of a LRG.
1276 for( slidx = 0; slidx < spill_cnt; slidx++ ) {
1277 uint defidx = lidxs.at(slidx);
1278 IndexSet *liveout = _live->live(b);
1279 if( !liveout->member(defidx) ) {
1280 #ifdef ASSERT
1281 if (VerifyRegisterAllocator) {
1282 // The index defidx is not live. Check the liveout array to ensure that
1283 // it contains no members which compress to defidx. Finding such an
1284 // instance may be a case to add liveout adjustment in compress_uf_map().
1285 // See 5063219.
1286 uint member;
1287 IndexSetIterator isi(liveout);
1288 while ((member = isi.next()) != 0) {
1289 assert(defidx != _lrg_map.find_const(member), "Live out member has not been compressed");
1290 }
1291 }
1292 #endif
1293 Reachblock[slidx] = NULL;
1294 } else {
1295 assert(Reachblock[slidx] != NULL,"No reaching definition for liveout value");
1296 }
1297 }
1298 #ifndef PRODUCT
1299 if( trace_spilling() )
1300 b->dump();
1301 #endif
1302 } // End For All Blocks
1303
1304 //----------PASS 2----------
1305 // Reset all DEF live range numbers here
1306 for( insidx = 0; insidx < defs->size(); insidx++ ) {
1307 // Grab the def
1308 n1 = defs->at(insidx);
1309 // Set new lidx for DEF
1310 new_lrg(n1, maxlrg++);
|