hotspot/src/share/vm/gc/shared/collectedHeap.inline.hpp
changeset 39695 946f1321c075
parent 35898 ddc274f0052f
child 41177 3869072fc2e1
equal deleted inserted replaced
39694:e8e42da000c5 39695:946f1321c075
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
    25 #ifndef SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
    26 #define SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
    26 #define SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
    27 
    27 
       
    28 #include "classfile/javaClasses.hpp"
    28 #include "gc/shared/allocTracer.hpp"
    29 #include "gc/shared/allocTracer.hpp"
    29 #include "gc/shared/collectedHeap.hpp"
    30 #include "gc/shared/collectedHeap.hpp"
    30 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
    31 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
    31 #include "memory/universe.hpp"
    32 #include "memory/universe.hpp"
    32 #include "oops/arrayOop.hpp"
    33 #include "oops/arrayOop.hpp"
    92   post_allocation_setup_common(klass, obj);
    93   post_allocation_setup_common(klass, obj);
    93   assert(Universe::is_bootstrapping() ||
    94   assert(Universe::is_bootstrapping() ||
    94          !((oop)obj)->is_array(), "must not be an array");
    95          !((oop)obj)->is_array(), "must not be an array");
    95   // notify jvmti and dtrace
    96   // notify jvmti and dtrace
    96   post_allocation_notify(klass, (oop)obj, size);
    97   post_allocation_notify(klass, (oop)obj, size);
       
    98 }
       
    99 
       
   100 void CollectedHeap::post_allocation_setup_class(KlassHandle klass,
       
   101                                                 HeapWord* obj,
       
   102                                                 int size) {
       
   103   // Set oop_size field before setting the _klass field
       
   104   // in post_allocation_setup_common() because the klass field
       
   105   // indicates that the object is parsable by concurrent GC.
       
   106   oop new_cls = (oop)obj;
       
   107   assert(size > 0, "oop_size must be positive.");
       
   108   java_lang_Class::set_oop_size(new_cls, size);
       
   109   post_allocation_setup_common(klass, obj);
       
   110   assert(Universe::is_bootstrapping() ||
       
   111          !new_cls->is_array(), "must not be an array");
       
   112   // notify jvmti and dtrace
       
   113   post_allocation_notify(klass, new_cls, size);
    97 }
   114 }
    98 
   115 
    99 void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
   116 void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
   100                                                 HeapWord* obj,
   117                                                 HeapWord* obj,
   101                                                 int length) {
   118                                                 int length) {
   201   debug_only(check_for_valid_allocation_state());
   218   debug_only(check_for_valid_allocation_state());
   202   assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
   219   assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
   203   assert(size >= 0, "int won't convert to size_t");
   220   assert(size >= 0, "int won't convert to size_t");
   204   HeapWord* obj = common_mem_allocate_init(klass, size, CHECK_NULL);
   221   HeapWord* obj = common_mem_allocate_init(klass, size, CHECK_NULL);
   205   post_allocation_setup_obj(klass, obj, size);
   222   post_allocation_setup_obj(klass, obj, size);
       
   223   NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
       
   224   return (oop)obj;
       
   225 }
       
   226 
       
   227 oop CollectedHeap::class_allocate(KlassHandle klass, int size, TRAPS) {
       
   228   debug_only(check_for_valid_allocation_state());
       
   229   assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
       
   230   assert(size >= 0, "int won't convert to size_t");
       
   231   HeapWord* obj = common_mem_allocate_init(klass, size, CHECK_NULL);
       
   232   post_allocation_setup_class(klass, obj, size); // set oop_size
   206   NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
   233   NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
   207   return (oop)obj;
   234   return (oop)obj;
   208 }
   235 }
   209 
   236 
   210 oop CollectedHeap::array_allocate(KlassHandle klass,
   237 oop CollectedHeap::array_allocate(KlassHandle klass,