comparison src/share/vm/opto/library_call.cpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents 545c277a3ecf
children 885ed790ecf0
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
1845 } 1845 }
1846 } 1846 }
1847 1847
1848 // See if it is a narrow oop array. 1848 // See if it is a narrow oop array.
1849 if (adr_type->isa_aryptr()) { 1849 if (adr_type->isa_aryptr()) {
1850 if (adr_type->offset() >= objArrayOopDesc::header_size() * wordSize) { 1850 if (adr_type->offset() >= objArrayOopDesc::base_offset_in_bytes(type)) {
1851 const TypeOopPtr *elem_type = adr_type->is_aryptr()->elem()->isa_oopptr(); 1851 const TypeOopPtr *elem_type = adr_type->is_aryptr()->elem()->isa_oopptr();
1852 if (elem_type != NULL) { 1852 if (elem_type != NULL) {
1853 sharpened_klass = elem_type->klass(); 1853 sharpened_klass = elem_type->klass();
1854 } 1854 }
1855 } 1855 }
2162 break; 2162 break;
2163 case T_LONG: 2163 case T_LONG:
2164 cas = _gvn.transform(new (C, 5) CompareAndSwapLNode(control(), mem, adr, newval, oldval)); 2164 cas = _gvn.transform(new (C, 5) CompareAndSwapLNode(control(), mem, adr, newval, oldval));
2165 break; 2165 break;
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 cas = _gvn.transform(new (C, 5) CompareAndSwapPNode(control(), mem, adr, newval, oldval)); 2170 #ifdef _LP64
2171 if (adr->bottom_type()->is_narrow()) {
2172 cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr,
2173 EncodePNode::encode(&_gvn, newval),
2174 EncodePNode::encode(&_gvn, oldval)));
2175 } else
2176 #endif
2177 {
2178 cas = _gvn.transform(new (C, 5) CompareAndSwapPNode(control(), mem, adr, newval, oldval));
2179 }
2171 post_barrier(control(), cas, base, adr, alias_idx, newval, T_OBJECT, true); 2180 post_barrier(control(), cas, base, adr, alias_idx, newval, T_OBJECT, true);
2172 break; 2181 break;
2173 default: 2182 default:
2174 ShouldNotReachHere(); 2183 ShouldNotReachHere();
2175 break; 2184 break;
3822 Node* dest = raw_obj; 3831 Node* dest = raw_obj;
3823 Node* end = dest; 3832 Node* end = dest;
3824 Node* size = _gvn.transform(alloc_siz); 3833 Node* size = _gvn.transform(alloc_siz);
3825 3834
3826 // Exclude the header. 3835 // Exclude the header.
3827 int base_off = sizeof(oopDesc); 3836 int base_off = instanceOopDesc::base_offset_in_bytes();
3837 if (UseCompressedOops) {
3838 // copy the header gap though.
3839 Node* sptr = basic_plus_adr(src, base_off);
3840 Node* dptr = basic_plus_adr(dest, base_off);
3841 Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, raw_adr_type);
3842 store_to_memory(control(), dptr, sval, T_INT, raw_adr_type);
3843 base_off += sizeof(int);
3844 }
3828 src = basic_plus_adr(src, base_off); 3845 src = basic_plus_adr(src, base_off);
3829 dest = basic_plus_adr(dest, base_off); 3846 dest = basic_plus_adr(dest, base_off);
3830 end = basic_plus_adr(end, size); 3847 end = basic_plus_adr(end, size);
3831 3848
3832 // Compute the length also, if needed: 3849 // Compute the length also, if needed:
4387 // At this point we know we do not need type checks on oop stores. 4404 // At this point we know we do not need type checks on oop stores.
4388 4405
4389 // Let's see if we need card marks: 4406 // Let's see if we need card marks:
4390 if (alloc != NULL && use_ReduceInitialCardMarks()) { 4407 if (alloc != NULL && use_ReduceInitialCardMarks()) {
4391 // If we do not need card marks, copy using the jint or jlong stub. 4408 // If we do not need card marks, copy using the jint or jlong stub.
4392 copy_type = LP64_ONLY(T_LONG) NOT_LP64(T_INT); 4409 copy_type = LP64_ONLY(UseCompressedOops ? T_INT : T_LONG) NOT_LP64(T_INT);
4393 assert(type2aelembytes(basic_elem_type) == type2aelembytes(copy_type), 4410 assert(type2aelembytes(basic_elem_type) == type2aelembytes(copy_type),
4394 "sizes agree"); 4411 "sizes agree");
4395 } 4412 }
4396 } 4413 }
4397 4414
4713 start = _gvn.transform( new(C,3) AddXNode(start, MakeConX(abase)) ); 4730 start = _gvn.transform( new(C,3) AddXNode(start, MakeConX(abase)) );
4714 if ((bump_bit | clear_low) != 0) { 4731 if ((bump_bit | clear_low) != 0) {
4715 int to_clear = (bump_bit | clear_low); 4732 int to_clear = (bump_bit | clear_low);
4716 // Align up mod 8, then store a jint zero unconditionally 4733 // Align up mod 8, then store a jint zero unconditionally
4717 // just before the mod-8 boundary. 4734 // just before the mod-8 boundary.
4718 // This would only fail if the first array element were immediately 4735 if (((abase + bump_bit) & ~to_clear) - bump_bit
4719 // after the length field, and were also at an even offset mod 8. 4736 < arrayOopDesc::length_offset_in_bytes() + BytesPerInt) {
4720 assert(((abase + bump_bit) & ~to_clear) - BytesPerInt 4737 bump_bit = 0;
4721 >= arrayOopDesc::length_offset_in_bytes() + BytesPerInt, 4738 assert((abase & to_clear) == 0, "array base must be long-aligned");
4722 "store must not trash length field"); 4739 } else {
4723 4740 // Bump 'start' up to (or past) the next jint boundary:
4724 // Bump 'start' up to (or past) the next jint boundary: 4741 start = _gvn.transform( new(C,3) AddXNode(start, MakeConX(bump_bit)) );
4725 start = _gvn.transform( new(C,3) AddXNode(start, MakeConX(bump_bit)) ); 4742 assert((abase & clear_low) == 0, "array base must be int-aligned");
4743 }
4726 // Round bumped 'start' down to jlong boundary in body of array. 4744 // Round bumped 'start' down to jlong boundary in body of array.
4727 start = _gvn.transform( new(C,3) AndXNode(start, MakeConX(~to_clear)) ); 4745 start = _gvn.transform( new(C,3) AndXNode(start, MakeConX(~to_clear)) );
4728 // Store a zero to the immediately preceding jint: 4746 if (bump_bit != 0) {
4729 Node* x1 = _gvn.transform( new(C,3) AddXNode(start, MakeConX(-BytesPerInt)) ); 4747 // Store a zero to the immediately preceding jint:
4730 Node* p1 = basic_plus_adr(dest, x1); 4748 Node* x1 = _gvn.transform( new(C,3) AddXNode(start, MakeConX(-bump_bit)) );
4731 mem = StoreNode::make(C, control(), mem, p1, adr_type, intcon(0), T_INT); 4749 Node* p1 = basic_plus_adr(dest, x1);
4732 mem = _gvn.transform(mem); 4750 mem = StoreNode::make(_gvn, control(), mem, p1, adr_type, intcon(0), T_INT);
4733 } 4751 mem = _gvn.transform(mem);
4734 4752 }
4753 }
4735 Node* end = dest_size; // pre-rounded 4754 Node* end = dest_size; // pre-rounded
4736 mem = ClearArrayNode::clear_memory(control(), mem, dest, 4755 mem = ClearArrayNode::clear_memory(control(), mem, dest,
4737 start, end, &_gvn); 4756 start, end, &_gvn);
4738 } else { 4757 } else {
4739 // Non-constant start, unrounded non-constant end. 4758 // Non-constant start, unrounded non-constant end.