comparison src/share/vm/oops/instanceOop.hpp @ 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 a61af66fc99e
children 437d03ea40b1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
25 // An instanceOop is an instance of a Java Class 25 // An instanceOop is an instance of a Java Class
26 // Evaluating "new HashTable()" will create an instanceOop. 26 // Evaluating "new HashTable()" will create an instanceOop.
27 27
28 class instanceOopDesc : public oopDesc { 28 class instanceOopDesc : public oopDesc {
29 public: 29 public:
30 // aligned header size.
30 static int header_size() { return sizeof(instanceOopDesc)/HeapWordSize; } 31 static int header_size() { return sizeof(instanceOopDesc)/HeapWordSize; }
32
33 // If compressed, the offset of the fields of the instance may not be aligned.
34 static int base_offset_in_bytes() {
35 return UseCompressedOops ?
36 klass_gap_offset_in_bytes() :
37 sizeof(instanceOopDesc);
38 }
39
40 static bool contains_field_offset(int offset, int nonstatic_field_size) {
41 int base_in_bytes = base_offset_in_bytes();
42 if (UseCompressedOops) {
43 return (offset >= base_in_bytes &&
44 // field can be embedded in header, or is after header.
45 (offset < (int)sizeof(instanceOopDesc) ||
46 (offset-(int)sizeof(instanceOopDesc))/wordSize < nonstatic_field_size));
47 } else {
48 return (offset >= base_in_bytes &&
49 (offset-base_in_bytes)/wordSize < nonstatic_field_size);
50 }
51 }
31 }; 52 };