1 /*
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Inline allocation implementations.
26
27 void CollectedHeap::post_allocation_setup_common(KlassHandle klass,
28 HeapWord* obj,
29 size_t size) {
30 post_allocation_setup_no_klass_install(klass, obj, size);
31 post_allocation_install_obj_klass(klass, oop(obj), (int) size);
32 }
33
34 void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
35 HeapWord* objPtr,
36 size_t size) {
37 oop obj = (oop)objPtr;
38
39 assert(obj != NULL, "NULL object pointer");
40 if (UseBiasedLocking && (klass() != NULL)) {
41 obj->set_mark(klass->prototype_header());
42 } else {
43 // May be bootstrapping
44 obj->set_mark(markOopDesc::prototype());
351 }
352 }
353 return false;
354 }
355
356 inline bool CollectedHeap::promotion_should_fail() {
357 return promotion_should_fail(&_promotion_failure_alot_count);
358 }
359
360 inline void CollectedHeap::reset_promotion_should_fail(volatile size_t* count) {
361 if (PromotionFailureALot) {
362 _promotion_failure_alot_gc_number = total_collections();
363 *count = 0;
364 }
365 }
366
367 inline void CollectedHeap::reset_promotion_should_fail() {
368 reset_promotion_should_fail(&_promotion_failure_alot_count);
369 }
370 #endif // #ifndef PRODUCT
|
1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_INLINE_HPP
26 #define SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_INLINE_HPP
27
28 #include "gc_interface/collectedHeap.hpp"
29 #include "memory/threadLocalAllocBuffer.inline.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/arrayOop.hpp"
32 #include "prims/jvmtiExport.hpp"
33 #include "runtime/sharedRuntime.hpp"
34 #include "runtime/thread.hpp"
35 #include "services/lowMemoryDetector.hpp"
36 #include "utilities/copy.hpp"
37 #ifdef TARGET_OS_FAMILY_linux
38 # include "thread_linux.inline.hpp"
39 #endif
40 #ifdef TARGET_OS_FAMILY_solaris
41 # include "thread_solaris.inline.hpp"
42 #endif
43 #ifdef TARGET_OS_FAMILY_windows
44 # include "thread_windows.inline.hpp"
45 #endif
46
47 // Inline allocation implementations.
48
49 void CollectedHeap::post_allocation_setup_common(KlassHandle klass,
50 HeapWord* obj,
51 size_t size) {
52 post_allocation_setup_no_klass_install(klass, obj, size);
53 post_allocation_install_obj_klass(klass, oop(obj), (int) size);
54 }
55
56 void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
57 HeapWord* objPtr,
58 size_t size) {
59 oop obj = (oop)objPtr;
60
61 assert(obj != NULL, "NULL object pointer");
62 if (UseBiasedLocking && (klass() != NULL)) {
63 obj->set_mark(klass->prototype_header());
64 } else {
65 // May be bootstrapping
66 obj->set_mark(markOopDesc::prototype());
373 }
374 }
375 return false;
376 }
377
378 inline bool CollectedHeap::promotion_should_fail() {
379 return promotion_should_fail(&_promotion_failure_alot_count);
380 }
381
382 inline void CollectedHeap::reset_promotion_should_fail(volatile size_t* count) {
383 if (PromotionFailureALot) {
384 _promotion_failure_alot_gc_number = total_collections();
385 *count = 0;
386 }
387 }
388
389 inline void CollectedHeap::reset_promotion_should_fail() {
390 reset_promotion_should_fail(&_promotion_failure_alot_count);
391 }
392 #endif // #ifndef PRODUCT
393
394 #endif // SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_INLINE_HPP
|