comparison src/share/vm/opto/library_call.cpp @ 164:c436414a719e

6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions Summary: Add LoadNKlass and CMoveN nodes, use CmpN and ConN nodes to generate narrow oops compare instructions. Reviewed-by: never, rasbold
author kvn
date Wed, 21 May 2008 13:46:23 -0700
parents 885ed790ecf0
children 9148c65abefc
comparison
equal deleted inserted replaced
163:885ed790ecf0 164:c436414a719e
894 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); 894 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset);
895 Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); 895 Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
896 Node* sourcea = basic_plus_adr(string_object, string_object, value_offset); 896 Node* sourcea = basic_plus_adr(string_object, string_object, value_offset);
897 Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset)); 897 Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
898 898
899 Node* target = _gvn.transform(ConPNode::make(C, target_array)); 899 Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array)) );
900 jint target_length = target_array->length(); 900 jint target_length = target_array->length();
901 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin)); 901 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
902 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot); 902 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
903 903
904 IdealKit kit(gvn(), control(), merged_memory()); 904 IdealKit kit(gvn(), control(), merged_memory());
2452 int null_path, 2452 int null_path,
2453 int offset) { 2453 int offset) {
2454 if (region == NULL) never_see_null = true; 2454 if (region == NULL) never_see_null = true;
2455 Node* p = basic_plus_adr(mirror, offset); 2455 Node* p = basic_plus_adr(mirror, offset);
2456 const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL; 2456 const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL;
2457 Node* kls = _gvn.transform(new (C, 3) LoadKlassNode(0, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type)); 2457 Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type) );
2458 _sp += nargs; // any deopt will start just before call to enclosing method 2458 _sp += nargs; // any deopt will start just before call to enclosing method
2459 Node* null_ctl = top(); 2459 Node* null_ctl = top();
2460 kls = null_check_oop(kls, &null_ctl, never_see_null); 2460 kls = null_check_oop(kls, &null_ctl, never_see_null);
2461 if (region != NULL) { 2461 if (region != NULL) {
2462 // Set region->in(null_path) if the mirror is a primitive (e.g, int.class). 2462 // Set region->in(null_path) if the mirror is a primitive (e.g, int.class).
2632 if (generate_array_guard(kls, region) != NULL) 2632 if (generate_array_guard(kls, region) != NULL)
2633 // A guard was added. If the guard is taken, it was an array. 2633 // A guard was added. If the guard is taken, it was an array.
2634 phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror()))); 2634 phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror())));
2635 // If we fall through, it's a plain class. Get its _super. 2635 // If we fall through, it's a plain class. Get its _super.
2636 p = basic_plus_adr(kls, Klass::super_offset_in_bytes() + sizeof(oopDesc)); 2636 p = basic_plus_adr(kls, Klass::super_offset_in_bytes() + sizeof(oopDesc));
2637 kls = _gvn.transform(new (C, 3) LoadKlassNode(0, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); 2637 kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL) );
2638 null_ctl = top(); 2638 null_ctl = top();
2639 kls = null_check_oop(kls, &null_ctl); 2639 kls = null_check_oop(kls, &null_ctl);
2640 if (null_ctl != top()) { 2640 if (null_ctl != top()) {
2641 // If the guard is taken, Object.superClass is null (both klass and mirror). 2641 // If the guard is taken, Object.superClass is null (both klass and mirror).
2642 region->add_req(null_ctl); 2642 region->add_req(null_ctl);
2718 _sp -= nargs; 2718 _sp -= nargs;
2719 if (stopped()) break; 2719 if (stopped()) break;
2720 args[which_arg] = _gvn.transform(arg); 2720 args[which_arg] = _gvn.transform(arg);
2721 2721
2722 Node* p = basic_plus_adr(arg, class_klass_offset); 2722 Node* p = basic_plus_adr(arg, class_klass_offset);
2723 Node* kls = new (C, 3) LoadKlassNode(0, immutable_memory(), p, adr_type, kls_type); 2723 Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type);
2724 klasses[which_arg] = _gvn.transform(kls); 2724 klasses[which_arg] = _gvn.transform(kls);
2725 } 2725 }
2726 2726
2727 // Having loaded both klasses, test each for null. 2727 // Having loaded both klasses, test each for null.
2728 bool never_see_null = !too_many_traps(Deoptimization::Reason_null_check); 2728 bool never_see_null = !too_many_traps(Deoptimization::Reason_null_check);
4386 PreserveJVMState pjvms(this); 4386 PreserveJVMState pjvms(this);
4387 set_control(not_subtype_ctrl); 4387 set_control(not_subtype_ctrl);
4388 // (At this point we can assume disjoint_bases, since types differ.) 4388 // (At this point we can assume disjoint_bases, since types differ.)
4389 int ek_offset = objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc); 4389 int ek_offset = objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc);
4390 Node* p1 = basic_plus_adr(dest_klass, ek_offset); 4390 Node* p1 = basic_plus_adr(dest_klass, ek_offset);
4391 Node* n1 = new (C, 3) LoadKlassNode(0, immutable_memory(), p1, TypeRawPtr::BOTTOM); 4391 Node* n1 = LoadKlassNode::make(_gvn, immutable_memory(), p1, TypeRawPtr::BOTTOM);
4392 Node* dest_elem_klass = _gvn.transform(n1); 4392 Node* dest_elem_klass = _gvn.transform(n1);
4393 Node* cv = generate_checkcast_arraycopy(adr_type, 4393 Node* cv = generate_checkcast_arraycopy(adr_type,
4394 dest_elem_klass, 4394 dest_elem_klass,
4395 src, src_offset, dest, dest_offset, 4395 src, src_offset, dest, dest_offset,
4396 copy_length, 4396 copy_length,