33 #include "prims/jvmtiExport.hpp"
34 #include "runtime/sharedRuntime.hpp"
35 #include "runtime/thread.inline.hpp"
36 #include "services/lowMemoryDetector.hpp"
37 #include "utilities/copy.hpp"
38
39 // Inline allocation implementations.
40
41 void CollectedHeap::post_allocation_setup_common(KlassHandle klass,
42 HeapWord* obj) {
43 post_allocation_setup_no_klass_install(klass, obj);
44 post_allocation_install_obj_klass(klass, oop(obj));
45 }
46
47 void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
48 HeapWord* objPtr) {
49 oop obj = (oop)objPtr;
50
51 assert(obj != NULL, "NULL object pointer");
52 if (UseBiasedLocking && (klass() != NULL)) {
53 obj->set_mark(klass->prototype_header());
54 } else {
55 // May be bootstrapping
56 obj->set_mark(markOopDesc::prototype());
57 }
58 }
59
60 void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass,
61 oop obj) {
62 // These asserts are kind of complicated because of klassKlass
63 // and the beginning of the world.
64 assert(klass() != NULL || !Universe::is_fully_initialized(), "NULL klass");
65 assert(klass() == NULL || klass()->is_klass(), "not a klass");
66 assert(obj != NULL, "NULL object pointer");
67 obj->set_klass(klass());
68 assert(!Universe::is_fully_initialized() || obj->klass() != NULL,
69 "missing klass");
70 }
71
72 // Support for jvmti and dtrace
73 inline void post_allocation_notify(KlassHandle klass, oop obj, int size) {
74 // support low memory notifications (no-op if not enabled)
75 LowMemoryDetector::detect_low_memory_for_collected_pools();
76
|
33 #include "prims/jvmtiExport.hpp"
34 #include "runtime/sharedRuntime.hpp"
35 #include "runtime/thread.inline.hpp"
36 #include "services/lowMemoryDetector.hpp"
37 #include "utilities/copy.hpp"
38
39 // Inline allocation implementations.
40
41 void CollectedHeap::post_allocation_setup_common(KlassHandle klass,
42 HeapWord* obj) {
43 post_allocation_setup_no_klass_install(klass, obj);
44 post_allocation_install_obj_klass(klass, oop(obj));
45 }
46
47 void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
48 HeapWord* objPtr) {
49 oop obj = (oop)objPtr;
50
51 assert(obj != NULL, "NULL object pointer");
52 if (UseBiasedLocking && (klass() != NULL)) {
53 obj->set_mark_raw(klass->prototype_header());
54 } else {
55 // May be bootstrapping
56 obj->set_mark_raw(markOopDesc::prototype());
57 }
58 }
59
60 void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass,
61 oop obj) {
62 // These asserts are kind of complicated because of klassKlass
63 // and the beginning of the world.
64 assert(klass() != NULL || !Universe::is_fully_initialized(), "NULL klass");
65 assert(klass() == NULL || klass()->is_klass(), "not a klass");
66 assert(obj != NULL, "NULL object pointer");
67 obj->set_klass(klass());
68 assert(!Universe::is_fully_initialized() || obj->klass() != NULL,
69 "missing klass");
70 }
71
72 // Support for jvmti and dtrace
73 inline void post_allocation_notify(KlassHandle klass, oop obj, int size) {
74 // support low memory notifications (no-op if not enabled)
75 LowMemoryDetector::detect_low_memory_for_collected_pools();
76
|