Mercurial > hg > truffle
comparison src/share/vm/memory/sharedHeap.cpp @ 481:7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
Reviewed-by: apetrusenko, ysr
author | jcoomes |
---|---|
date | Thu, 11 Dec 2008 12:05:08 -0800 |
parents | 1ee8caae33af |
children | 0fbdb4381b99 |
comparison
equal
deleted
inserted
replaced
480:d249b360e026 | 481:7d7a7c599c17 |
---|---|
246 | 246 |
247 void SharedHeap::ref_processing_init() { | 247 void SharedHeap::ref_processing_init() { |
248 perm_gen()->ref_processor_init(); | 248 perm_gen()->ref_processor_init(); |
249 } | 249 } |
250 | 250 |
251 void SharedHeap::fill_region_with_object(MemRegion mr) { | |
252 // Disable the posting of JVMTI VMObjectAlloc events as we | |
253 // don't want the filling of tlabs with filler arrays to be | |
254 // reported to the profiler. | |
255 NoJvmtiVMObjectAllocMark njm; | |
256 | |
257 // Disable low memory detector because there is no real allocation. | |
258 LowMemoryDetectorDisabler lmd_dis; | |
259 | |
260 // It turns out that post_allocation_setup_array takes a handle, so the | |
261 // call below contains an implicit conversion. Best to free that handle | |
262 // as soon as possible. | |
263 HandleMark hm; | |
264 | |
265 size_t word_size = mr.word_size(); | |
266 size_t aligned_array_header_size = | |
267 align_object_size(typeArrayOopDesc::header_size(T_INT)); | |
268 | |
269 if (word_size >= aligned_array_header_size) { | |
270 const size_t array_length = | |
271 pointer_delta(mr.end(), mr.start()) - | |
272 typeArrayOopDesc::header_size(T_INT); | |
273 const size_t array_length_words = | |
274 array_length * (HeapWordSize/sizeof(jint)); | |
275 post_allocation_setup_array(Universe::intArrayKlassObj(), | |
276 mr.start(), | |
277 mr.word_size(), | |
278 (int)array_length_words); | |
279 #ifdef ASSERT | |
280 HeapWord* elt_words = (mr.start() + typeArrayOopDesc::header_size(T_INT)); | |
281 Copy::fill_to_words(elt_words, array_length, 0xDEAFBABE); | |
282 #endif | |
283 } else { | |
284 assert(word_size == (size_t)oopDesc::header_size(), "Unaligned?"); | |
285 post_allocation_setup_obj(SystemDictionary::object_klass(), | |
286 mr.start(), | |
287 mr.word_size()); | |
288 } | |
289 } | |
290 | |
291 // Some utilities. | 251 // Some utilities. |
292 void SharedHeap::print_size_transition(outputStream* out, | 252 void SharedHeap::print_size_transition(outputStream* out, |
293 size_t bytes_before, | 253 size_t bytes_before, |
294 size_t bytes_after, | 254 size_t bytes_after, |
295 size_t capacity) { | 255 size_t capacity) { |