1133 Node* conv = _gvn.transform( new (C) ConvI2LNode(offset));
1134 Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) );
1135 return _gvn.transform( new (C) AndLNode(conv, mask) );
1136 }
1137
1138 Node* GraphKit::ConvL2I(Node* offset) {
1139 // short-circuit a common case
1140 jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
1141 if (offset_con != (jlong)Type::OffsetBot) {
1142 return intcon((int) offset_con);
1143 }
1144 return _gvn.transform( new (C) ConvL2INode(offset));
1145 }
1146
1147 //-------------------------load_object_klass-----------------------------------
1148 Node* GraphKit::load_object_klass(Node* obj) {
1149 // Special-case a fresh allocation to avoid building nodes:
1150 Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
1151 if (akls != NULL) return akls;
1152 Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
1153 return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
1154 }
1155
1156 //-------------------------load_array_length-----------------------------------
1157 Node* GraphKit::load_array_length(Node* array) {
1158 // Special-case a fresh allocation to avoid building nodes:
1159 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn);
1160 Node *alen;
1161 if (alloc == NULL) {
1162 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes());
1163 alen = _gvn.transform( new (C) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS));
1164 } else {
1165 alen = alloc->Ideal_length();
1166 Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn);
1167 if (ccast != alen) {
1168 alen = _gvn.transform(ccast);
1169 }
1170 }
1171 return alen;
1172 }
1173
2525
2526 // First load the super-klass's check-offset
2527 Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) );
2528 Node *chk_off = _gvn.transform(new (C) LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(),
2529 TypeInt::INT, MemNode::unordered));
2530 int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
2531 bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con);
2532
2533 // Load from the sub-klass's super-class display list, or a 1-word cache of
2534 // the secondary superclass list, or a failing value with a sentinel offset
2535 // if the super-klass is an interface or exceptionally deep in the Java
2536 // hierarchy and we have to scan the secondary superclass list the hard way.
2537 // Worst-case type is a little odd: NULL is allowed as a result (usually
2538 // klass loads can never produce a NULL).
2539 Node *chk_off_X = ConvI2X(chk_off);
2540 Node *p2 = _gvn.transform( new (C) AddPNode(subklass,subklass,chk_off_X) );
2541 // For some types like interfaces the following loadKlass is from a 1-word
2542 // cache which is mutable so can't use immutable memory. Other
2543 // types load from the super-class display table which is immutable.
2544 Node *kmem = might_be_cache ? memory(p2) : immutable_memory();
2545 Node *nkls = _gvn.transform( LoadKlassNode::make( _gvn, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL ) );
2546
2547 // Compile speed common case: ARE a subtype and we canNOT fail
2548 if( superklass == nkls )
2549 return top(); // false path is dead; no test needed.
2550
2551 // See if we get an immediate positive hit. Happens roughly 83% of the
2552 // time. Test to see if the value loaded just previously from the subklass
2553 // is exactly the superklass.
2554 Node *cmp1 = _gvn.transform( new (C) CmpPNode( superklass, nkls ) );
2555 Node *bol1 = _gvn.transform( new (C) BoolNode( cmp1, BoolTest::eq ) );
2556 IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN );
2557 Node *iftrue1 = _gvn.transform( new (C) IfTrueNode ( iff1 ) );
2558 set_control( _gvn.transform( new (C) IfFalseNode( iff1 ) ) );
2559
2560 // Compile speed common case: Check for being deterministic right now. If
2561 // chk_off is a constant and not equal to cacheoff then we are NOT a
2562 // subklass. In this case we need exactly the 1 test above and we can
2563 // return those results immediately.
2564 if (!might_be_cache) {
2565 Node* not_subtype_ctrl = control();
|
1133 Node* conv = _gvn.transform( new (C) ConvI2LNode(offset));
1134 Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) );
1135 return _gvn.transform( new (C) AndLNode(conv, mask) );
1136 }
1137
1138 Node* GraphKit::ConvL2I(Node* offset) {
1139 // short-circuit a common case
1140 jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
1141 if (offset_con != (jlong)Type::OffsetBot) {
1142 return intcon((int) offset_con);
1143 }
1144 return _gvn.transform( new (C) ConvL2INode(offset));
1145 }
1146
1147 //-------------------------load_object_klass-----------------------------------
1148 Node* GraphKit::load_object_klass(Node* obj) {
1149 // Special-case a fresh allocation to avoid building nodes:
1150 Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
1151 if (akls != NULL) return akls;
1152 Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
1153 return _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), k_adr, TypeInstPtr::KLASS));
1154 }
1155
1156 //-------------------------load_array_length-----------------------------------
1157 Node* GraphKit::load_array_length(Node* array) {
1158 // Special-case a fresh allocation to avoid building nodes:
1159 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn);
1160 Node *alen;
1161 if (alloc == NULL) {
1162 Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes());
1163 alen = _gvn.transform( new (C) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS));
1164 } else {
1165 alen = alloc->Ideal_length();
1166 Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn);
1167 if (ccast != alen) {
1168 alen = _gvn.transform(ccast);
1169 }
1170 }
1171 return alen;
1172 }
1173
2525
2526 // First load the super-klass's check-offset
2527 Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) );
2528 Node *chk_off = _gvn.transform(new (C) LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(),
2529 TypeInt::INT, MemNode::unordered));
2530 int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
2531 bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con);
2532
2533 // Load from the sub-klass's super-class display list, or a 1-word cache of
2534 // the secondary superclass list, or a failing value with a sentinel offset
2535 // if the super-klass is an interface or exceptionally deep in the Java
2536 // hierarchy and we have to scan the secondary superclass list the hard way.
2537 // Worst-case type is a little odd: NULL is allowed as a result (usually
2538 // klass loads can never produce a NULL).
2539 Node *chk_off_X = ConvI2X(chk_off);
2540 Node *p2 = _gvn.transform( new (C) AddPNode(subklass,subklass,chk_off_X) );
2541 // For some types like interfaces the following loadKlass is from a 1-word
2542 // cache which is mutable so can't use immutable memory. Other
2543 // types load from the super-class display table which is immutable.
2544 Node *kmem = might_be_cache ? memory(p2) : immutable_memory();
2545 Node* nkls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
2546
2547 // Compile speed common case: ARE a subtype and we canNOT fail
2548 if( superklass == nkls )
2549 return top(); // false path is dead; no test needed.
2550
2551 // See if we get an immediate positive hit. Happens roughly 83% of the
2552 // time. Test to see if the value loaded just previously from the subklass
2553 // is exactly the superklass.
2554 Node *cmp1 = _gvn.transform( new (C) CmpPNode( superklass, nkls ) );
2555 Node *bol1 = _gvn.transform( new (C) BoolNode( cmp1, BoolTest::eq ) );
2556 IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN );
2557 Node *iftrue1 = _gvn.transform( new (C) IfTrueNode ( iff1 ) );
2558 set_control( _gvn.transform( new (C) IfFalseNode( iff1 ) ) );
2559
2560 // Compile speed common case: Check for being deterministic right now. If
2561 // chk_off is a constant and not equal to cacheoff then we are NOT a
2562 // subklass. In this case we need exactly the 1 test above and we can
2563 // return those results immediately.
2564 if (!might_be_cache) {
2565 Node* not_subtype_ctrl = control();
|