comparison src/share/vm/opto/parse2.cpp @ 14383:5ec7dace41a6

8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed Summary: type methods shouldn't always operate on speculative part Reviewed-by: kvn, twisti
author roland
date Fri, 24 Jan 2014 09:31:53 +0100
parents de6a9e811145
children 45467c53f178
comparison
equal deleted inserted replaced
14272:757ec609d8d5 14383:5ec7dace41a6
86 if (el && el->isa_instptr()) { 86 if (el && el->isa_instptr()) {
87 const TypeInstPtr* toop = el->is_instptr(); 87 const TypeInstPtr* toop = el->is_instptr();
88 if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { 88 if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
89 // If we load from "AbstractClass[]" we must see "ConcreteSubClass". 89 // If we load from "AbstractClass[]" we must see "ConcreteSubClass".
90 const Type* subklass = Type::get_const_type(toop->klass()); 90 const Type* subklass = Type::get_const_type(toop->klass());
91 elemtype = subklass->join(el); 91 elemtype = subklass->join_speculative(el);
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 // Check for big class initializers with all constant offsets 96 // Check for big class initializers with all constant offsets
1276 if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) { 1276 if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) {
1277 // Found: 1277 // Found:
1278 // Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq]) 1278 // Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq])
1279 // or the narrowOop equivalent. 1279 // or the narrowOop equivalent.
1280 const Type* obj_type = _gvn.type(obj); 1280 const Type* obj_type = _gvn.type(obj);
1281 const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr(); 1281 const TypeOopPtr* tboth = obj_type->join_speculative(con_type)->isa_oopptr();
1282 if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type && 1282 if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type &&
1283 tboth->higher_equal(obj_type)) { 1283 tboth->higher_equal(obj_type)) {
1284 // obj has to be of the exact type Foo if the CmpP succeeds. 1284 // obj has to be of the exact type Foo if the CmpP succeeds.
1285 int obj_in_map = map()->find_edge(obj); 1285 int obj_in_map = map()->find_edge(obj);
1286 JVMState* jvms = this->jvms(); 1286 JVMState* jvms = this->jvms();
1287 if (obj_in_map >= 0 && 1287 if (obj_in_map >= 0 &&
1288 (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { 1288 (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) {
1289 TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); 1289 TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth);
1290 const Type* tcc = ccast->as_Type()->type(); 1290 const Type* tcc = ccast->as_Type()->type();
1291 assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve"); 1291 assert(tcc != obj_type && tcc->higher_equal_speculative(obj_type), "must improve");
1292 // Delay transform() call to allow recovery of pre-cast value 1292 // Delay transform() call to allow recovery of pre-cast value
1293 // at the control merge. 1293 // at the control merge.
1294 _gvn.set_type_bottom(ccast); 1294 _gvn.set_type_bottom(ccast);
1295 record_for_igvn(ccast); 1295 record_for_igvn(ccast);
1296 // Here's the payoff. 1296 // Here's the payoff.
1316 Node* cast = NULL; 1316 Node* cast = NULL;
1317 1317
1318 switch (btest) { 1318 switch (btest) {
1319 case BoolTest::eq: // Constant test? 1319 case BoolTest::eq: // Constant test?
1320 { 1320 {
1321 const Type* tboth = tcon->join(tval); 1321 const Type* tboth = tcon->join_speculative(tval);
1322 if (tboth == tval) break; // Nothing to gain. 1322 if (tboth == tval) break; // Nothing to gain.
1323 if (tcon->isa_int()) { 1323 if (tcon->isa_int()) {
1324 ccast = new (C) CastIINode(val, tboth); 1324 ccast = new (C) CastIINode(val, tboth);
1325 } else if (tcon == TypePtr::NULL_PTR) { 1325 } else if (tcon == TypePtr::NULL_PTR) {
1326 // Cast to null, but keep the pointer identity temporarily live. 1326 // Cast to null, but keep the pointer identity temporarily live.
1350 break; 1350 break;
1351 } 1351 }
1352 1352
1353 if (ccast != NULL) { 1353 if (ccast != NULL) {
1354 const Type* tcc = ccast->as_Type()->type(); 1354 const Type* tcc = ccast->as_Type()->type();
1355 assert(tcc != tval && tcc->higher_equal(tval), "must improve"); 1355 assert(tcc != tval && tcc->higher_equal_speculative(tval), "must improve");
1356 // Delay transform() call to allow recovery of pre-cast value 1356 // Delay transform() call to allow recovery of pre-cast value
1357 // at the control merge. 1357 // at the control merge.
1358 ccast->set_req(0, control()); 1358 ccast->set_req(0, control());
1359 _gvn.set_type_bottom(ccast); 1359 _gvn.set_type_bottom(ccast);
1360 record_for_igvn(ccast); 1360 record_for_igvn(ccast);