Mercurial > hg > truffle
comparison src/share/vm/oops/cpCacheKlass.cpp @ 542:9a25e0c45327
6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
Summary: The CMS concurrent precleaning and concurrent marking phases should work around classes that are undergoing redefinition.
Reviewed-by: ysr, tonyp
author | jmasa |
---|---|
date | Sat, 31 Jan 2009 00:15:00 -0800 |
parents | d1605aabd0a1 |
children | 05c6d52fa7a9 |
comparison
equal
deleted
inserted
replaced
541:23673011938d | 542:9a25e0c45327 |
---|---|
30 assert(obj->is_constantPoolCache(), "must be constantPool"); | 30 assert(obj->is_constantPoolCache(), "must be constantPool"); |
31 return constantPoolCacheOop(obj)->object_size(); | 31 return constantPoolCacheOop(obj)->object_size(); |
32 } | 32 } |
33 | 33 |
34 | 34 |
35 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, TRAPS) { | 35 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, |
36 bool is_conc_safe, | |
37 TRAPS) { | |
36 // allocate memory | 38 // allocate memory |
37 int size = constantPoolCacheOopDesc::object_size(length); | 39 int size = constantPoolCacheOopDesc::object_size(length); |
40 | |
38 KlassHandle klass (THREAD, as_klassOop()); | 41 KlassHandle klass (THREAD, as_klassOop()); |
39 constantPoolCacheOop cache = (constantPoolCacheOop) | 42 |
40 CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); | 43 // This is the original code. The code from permanent_obj_allocate() |
44 // was in-lined to allow the setting of is_conc_safe before the klass | |
45 // is installed. | |
46 // constantPoolCacheOop cache = (constantPoolCacheOop) | |
47 // CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); | |
48 | |
49 oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL); | |
50 constantPoolCacheOop cache = (constantPoolCacheOop) obj; | |
51 cache->set_is_conc_safe(is_conc_safe); | |
52 // The store to is_conc_safe must be visible before the klass | |
53 // is set. This should be done safely because _is_conc_safe has | |
54 // been declared volatile. If there are any problems, consider adding | |
55 // OrderAccess::storestore(); | |
56 CollectedHeap::post_allocation_install_obj_klass(klass, obj, size); | |
57 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj, | |
58 size)); | |
59 | |
60 // The length field affects the size of the object. The allocation | |
61 // above allocates the correct size (see calculation of "size") but | |
62 // the size() method of the constant pool cache oop will not reflect | |
63 // that size until the correct length is set. | |
41 cache->set_length(length); | 64 cache->set_length(length); |
65 | |
66 // The store of the length must be visible before is_conc_safe is | |
67 // set to a safe state. | |
68 // This should be done safely because _is_conc_safe has | |
69 // been declared volatile. If there are any problems, consider adding | |
70 // OrderAccess::storestore(); | |
71 cache->set_is_conc_safe(methodOopDesc::IsSafeConc); | |
42 cache->set_constant_pool(NULL); | 72 cache->set_constant_pool(NULL); |
43 return cache; | 73 return cache; |
44 } | 74 } |
45 | 75 |
46 klassOop constantPoolCacheKlass::create_klass(TRAPS) { | 76 klassOop constantPoolCacheKlass::create_klass(TRAPS) { |
112 // iteration over constant pool cache entries | 142 // iteration over constant pool cache entries |
113 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate_m(blk, mr); | 143 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate_m(blk, mr); |
114 return size; | 144 return size; |
115 } | 145 } |
116 | 146 |
117 | |
118 int constantPoolCacheKlass::oop_adjust_pointers(oop obj) { | 147 int constantPoolCacheKlass::oop_adjust_pointers(oop obj) { |
119 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | 148 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); |
120 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | 149 constantPoolCacheOop cache = (constantPoolCacheOop)obj; |
121 // Get size before changing pointers. | 150 // Get size before changing pointers. |
122 // Don't call size() or oop_size() since that is a virtual call. | 151 // Don't call size() or oop_size() since that is a virtual call. |
127 MarkSweep::adjust_pointer((oop*)cache->constant_pool_addr()); | 156 MarkSweep::adjust_pointer((oop*)cache->constant_pool_addr()); |
128 // iteration over constant pool cache entries | 157 // iteration over constant pool cache entries |
129 for (int i = 0; i < cache->length(); i++) | 158 for (int i = 0; i < cache->length(); i++) |
130 cache->entry_at(i)->adjust_pointers(); | 159 cache->entry_at(i)->adjust_pointers(); |
131 return size; | 160 return size; |
161 } | |
162 | |
163 bool constantPoolCacheKlass::oop_is_conc_safe(oop obj) const { | |
164 assert(obj->is_constantPoolCache(), "must be constMethod oop"); | |
165 return constantPoolCacheOop(obj)->is_conc_safe(); | |
132 } | 166 } |
133 | 167 |
134 #ifndef SERIALGC | 168 #ifndef SERIALGC |
135 void constantPoolCacheKlass::oop_copy_contents(PSPromotionManager* pm, | 169 void constantPoolCacheKlass::oop_copy_contents(PSPromotionManager* pm, |
136 oop obj) { | 170 oop obj) { |