comparison src/share/vm/opto/library_call.cpp @ 163:885ed790ecf0

6695810: null oop passed to encode_heap_oop_not_null Summary: fix several problems in C2 related to Escape Analysis and Compressed Oops. Reviewed-by: never, jrose
author kvn
date Wed, 21 May 2008 10:45:07 -0700
parents ba764ed4b6f2
children c436414a719e
comparison
equal deleted inserted replaced
162:8aa010f60e0f 163:885ed790ecf0
2166 case T_OBJECT: 2166 case T_OBJECT:
2167 // reference stores need a store barrier. 2167 // reference stores need a store barrier.
2168 // (They don't if CAS fails, but it isn't worth checking.) 2168 // (They don't if CAS fails, but it isn't worth checking.)
2169 pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT); 2169 pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT);
2170 #ifdef _LP64 2170 #ifdef _LP64
2171 if (adr->bottom_type()->is_narrow()) { 2171 if (adr->bottom_type()->is_ptr_to_narrowoop()) {
2172 cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr, 2172 cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr,
2173 EncodePNode::encode(&_gvn, newval), 2173 EncodePNode::encode(&_gvn, newval),
2174 EncodePNode::encode(&_gvn, oldval))); 2174 EncodePNode::encode(&_gvn, oldval)));
2175 } else 2175 } else
2176 #endif 2176 #endif
2836 Node* count_val = argument(1); 2836 Node* count_val = argument(1);
2837 2837
2838 _sp += nargs; // set original stack for use by uncommon_trap 2838 _sp += nargs; // set original stack for use by uncommon_trap
2839 mirror = do_null_check(mirror, T_OBJECT); 2839 mirror = do_null_check(mirror, T_OBJECT);
2840 _sp -= nargs; 2840 _sp -= nargs;
2841 // If mirror or obj is dead, only null-path is taken.
2842 if (stopped()) return true;
2841 2843
2842 enum { _normal_path = 1, _slow_path = 2, PATH_LIMIT }; 2844 enum { _normal_path = 1, _slow_path = 2, PATH_LIMIT };
2843 RegionNode* result_reg = new(C, PATH_LIMIT) RegionNode(PATH_LIMIT); 2845 RegionNode* result_reg = new(C, PATH_LIMIT) RegionNode(PATH_LIMIT);
2844 PhiNode* result_val = new(C, PATH_LIMIT) PhiNode(result_reg, 2846 PhiNode* result_val = new(C, PATH_LIMIT) PhiNode(result_reg,
2845 TypeInstPtr::NOTNULL); 2847 TypeInstPtr::NOTNULL);
3825 Node* raw_obj = _gvn.transform(alloc_val); 3827 Node* raw_obj = _gvn.transform(alloc_val);
3826 3828
3827 if (!stopped()) { 3829 if (!stopped()) {
3828 // Copy the fastest available way. 3830 // Copy the fastest available way.
3829 // (No need for PreserveJVMState, since we're using it all up now.) 3831 // (No need for PreserveJVMState, since we're using it all up now.)
3832 // TODO: generate fields/elements copies for small objects instead.
3830 Node* src = obj; 3833 Node* src = obj;
3831 Node* dest = raw_obj; 3834 Node* dest = raw_obj;
3832 Node* end = dest;
3833 Node* size = _gvn.transform(alloc_siz); 3835 Node* size = _gvn.transform(alloc_siz);
3834 3836
3835 // Exclude the header. 3837 // Exclude the header.
3836 int base_off = instanceOopDesc::base_offset_in_bytes(); 3838 int base_off = instanceOopDesc::base_offset_in_bytes();
3837 if (UseCompressedOops) { 3839 if (UseCompressedOops) {
3838 // copy the header gap though. 3840 assert(base_off % BytesPerLong != 0, "base with compressed oops");
3839 Node* sptr = basic_plus_adr(src, base_off); 3841 // With compressed oops base_offset_in_bytes is 12 which creates
3840 Node* dptr = basic_plus_adr(dest, base_off); 3842 // the gap since countx is rounded by 8 bytes below.
3841 Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, raw_adr_type); 3843 // Copy klass and the gap.
3842 store_to_memory(control(), dptr, sval, T_INT, raw_adr_type); 3844 base_off = instanceOopDesc::klass_offset_in_bytes();
3843 base_off += sizeof(int);
3844 } 3845 }
3845 src = basic_plus_adr(src, base_off); 3846 src = basic_plus_adr(src, base_off);
3846 dest = basic_plus_adr(dest, base_off); 3847 dest = basic_plus_adr(dest, base_off);
3847 end = basic_plus_adr(end, size);
3848 3848
3849 // Compute the length also, if needed: 3849 // Compute the length also, if needed:
3850 Node* countx = size; 3850 Node* countx = size;
3851 countx = _gvn.transform( new (C, 3) SubXNode(countx, MakeConX(base_off)) ); 3851 countx = _gvn.transform( new (C, 3) SubXNode(countx, MakeConX(base_off)) );
3852 countx = _gvn.transform( new (C, 3) URShiftXNode(countx, intcon(LogBytesPerLong) )); 3852 countx = _gvn.transform( new (C, 3) URShiftXNode(countx, intcon(LogBytesPerLong) ));