254 assert(size >= 0, "int won't convert to size_t"); 255 HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); 256 post_allocation_setup_obj(klass, obj, size); 257 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); 258 return (oop)obj; 259 } 260 261 oop CollectedHeap::array_allocate(KlassHandle klass, 262 int size, 263 int length, 264 TRAPS) { 265 debug_only(check_for_valid_allocation_state()); 266 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); 267 assert(size >= 0, "int won't convert to size_t"); 268 HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); 269 post_allocation_setup_array(klass, obj, size, length); 270 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); 271 return (oop)obj; 272 } 273 274 oop CollectedHeap::permanent_obj_allocate(KlassHandle klass, int size, TRAPS) { 275 oop obj = permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL); 276 post_allocation_install_obj_klass(klass, obj, size); 277 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj, 278 size)); 279 return obj; 280 } 281 282 oop CollectedHeap::permanent_obj_allocate_no_klass_install(KlassHandle klass, 283 int size, 284 TRAPS) { 285 debug_only(check_for_valid_allocation_state()); 286 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); 287 assert(size >= 0, "int won't convert to size_t"); 288 HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL); 289 post_allocation_setup_no_klass_install(klass, obj, size); 290 #ifndef PRODUCT 291 const size_t hs = oopDesc::header_size(); 292 Universe::heap()->check_for_bad_heap_word_value(obj+hs, size-hs); 293 #endif | 254 assert(size >= 0, "int won't convert to size_t"); 255 HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); 256 post_allocation_setup_obj(klass, obj, size); 257 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); 258 return (oop)obj; 259 } 260 261 oop CollectedHeap::array_allocate(KlassHandle klass, 262 int size, 263 int length, 264 TRAPS) { 265 debug_only(check_for_valid_allocation_state()); 266 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); 267 assert(size >= 0, "int won't convert to size_t"); 268 HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); 269 post_allocation_setup_array(klass, obj, size, length); 270 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); 271 return (oop)obj; 272 } 273 274 oop CollectedHeap::array_allocate_nozero(KlassHandle klass, 275 int size, 276 int length, 277 TRAPS) { 278 debug_only(check_for_valid_allocation_state()); 279 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); 280 assert(size >= 0, "int won't convert to size_t"); 281 HeapWord* obj = common_mem_allocate_noinit(size, CHECK_NULL); 282 ((oop)obj)->set_klass_gap(0); 283 post_allocation_setup_array(klass, obj, size, length); 284 #ifndef PRODUCT 285 const size_t hs = oopDesc::header_size()+1; 286 Universe::heap()->check_for_non_bad_heap_word_value(obj+hs, size-hs); 287 #endif 288 return (oop)obj; 289 } 290 291 oop CollectedHeap::permanent_obj_allocate(KlassHandle klass, int size, TRAPS) { 292 oop obj = permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL); 293 post_allocation_install_obj_klass(klass, obj, size); 294 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj, 295 size)); 296 return obj; 297 } 298 299 oop CollectedHeap::permanent_obj_allocate_no_klass_install(KlassHandle klass, 300 int size, 301 TRAPS) { 302 debug_only(check_for_valid_allocation_state()); 303 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); 304 assert(size >= 0, "int won't convert to size_t"); 305 HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL); 306 post_allocation_setup_no_klass_install(klass, obj, size); 307 #ifndef PRODUCT 308 const size_t hs = oopDesc::header_size(); 309 Universe::heap()->check_for_bad_heap_word_value(obj+hs, size-hs); 310 #endif |