comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2769:dd6419f4bfe2

Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 23 May 2011 21:21:47 +0200
parents 43ffa0e47a46
children 056e392d63d4
comparison
equal deleted inserted replaced
2768:43ffa0e47a46 2769:dd6419f4bfe2
1237 default: 1237 default:
1238 Util.shouldNotReachHere(); 1238 Util.shouldNotReachHere();
1239 } 1239 }
1240 } 1240 }
1241 1241
1242 void moveToPhi(PhiResolver resolver, Value curVal, Value suxVal) { 1242 void moveToPhi(PhiResolver resolver, Value curVal, Value suxVal, List<Phi> phis, int predIndex) {
1243 // move current value to referenced phi function 1243 // move current value to referenced phi function
1244 if (suxVal instanceof Phi) { 1244 if (suxVal instanceof Phi) {
1245 Phi phi = (Phi) suxVal; 1245 Phi phi = (Phi) suxVal;
1246
1246 // curVal can be null without phi being null in conjunction with inlining 1247 // curVal can be null without phi being null in conjunction with inlining
1247 if (!phi.isDeadPhi() && curVal != null && curVal != phi) { 1248 if (!phi.isDeadPhi() && curVal != null && curVal != phi) {
1249
1250 assert phis.contains(phi);
1251 if (phi.valueAt(predIndex) != curVal) {
1252 phi.print(TTY.out());
1253 }
1254 assert phi.valueAt(predIndex) == curVal : "curVal=" + curVal + "valueAt(" + predIndex + ")=" + phi.valueAt(predIndex);
1255
1248 assert !phi.isIllegal() : "illegal phi cannot be marked as live"; 1256 assert !phi.isIllegal() : "illegal phi cannot be marked as live";
1249 if (curVal instanceof Phi) { 1257 if (curVal instanceof Phi) {
1250 operandForPhi((Phi) curVal); 1258 operandForPhi((Phi) curVal);
1251 } 1259 }
1252 CiValue operand = curVal.operand(); 1260 CiValue operand = curVal.operand();
1291 if (sux.numberOfPreds() > 1) { 1299 if (sux.numberOfPreds() > 1) {
1292 FrameState suxState = sux.stateBefore(); 1300 FrameState suxState = sux.stateBefore();
1293 1301
1294 1302
1295 List<Phi> phis = getPhis(sux); 1303 List<Phi> phis = getPhis(sux);
1304
1305 int predIndex = 0;
1306 for (; predIndex < sux.numberOfPreds(); ++predIndex) {
1307 if (sux.predAt(predIndex) == bb) {
1308 break;
1309 }
1310 }
1311 assert predIndex < sux.numberOfPreds();
1312
1296 if (phis != null) { 1313 if (phis != null) {
1297 int predIndex = 0;
1298 for (; predIndex < sux.numberOfPreds(); ++predIndex) {
1299 if (sux.predAt(predIndex) == bb) {
1300 break;
1301 }
1302 }
1303 assert predIndex < sux.numberOfPreds();
1304
1305 // TTY.println("predIndex=" + predIndex + ", bb" + bb.blockID() + ", sux=" + sux.blockID());
1306 // for (int i = 0; i < sux.numberOfPreds(); ++i) {
1307 // TTY.println("pred[" + i + "]=" + sux.predAt(i).blockID());
1308 // }
1309
1310 PhiResolver resolver = new PhiResolver(this); 1314 PhiResolver resolver = new PhiResolver(this);
1311 for (Phi phi : phis) { 1315 for (Phi phi : phis) {
1312 if (!phi.isDeadPhi() && phi.valueCount() > predIndex) { 1316 if (!phi.isDeadPhi() && phi.valueCount() > predIndex) {
1313 Value curVal = phi.valueAt(predIndex); 1317 Value curVal = phi.valueAt(predIndex);
1314 if (curVal != null) { 1318 if (curVal != null && curVal != phi) {
1315 if (curVal instanceof Phi) { 1319 if (curVal instanceof Phi) {
1316 operandForPhi((Phi) curVal); 1320 operandForPhi((Phi) curVal);
1317 } 1321 }
1318 CiValue operand = curVal.operand(); 1322 CiValue operand = curVal.operand();
1319 if (operand.isIllegal()) { 1323 if (operand.isIllegal()) {
1320 // phi.print(TTY.out());
1321 assert curVal instanceof Constant || curVal instanceof Local : "these can be produced lazily" + curVal + "/" + phi; 1324 assert curVal instanceof Constant || curVal instanceof Local : "these can be produced lazily" + curVal + "/" + phi;
1322 operand = operandForInstruction(curVal); 1325 operand = operandForInstruction(curVal);
1323 } 1326 }
1324 resolver.move(operand, operandForPhi(phi)); 1327 resolver.move(operand, operandForPhi(phi));
1325 } 1328 }
1326 } 1329 }
1327 } 1330 }
1328 resolver.dispose(); 1331 resolver.dispose();
1329 } 1332 }
1330 1333
1331 /* PhiResolver resolver = new PhiResolver(this); 1334 /*TTY.println("number of preds: " + sux.numberOfPreds());
1335
1336 PhiResolver resolver = new PhiResolver(this);
1337
1332 1338
1333 for (int index = 0; index < suxState.stackSize(); index++) { 1339 for (int index = 0; index < suxState.stackSize(); index++) {
1334 moveToPhi(resolver, curState.stackAt(index), suxState.stackAt(index)); 1340 moveToPhi(resolver, curState.stackAt(index), suxState.stackAt(index), phis, predIndex);
1335 } 1341 }
1336 1342
1337 for (int index = 0; index < suxState.localsSize(); index++) { 1343 for (int index = 0; index < suxState.localsSize(); index++) {
1338 moveToPhi(resolver, curState.localAt(index), suxState.localAt(index)); 1344 moveToPhi(resolver, curState.localAt(index), suxState.localAt(index), phis, predIndex);
1339 } 1345 }
1340 resolver.dispose();*/ 1346 resolver.dispose();*/
1341 } 1347 }
1342 } 1348 }
1343 } 1349 }