Mercurial > hg > truffle
comparison src/share/vm/classfile/javaClasses.cpp @ 165:437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
Summary: Use the gap also for a narrow oop field and a boxing object value.
Reviewed-by: coleenp, never
author | kvn |
---|---|
date | Wed, 21 May 2008 16:31:35 -0700 |
parents | 60b728ec77c1 |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
164:c436414a719e | 165:437d03ea40b1 |
---|---|
1870 break; | 1870 break; |
1871 case T_FLOAT: | 1871 case T_FLOAT: |
1872 box->float_field_put(value_offset, value->f); | 1872 box->float_field_put(value_offset, value->f); |
1873 break; | 1873 break; |
1874 case T_DOUBLE: | 1874 case T_DOUBLE: |
1875 box->double_field_put(value_offset, value->d); | 1875 box->double_field_put(long_value_offset, value->d); |
1876 break; | 1876 break; |
1877 case T_BYTE: | 1877 case T_BYTE: |
1878 box->byte_field_put(value_offset, value->b); | 1878 box->byte_field_put(value_offset, value->b); |
1879 break; | 1879 break; |
1880 case T_SHORT: | 1880 case T_SHORT: |
1882 break; | 1882 break; |
1883 case T_INT: | 1883 case T_INT: |
1884 box->int_field_put(value_offset, value->i); | 1884 box->int_field_put(value_offset, value->i); |
1885 break; | 1885 break; |
1886 case T_LONG: | 1886 case T_LONG: |
1887 box->long_field_put(value_offset, value->j); | 1887 box->long_field_put(long_value_offset, value->j); |
1888 break; | 1888 break; |
1889 default: | 1889 default: |
1890 return NULL; | 1890 return NULL; |
1891 } | 1891 } |
1892 return box; | 1892 return box; |
1913 break; | 1913 break; |
1914 case T_FLOAT: | 1914 case T_FLOAT: |
1915 value->f = box->float_field(value_offset); | 1915 value->f = box->float_field(value_offset); |
1916 break; | 1916 break; |
1917 case T_DOUBLE: | 1917 case T_DOUBLE: |
1918 value->d = box->double_field(value_offset); | 1918 value->d = box->double_field(long_value_offset); |
1919 break; | 1919 break; |
1920 case T_BYTE: | 1920 case T_BYTE: |
1921 value->b = box->byte_field(value_offset); | 1921 value->b = box->byte_field(value_offset); |
1922 break; | 1922 break; |
1923 case T_SHORT: | 1923 case T_SHORT: |
1925 break; | 1925 break; |
1926 case T_INT: | 1926 case T_INT: |
1927 value->i = box->int_field(value_offset); | 1927 value->i = box->int_field(value_offset); |
1928 break; | 1928 break; |
1929 case T_LONG: | 1929 case T_LONG: |
1930 value->j = box->long_field(value_offset); | 1930 value->j = box->long_field(long_value_offset); |
1931 break; | 1931 break; |
1932 default: | 1932 default: |
1933 return T_ILLEGAL; | 1933 return T_ILLEGAL; |
1934 } // end switch | 1934 } // end switch |
1935 return type; | 1935 return type; |
1947 break; | 1947 break; |
1948 case T_FLOAT: | 1948 case T_FLOAT: |
1949 box->float_field_put(value_offset, value->f); | 1949 box->float_field_put(value_offset, value->f); |
1950 break; | 1950 break; |
1951 case T_DOUBLE: | 1951 case T_DOUBLE: |
1952 box->double_field_put(value_offset, value->d); | 1952 box->double_field_put(long_value_offset, value->d); |
1953 break; | 1953 break; |
1954 case T_BYTE: | 1954 case T_BYTE: |
1955 box->byte_field_put(value_offset, value->b); | 1955 box->byte_field_put(value_offset, value->b); |
1956 break; | 1956 break; |
1957 case T_SHORT: | 1957 case T_SHORT: |
1959 break; | 1959 break; |
1960 case T_INT: | 1960 case T_INT: |
1961 box->int_field_put(value_offset, value->i); | 1961 box->int_field_put(value_offset, value->i); |
1962 break; | 1962 break; |
1963 case T_LONG: | 1963 case T_LONG: |
1964 box->long_field_put(value_offset, value->j); | 1964 box->long_field_put(long_value_offset, value->j); |
1965 break; | 1965 break; |
1966 default: | 1966 default: |
1967 return T_ILLEGAL; | 1967 return T_ILLEGAL; |
1968 } // end switch | 1968 } // end switch |
1969 return type; | 1969 return type; |
2161 int java_lang_reflect_Field::slot_offset; | 2161 int java_lang_reflect_Field::slot_offset; |
2162 int java_lang_reflect_Field::modifiers_offset; | 2162 int java_lang_reflect_Field::modifiers_offset; |
2163 int java_lang_reflect_Field::signature_offset; | 2163 int java_lang_reflect_Field::signature_offset; |
2164 int java_lang_reflect_Field::annotations_offset; | 2164 int java_lang_reflect_Field::annotations_offset; |
2165 int java_lang_boxing_object::value_offset; | 2165 int java_lang_boxing_object::value_offset; |
2166 int java_lang_boxing_object::long_value_offset; | |
2166 int java_lang_ref_Reference::referent_offset; | 2167 int java_lang_ref_Reference::referent_offset; |
2167 int java_lang_ref_Reference::queue_offset; | 2168 int java_lang_ref_Reference::queue_offset; |
2168 int java_lang_ref_Reference::next_offset; | 2169 int java_lang_ref_Reference::next_offset; |
2169 int java_lang_ref_Reference::discovered_offset; | 2170 int java_lang_ref_Reference::discovered_offset; |
2170 int java_lang_ref_Reference::static_lock_offset; | 2171 int java_lang_ref_Reference::static_lock_offset; |
2280 // Compute hard-coded offsets | 2281 // Compute hard-coded offsets |
2281 // Invoked before SystemDictionary::initialize, so pre-loaded classes | 2282 // Invoked before SystemDictionary::initialize, so pre-loaded classes |
2282 // are not available to determine the offset_of_static_fields. | 2283 // are not available to determine the offset_of_static_fields. |
2283 void JavaClasses::compute_hard_coded_offsets() { | 2284 void JavaClasses::compute_hard_coded_offsets() { |
2284 const int x = heapOopSize; | 2285 const int x = heapOopSize; |
2285 // Objects don't get allocated in the gap in the header with compressed oops | 2286 const int header = instanceOopDesc::base_offset_in_bytes(); |
2286 // for these special classes because hard coded offsets can't be conditional | |
2287 // so base_offset_in_bytes() is wrong here, allocate after the header. | |
2288 const int header = sizeof(instanceOopDesc); | |
2289 | 2287 |
2290 // Do the String Class | 2288 // Do the String Class |
2291 java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header; | 2289 java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header; |
2292 java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header; | 2290 java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header; |
2293 java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint); | 2291 java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint); |
2306 java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; | 2304 java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; |
2307 java_lang_Throwable::cause_offset = java_lang_Throwable::hc_cause_offset * x + header; | 2305 java_lang_Throwable::cause_offset = java_lang_Throwable::hc_cause_offset * x + header; |
2308 java_lang_Throwable::stackTrace_offset = java_lang_Throwable::hc_stackTrace_offset * x + header; | 2306 java_lang_Throwable::stackTrace_offset = java_lang_Throwable::hc_stackTrace_offset * x + header; |
2309 | 2307 |
2310 // java_lang_boxing_object | 2308 // java_lang_boxing_object |
2311 java_lang_boxing_object::value_offset = java_lang_boxing_object::hc_value_offset * x + header; | 2309 java_lang_boxing_object::value_offset = java_lang_boxing_object::hc_value_offset + header; |
2310 java_lang_boxing_object::long_value_offset = align_size_up((java_lang_boxing_object::hc_value_offset + header), BytesPerLong); | |
2312 | 2311 |
2313 // java_lang_ref_Reference: | 2312 // java_lang_ref_Reference: |
2314 java_lang_ref_Reference::referent_offset = java_lang_ref_Reference::hc_referent_offset * x + header; | 2313 java_lang_ref_Reference::referent_offset = java_lang_ref_Reference::hc_referent_offset * x + header; |
2315 java_lang_ref_Reference::queue_offset = java_lang_ref_Reference::hc_queue_offset * x + header; | 2314 java_lang_ref_Reference::queue_offset = java_lang_ref_Reference::hc_queue_offset * x + header; |
2316 java_lang_ref_Reference::next_offset = java_lang_ref_Reference::hc_next_offset * x + header; | 2315 java_lang_ref_Reference::next_offset = java_lang_ref_Reference::hc_next_offset * x + header; |
2320 // Artificial fields for java_lang_ref_Reference | 2319 // Artificial fields for java_lang_ref_Reference |
2321 // The first field is for the discovered field added in 1.4 | 2320 // The first field is for the discovered field added in 1.4 |
2322 java_lang_ref_Reference::number_of_fake_oop_fields = 1; | 2321 java_lang_ref_Reference::number_of_fake_oop_fields = 1; |
2323 | 2322 |
2324 // java_lang_ref_SoftReference Class | 2323 // java_lang_ref_SoftReference Class |
2325 java_lang_ref_SoftReference::timestamp_offset = java_lang_ref_SoftReference::hc_timestamp_offset * x + header; | 2324 java_lang_ref_SoftReference::timestamp_offset = align_size_up((java_lang_ref_SoftReference::hc_timestamp_offset * x + header), BytesPerLong); |
2326 // Don't multiply static fields because they are always in wordSize units | 2325 // Don't multiply static fields because they are always in wordSize units |
2327 java_lang_ref_SoftReference::static_clock_offset = java_lang_ref_SoftReference::hc_static_clock_offset * x; | 2326 java_lang_ref_SoftReference::static_clock_offset = java_lang_ref_SoftReference::hc_static_clock_offset * x; |
2328 | 2327 |
2329 // java_lang_ClassLoader | 2328 // java_lang_ClassLoader |
2330 java_lang_ClassLoader::parent_offset = java_lang_ClassLoader::hc_parent_offset * x + header; | 2329 java_lang_ClassLoader::parent_offset = java_lang_ClassLoader::hc_parent_offset * x + header; |
2467 bool valid = true; | 2466 bool valid = true; |
2468 | 2467 |
2469 #define CHECK_OFFSET(klass_name, cpp_klass_name, field_name, field_sig) \ | 2468 #define CHECK_OFFSET(klass_name, cpp_klass_name, field_name, field_sig) \ |
2470 valid &= check_offset(klass_name, cpp_klass_name :: field_name ## _offset, #field_name, field_sig) | 2469 valid &= check_offset(klass_name, cpp_klass_name :: field_name ## _offset, #field_name, field_sig) |
2471 | 2470 |
2471 #define CHECK_LONG_OFFSET(klass_name, cpp_klass_name, field_name, field_sig) \ | |
2472 valid &= check_offset(klass_name, cpp_klass_name :: long_ ## field_name ## _offset, #field_name, field_sig) | |
2473 | |
2472 #define CHECK_STATIC_OFFSET(klass_name, cpp_klass_name, field_name, field_sig) \ | 2474 #define CHECK_STATIC_OFFSET(klass_name, cpp_klass_name, field_name, field_sig) \ |
2473 valid &= check_static_offset(klass_name, cpp_klass_name :: static_ ## field_name ## _offset, #field_name, field_sig) | 2475 valid &= check_static_offset(klass_name, cpp_klass_name :: static_ ## field_name ## _offset, #field_name, field_sig) |
2474 | 2476 |
2475 #define CHECK_CONSTANT(klass_name, cpp_klass_name, field_name, field_sig) \ | 2477 #define CHECK_CONSTANT(klass_name, cpp_klass_name, field_name, field_sig) \ |
2476 valid &= check_constant(klass_name, cpp_klass_name :: field_name, #field_name, field_sig) | 2478 valid &= check_constant(klass_name, cpp_klass_name :: field_name, #field_name, field_sig) |
2499 // Boxed primitive objects (java_lang_boxing_object) | 2501 // Boxed primitive objects (java_lang_boxing_object) |
2500 | 2502 |
2501 CHECK_OFFSET("java/lang/Boolean", java_lang_boxing_object, value, "Z"); | 2503 CHECK_OFFSET("java/lang/Boolean", java_lang_boxing_object, value, "Z"); |
2502 CHECK_OFFSET("java/lang/Character", java_lang_boxing_object, value, "C"); | 2504 CHECK_OFFSET("java/lang/Character", java_lang_boxing_object, value, "C"); |
2503 CHECK_OFFSET("java/lang/Float", java_lang_boxing_object, value, "F"); | 2505 CHECK_OFFSET("java/lang/Float", java_lang_boxing_object, value, "F"); |
2504 CHECK_OFFSET("java/lang/Double", java_lang_boxing_object, value, "D"); | 2506 CHECK_LONG_OFFSET("java/lang/Double", java_lang_boxing_object, value, "D"); |
2505 CHECK_OFFSET("java/lang/Byte", java_lang_boxing_object, value, "B"); | 2507 CHECK_OFFSET("java/lang/Byte", java_lang_boxing_object, value, "B"); |
2506 CHECK_OFFSET("java/lang/Short", java_lang_boxing_object, value, "S"); | 2508 CHECK_OFFSET("java/lang/Short", java_lang_boxing_object, value, "S"); |
2507 CHECK_OFFSET("java/lang/Integer", java_lang_boxing_object, value, "I"); | 2509 CHECK_OFFSET("java/lang/Integer", java_lang_boxing_object, value, "I"); |
2508 CHECK_OFFSET("java/lang/Long", java_lang_boxing_object, value, "J"); | 2510 CHECK_LONG_OFFSET("java/lang/Long", java_lang_boxing_object, value, "J"); |
2509 | 2511 |
2510 // java.lang.ClassLoader | 2512 // java.lang.ClassLoader |
2511 | 2513 |
2512 CHECK_OFFSET("java/lang/ClassLoader", java_lang_ClassLoader, parent, "Ljava/lang/ClassLoader;"); | 2514 CHECK_OFFSET("java/lang/ClassLoader", java_lang_ClassLoader, parent, "Ljava/lang/ClassLoader;"); |
2513 | 2515 |