src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/memnode.cpp

Print this page
rev 7139 : 8058847: C2: EliminateAutoBox regression after 8042786
Reviewed-by: ?


1240             } else if (result->is_Add() && result->in(2)->is_Con() &&
1241                        result->in(1)->Opcode() == Op_LShiftX &&
1242                        result->in(1)->in(2) == phase->intcon(shift)) {
1243               // We can't do general optimization: ((X<<Z) + Y) >> Z ==> X + (Y>>Z)
1244               // but for boxing cache access we know that X<<Z will not overflow
1245               // (there is range check) so we do this optimizatrion by hand here.
1246               Node* add_con = new RShiftXNode(result->in(2), phase->intcon(shift));
1247               result = new AddXNode(result->in(1)->in(1), phase->transform(add_con));
1248             } else {
1249               result = new RShiftXNode(result, phase->intcon(shift));
1250             }
1251 #ifdef _LP64
1252             if (bt != T_LONG) {
1253               result = new ConvL2INode(phase->transform(result));
1254             }
1255 #else
1256             if (bt == T_LONG) {
1257               result = new ConvI2LNode(phase->transform(result));
1258             }
1259 #endif










1260             return result;
1261           }
1262         }
1263       }
1264     }
1265   }
1266   return NULL;
1267 }
1268 
1269 static bool stable_phi(PhiNode* phi, PhaseGVN *phase) {
1270   Node* region = phi->in(0);
1271   if (region == NULL) {
1272     return false; // Wait stable graph
1273   }
1274   uint cnt = phi->req();
1275   for (uint i = 1; i < cnt; i++) {
1276     Node* rc = region->in(i);
1277     if (rc == NULL || phase->type(rc) == Type::TOP)
1278       return false; // Wait stable graph
1279     Node* in = phi->in(i);




1240             } else if (result->is_Add() && result->in(2)->is_Con() &&
1241                        result->in(1)->Opcode() == Op_LShiftX &&
1242                        result->in(1)->in(2) == phase->intcon(shift)) {
1243               // We can't do general optimization: ((X<<Z) + Y) >> Z ==> X + (Y>>Z)
1244               // but for boxing cache access we know that X<<Z will not overflow
1245               // (there is range check) so we do this optimizatrion by hand here.
1246               Node* add_con = new RShiftXNode(result->in(2), phase->intcon(shift));
1247               result = new AddXNode(result->in(1)->in(1), phase->transform(add_con));
1248             } else {
1249               result = new RShiftXNode(result, phase->intcon(shift));
1250             }
1251 #ifdef _LP64
1252             if (bt != T_LONG) {
1253               result = new ConvL2INode(phase->transform(result));
1254             }
1255 #else
1256             if (bt == T_LONG) {
1257               result = new ConvI2LNode(phase->transform(result));
1258             }
1259 #endif
1260             // Boxing/unboxing can be done from signed & unsigned loads (e.g. LoadUB -> ... -> LoadB pair).
1261             // Need to preserve unboxing load type if it is unsigned.
1262             switch(this->Opcode()) {
1263               case Op_LoadUB:
1264                 result = new AndINode(phase->transform(result), phase->intcon(0xFF));
1265                 break;
1266               case Op_LoadUS:
1267                 result = new AndINode(phase->transform(result), phase->intcon(0xFFFF));
1268                 break;
1269             }
1270             return result;
1271           }
1272         }
1273       }
1274     }
1275   }
1276   return NULL;
1277 }
1278 
1279 static bool stable_phi(PhiNode* phi, PhaseGVN *phase) {
1280   Node* region = phi->in(0);
1281   if (region == NULL) {
1282     return false; // Wait stable graph
1283   }
1284   uint cnt = phi->req();
1285   for (uint i = 1; i < cnt; i++) {
1286     Node* rc = region->in(i);
1287     if (rc == NULL || phase->type(rc) == Type::TOP)
1288       return false; // Wait stable graph
1289     Node* in = phi->in(i);


src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File