46 assert(obj->is_constantPoolCache(), "must be constantPool");
47 return constantPoolCacheOop(obj)->object_size();
48 }
49
50
51 constantPoolCacheOop constantPoolCacheKlass::allocate(int length,
52 TRAPS) {
53 // allocate memory
54 int size = constantPoolCacheOopDesc::object_size(length);
55
56 KlassHandle klass (THREAD, as_klassOop());
57
58 // Commented out below is the original code. The code from
59 // permanent_obj_allocate() was in-lined so that we could
60 // set the _length field, necessary to correctly compute its
61 // size(), before setting its klass word further below.
62 // constantPoolCacheOop cache = (constantPoolCacheOop)
63 // CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
64
65 oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
66 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj,
67 size));
68 constantPoolCacheOop cache = (constantPoolCacheOop) obj;
69 assert(!UseConcMarkSweepGC || obj->klass_or_null() == NULL,
70 "klass should be NULL here when using CMS");
71 cache->set_length(length); // should become visible before klass is set below.
72 cache->set_constant_pool(NULL);
73
74 OrderAccess::storestore();
75 obj->set_klass(klass());
76 assert(cache->size() == size, "Incorrect cache->size()");
77 return cache;
78 }
79
80 klassOop constantPoolCacheKlass::create_klass(TRAPS) {
81 constantPoolCacheKlass o;
82 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
83 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
84 // Make sure size calculation is right
85 assert(k()->size() == align_object_size(header_size()), "wrong size for object");
86 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
87 return k();
|
46 assert(obj->is_constantPoolCache(), "must be constantPool");
47 return constantPoolCacheOop(obj)->object_size();
48 }
49
50
51 constantPoolCacheOop constantPoolCacheKlass::allocate(int length,
52 TRAPS) {
53 // allocate memory
54 int size = constantPoolCacheOopDesc::object_size(length);
55
56 KlassHandle klass (THREAD, as_klassOop());
57
58 // Commented out below is the original code. The code from
59 // permanent_obj_allocate() was in-lined so that we could
60 // set the _length field, necessary to correctly compute its
61 // size(), before setting its klass word further below.
62 // constantPoolCacheOop cache = (constantPoolCacheOop)
63 // CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
64
65 oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
66 NOT_PRODUCT(const size_t hs = oopDesc::header_size(); Universe::heap()->check_for_bad_heap_word_value(((HeapWord*) obj)+hs, size-hs));
67 constantPoolCacheOop cache = (constantPoolCacheOop) obj;
68 assert(!UseConcMarkSweepGC || obj->klass_or_null() == NULL,
69 "klass should be NULL here when using CMS");
70 cache->set_length(length); // should become visible before klass is set below.
71 cache->set_constant_pool(NULL);
72
73 OrderAccess::storestore();
74 obj->set_klass(klass());
75 assert(cache->size() == size, "Incorrect cache->size()");
76 return cache;
77 }
78
79 klassOop constantPoolCacheKlass::create_klass(TRAPS) {
80 constantPoolCacheKlass o;
81 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
82 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
83 // Make sure size calculation is right
84 assert(k()->size() == align_object_size(header_size()), "wrong size for object");
85 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
86 return k();
|