comparison src/share/vm/opto/compile.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 c7c777385a15
children e0bd2e08e3d0
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
1029 if (ta->size() != TypeInt::POS) { 1029 if (ta->size() != TypeInt::POS) {
1030 const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS); 1030 const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS);
1031 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,ta->klass(),false,offset, ta->instance_id()); 1031 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,ta->klass(),false,offset, ta->instance_id());
1032 } 1032 }
1033 // Arrays of known objects become arrays of unknown objects. 1033 // Arrays of known objects become arrays of unknown objects.
1034 if (ta->elem()->isa_narrowoop() && ta->elem() != TypeNarrowOop::BOTTOM) {
1035 const TypeAry *tary = TypeAry::make(TypeNarrowOop::BOTTOM, ta->size());
1036 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,offset, ta->instance_id());
1037 }
1034 if (ta->elem()->isa_oopptr() && ta->elem() != TypeInstPtr::BOTTOM) { 1038 if (ta->elem()->isa_oopptr() && ta->elem() != TypeInstPtr::BOTTOM) {
1035 const TypeAry *tary = TypeAry::make(TypeInstPtr::BOTTOM, ta->size()); 1039 const TypeAry *tary = TypeAry::make(TypeInstPtr::BOTTOM, ta->size());
1036 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,offset, ta->instance_id()); 1040 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,offset, ta->instance_id());
1037 } 1041 }
1038 // Arrays of bytes and of booleans both use 'bastore' and 'baload' so 1042 // Arrays of bytes and of booleans both use 'bastore' and 'baload' so
1067 // Also, make sure exact and non-exact variants alias the same. 1071 // Also, make sure exact and non-exact variants alias the same.
1068 tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset, to->instance_id()); 1072 tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,offset, to->instance_id());
1069 } 1073 }
1070 // Canonicalize the holder of this field 1074 // Canonicalize the holder of this field
1071 ciInstanceKlass *k = to->klass()->as_instance_klass(); 1075 ciInstanceKlass *k = to->klass()->as_instance_klass();
1072 if (offset >= 0 && offset < oopDesc::header_size() * wordSize) { 1076 if (offset >= 0 && offset < instanceOopDesc::base_offset_in_bytes()) {
1073 // First handle header references such as a LoadKlassNode, even if the 1077 // First handle header references such as a LoadKlassNode, even if the
1074 // object's klass is unloaded at compile time (4965979). 1078 // object's klass is unloaded at compile time (4965979).
1075 tj = to = TypeInstPtr::make(TypePtr::BotPTR, env()->Object_klass(), false, NULL, offset, to->instance_id()); 1079 tj = to = TypeInstPtr::make(TypePtr::BotPTR, env()->Object_klass(), false, NULL, offset, to->instance_id());
1076 } else if (offset < 0 || offset >= k->size_helper() * wordSize) { 1080 } else if (offset < 0 || offset >= k->size_helper() * wordSize) {
1077 to = NULL; 1081 to = NULL;
1308 // but the base pointer type is not distinctive enough to identify 1312 // but the base pointer type is not distinctive enough to identify
1309 // references into JavaThread.) 1313 // references into JavaThread.)
1310 1314
1311 // Check for final instance fields. 1315 // Check for final instance fields.
1312 const TypeInstPtr* tinst = flat->isa_instptr(); 1316 const TypeInstPtr* tinst = flat->isa_instptr();
1313 if (tinst && tinst->offset() >= oopDesc::header_size() * wordSize) { 1317 if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) {
1314 ciInstanceKlass *k = tinst->klass()->as_instance_klass(); 1318 ciInstanceKlass *k = tinst->klass()->as_instance_klass();
1315 ciField* field = k->get_field_by_offset(tinst->offset(), false); 1319 ciField* field = k->get_field_by_offset(tinst->offset(), false);
1316 // Set field() and is_rewritable() attributes. 1320 // Set field() and is_rewritable() attributes.
1317 if (field != NULL) alias_type(idx)->set_field(field); 1321 if (field != NULL) alias_type(idx)->set_field(field);
1318 } 1322 }
1728 continue; 1732 continue;
1729 } 1733 }
1730 if (bundle->starts_bundle()) 1734 if (bundle->starts_bundle())
1731 starts_bundle = '+'; 1735 starts_bundle = '+';
1732 } 1736 }
1737
1738 if (WizardMode) n->dump();
1733 1739
1734 if( !n->is_Region() && // Dont print in the Assembly 1740 if( !n->is_Region() && // Dont print in the Assembly
1735 !n->is_Phi() && // a few noisely useless nodes 1741 !n->is_Phi() && // a few noisely useless nodes
1736 !n->is_Proj() && 1742 !n->is_Proj() &&
1737 !n->is_MachTemp() && 1743 !n->is_MachTemp() &&
1753 1759
1754 // If we have an instruction with a delay slot, and have seen a delay, 1760 // If we have an instruction with a delay slot, and have seen a delay,
1755 // then back up and print it 1761 // then back up and print it
1756 if (valid_bundle_info(n) && node_bundling(n)->use_unconditional_delay()) { 1762 if (valid_bundle_info(n) && node_bundling(n)->use_unconditional_delay()) {
1757 assert(delay != NULL, "no unconditional delay instruction"); 1763 assert(delay != NULL, "no unconditional delay instruction");
1764 if (WizardMode) delay->dump();
1765
1758 if (node_bundling(delay)->starts_bundle()) 1766 if (node_bundling(delay)->starts_bundle())
1759 starts_bundle = '+'; 1767 starts_bundle = '+';
1760 if (pcs && n->_idx < pc_limit) 1768 if (pcs && n->_idx < pc_limit)
1761 tty->print("%3.3x", pcs[n->_idx]); 1769 tty->print("%3.3x", pcs[n->_idx]);
1762 else 1770 else
1817 }; 1825 };
1818 1826
1819 static bool oop_offset_is_sane(const TypeInstPtr* tp) { 1827 static bool oop_offset_is_sane(const TypeInstPtr* tp) {
1820 ciInstanceKlass *k = tp->klass()->as_instance_klass(); 1828 ciInstanceKlass *k = tp->klass()->as_instance_klass();
1821 // Make sure the offset goes inside the instance layout. 1829 // Make sure the offset goes inside the instance layout.
1822 return (uint)tp->offset() < (uint)(oopDesc::header_size() + k->nonstatic_field_size())*wordSize; 1830 return k->contains_field_offset(tp->offset());
1823 // Note that OffsetBot and OffsetTop are very negative. 1831 // Note that OffsetBot and OffsetTop are very negative.
1824 } 1832 }
1825 1833
1826 //------------------------------final_graph_reshaping_impl---------------------- 1834 //------------------------------final_graph_reshaping_impl----------------------
1827 // Implement items 1-5 from final_graph_reshaping below. 1835 // Implement items 1-5 from final_graph_reshaping below.
1944 case Op_StoreL: 1952 case Op_StoreL:
1945 case Op_StoreLConditional: 1953 case Op_StoreLConditional:
1946 case Op_CompareAndSwapI: 1954 case Op_CompareAndSwapI:
1947 case Op_CompareAndSwapL: 1955 case Op_CompareAndSwapL:
1948 case Op_CompareAndSwapP: 1956 case Op_CompareAndSwapP:
1957 case Op_CompareAndSwapN:
1949 case Op_StoreP: 1958 case Op_StoreP:
1959 case Op_StoreN:
1950 case Op_LoadB: 1960 case Op_LoadB:
1951 case Op_LoadC: 1961 case Op_LoadC:
1952 case Op_LoadI: 1962 case Op_LoadI:
1953 case Op_LoadKlass: 1963 case Op_LoadKlass:
1954 case Op_LoadL: 1964 case Op_LoadL:
1955 case Op_LoadL_unaligned: 1965 case Op_LoadL_unaligned:
1956 case Op_LoadPLocked: 1966 case Op_LoadPLocked:
1957 case Op_LoadLLocked: 1967 case Op_LoadLLocked:
1958 case Op_LoadP: 1968 case Op_LoadP:
1969 case Op_LoadN:
1959 case Op_LoadRange: 1970 case Op_LoadRange:
1960 case Op_LoadS: { 1971 case Op_LoadS: {
1961 handle_mem: 1972 handle_mem:
1962 #ifdef ASSERT 1973 #ifdef ASSERT
1963 if( VerifyOptoOopOffsets ) { 1974 if( VerifyOptoOopOffsets ) {