hotspot/src/share/vm/gc_interface/collectedHeap.cpp
changeset 10742 a64c942e4e6b
parent 10565 dc90c239f4ec
child 11247 d6faa02b3802
equal deleted inserted replaced
10741:e205f37f249e 10742:a64c942e4e6b
    26 #include "classfile/systemDictionary.hpp"
    26 #include "classfile/systemDictionary.hpp"
    27 #include "gc_implementation/shared/vmGCOperations.hpp"
    27 #include "gc_implementation/shared/vmGCOperations.hpp"
    28 #include "gc_interface/collectedHeap.hpp"
    28 #include "gc_interface/collectedHeap.hpp"
    29 #include "gc_interface/collectedHeap.inline.hpp"
    29 #include "gc_interface/collectedHeap.inline.hpp"
    30 #include "oops/oop.inline.hpp"
    30 #include "oops/oop.inline.hpp"
       
    31 #include "oops/instanceMirrorKlass.hpp"
    31 #include "runtime/init.hpp"
    32 #include "runtime/init.hpp"
    32 #include "services/heapDumper.hpp"
    33 #include "services/heapDumper.hpp"
    33 #ifdef TARGET_OS_FAMILY_linux
    34 #ifdef TARGET_OS_FAMILY_linux
    34 # include "thread_linux.inline.hpp"
    35 # include "thread_linux.inline.hpp"
    35 #endif
    36 #endif
   434     TraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, gclog_or_tty);
   435     TraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, gclog_or_tty);
   435     VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */, false /* ! prologue */);
   436     VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */, false /* ! prologue */);
   436     inspector.doit();
   437     inspector.doit();
   437   }
   438   }
   438 }
   439 }
       
   440 
       
   441 oop CollectedHeap::Class_obj_allocate(KlassHandle klass, int size, KlassHandle real_klass, TRAPS) {
       
   442   debug_only(check_for_valid_allocation_state());
       
   443   assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
       
   444   assert(size >= 0, "int won't convert to size_t");
       
   445   HeapWord* obj;
       
   446   if (JavaObjectsInPerm) {
       
   447     obj = common_permanent_mem_allocate_init(size, CHECK_NULL);
       
   448   } else {
       
   449     assert(ScavengeRootsInCode > 0, "must be");
       
   450     obj = common_mem_allocate_init(size, CHECK_NULL);
       
   451   }
       
   452   post_allocation_setup_common(klass, obj, size);
       
   453   assert(Universe::is_bootstrapping() ||
       
   454          !((oop)obj)->blueprint()->oop_is_array(), "must not be an array");
       
   455   NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
       
   456   oop mirror = (oop)obj;
       
   457 
       
   458   java_lang_Class::set_oop_size(mirror, size);
       
   459 
       
   460   // Setup indirections
       
   461   if (!real_klass.is_null()) {
       
   462     java_lang_Class::set_klass(mirror, real_klass());
       
   463     real_klass->set_java_mirror(mirror);
       
   464   }
       
   465 
       
   466   instanceMirrorKlass* mk = instanceMirrorKlass::cast(mirror->klass());
       
   467   assert(size == mk->instance_size(real_klass), "should have been set");
       
   468 
       
   469   // notify jvmti and dtrace
       
   470   post_allocation_notify(klass, (oop)obj);
       
   471 
       
   472   return mirror;
       
   473 }