28 #include "classfile/javaClasses.hpp"
29 #include "gc/shared/allocTracer.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
32 #include "memory/universe.hpp"
33 #include "oops/arrayOop.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "prims/jvmtiExport.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "services/lowMemoryDetector.hpp"
39 #include "utilities/align.hpp"
40 #include "utilities/copy.hpp"
41
42 // Inline allocation implementations.
43
44 void CollectedHeap::post_allocation_setup_common(Klass* klass,
45 HeapWord* obj_ptr) {
46 post_allocation_setup_no_klass_install(klass, obj_ptr);
47 oop obj = (oop)obj_ptr;
48 #if ! INCLUDE_ALL_GCS
49 obj->set_klass(klass);
50 #else
51 // Need a release store to ensure array/class length, mark word, and
52 // object zeroing are visible before setting the klass non-NULL, for
53 // concurrent collectors.
54 obj->release_set_klass(klass);
55 #endif
56 }
57
58 void CollectedHeap::post_allocation_setup_no_klass_install(Klass* klass,
59 HeapWord* obj_ptr) {
60 oop obj = (oop)obj_ptr;
61
62 assert(obj != NULL, "NULL object pointer");
63 if (UseBiasedLocking && (klass != NULL)) {
64 obj->set_mark_raw(klass->prototype_header());
65 } else {
66 // May be bootstrapping
67 obj->set_mark_raw(markOopDesc::prototype());
68 }
|
28 #include "classfile/javaClasses.hpp"
29 #include "gc/shared/allocTracer.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
32 #include "memory/universe.hpp"
33 #include "oops/arrayOop.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "prims/jvmtiExport.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "services/lowMemoryDetector.hpp"
39 #include "utilities/align.hpp"
40 #include "utilities/copy.hpp"
41
42 // Inline allocation implementations.
43
44 void CollectedHeap::post_allocation_setup_common(Klass* klass,
45 HeapWord* obj_ptr) {
46 post_allocation_setup_no_klass_install(klass, obj_ptr);
47 oop obj = (oop)obj_ptr;
48 #if ! (INCLUDE_G1GC || INCLUDE_CMSGC)
49 obj->set_klass(klass);
50 #else
51 // Need a release store to ensure array/class length, mark word, and
52 // object zeroing are visible before setting the klass non-NULL, for
53 // concurrent collectors.
54 obj->release_set_klass(klass);
55 #endif
56 }
57
58 void CollectedHeap::post_allocation_setup_no_klass_install(Klass* klass,
59 HeapWord* obj_ptr) {
60 oop obj = (oop)obj_ptr;
61
62 assert(obj != NULL, "NULL object pointer");
63 if (UseBiasedLocking && (klass != NULL)) {
64 obj->set_mark_raw(klass->prototype_header());
65 } else {
66 // May be bootstrapping
67 obj->set_mark_raw(markOopDesc::prototype());
68 }
|