comparison src/share/vm/oops/cpCacheKlass.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 a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
35 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, TRAPS) { 35 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, TRAPS) {
36 // allocate memory 36 // allocate memory
37 int size = constantPoolCacheOopDesc::object_size(length); 37 int size = constantPoolCacheOopDesc::object_size(length);
38 KlassHandle klass (THREAD, as_klassOop()); 38 KlassHandle klass (THREAD, as_klassOop());
39 constantPoolCacheOop cache = (constantPoolCacheOop) 39 constantPoolCacheOop cache = (constantPoolCacheOop)
40 CollectedHeap::permanent_array_allocate(klass, size, length, CHECK_NULL); 40 CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
41 cache->set_length(length);
41 cache->set_constant_pool(NULL); 42 cache->set_constant_pool(NULL);
42 return cache; 43 return cache;
43 } 44 }
44 45
45
46 klassOop constantPoolCacheKlass::create_klass(TRAPS) { 46 klassOop constantPoolCacheKlass::create_klass(TRAPS) {
47 constantPoolCacheKlass o; 47 constantPoolCacheKlass o;
48 KlassHandle klassklass(THREAD, Universe::arrayKlassKlassObj()); 48 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
49 arrayKlassHandle k = base_create_array_klass(o.vtbl_value(), header_size(), klassklass, CHECK_NULL); 49 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
50 KlassHandle super (THREAD, k->super()); 50 // Make sure size calculation is right
51 complete_create_array_klass(k, super, CHECK_NULL); 51 assert(k()->size() == align_object_size(header_size()), "wrong size for object");
52 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
52 return k(); 53 return k();
53 } 54 }
54 55
55 56
56 void constantPoolCacheKlass::oop_follow_contents(oop obj) { 57 void constantPoolCacheKlass::oop_follow_contents(oop obj) {
181 182
182 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) { 183 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
183 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); 184 assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
184 constantPoolCacheOop cache = (constantPoolCacheOop)obj; 185 constantPoolCacheOop cache = (constantPoolCacheOop)obj;
185 // super print 186 // super print
186 arrayKlass::oop_print_on(obj, st); 187 Klass::oop_print_on(obj, st);
187 // print constant pool cache entries 188 // print constant pool cache entries
188 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i); 189 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i);
189 } 190 }
190 191
191 #endif 192 #endif
192 193
193 void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) { 194 void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) {
194 guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache"); 195 guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache");
195 constantPoolCacheOop cache = (constantPoolCacheOop)obj; 196 constantPoolCacheOop cache = (constantPoolCacheOop)obj;
196 // super verify 197 // super verify
197 arrayKlass::oop_verify_on(obj, st); 198 Klass::oop_verify_on(obj, st);
198 // print constant pool cache entries 199 // print constant pool cache entries
199 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st); 200 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st);
200 } 201 }
201 202
202 203