Sat, 01 Sep 2012 13:25:18 -0400
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
1 /*
2 * Copyright (c) 2010, 2012, 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 */
25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP
26 #define SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP
28 #include "gc_implementation/shared/markSweep.inline.hpp"
29 #include "oops/objArrayKlass.hpp"
30 #ifndef SERIALGC
31 #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
32 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
33 #endif
35 void objArrayKlass::oop_follow_contents(oop obj, int index) {
36 if (UseCompressedOops) {
37 objarray_follow_contents<narrowOop>(obj, index);
38 } else {
39 objarray_follow_contents<oop>(obj, index);
40 }
41 }
43 template <class T>
44 void objArrayKlass::objarray_follow_contents(oop obj, int index) {
45 objArrayOop a = objArrayOop(obj);
46 const size_t len = size_t(a->length());
47 const size_t beg_index = size_t(index);
48 assert(beg_index < len || len == 0, "index too large");
50 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
51 const size_t end_index = beg_index + stride;
52 T* const base = (T*)a->base();
53 T* const beg = base + beg_index;
54 T* const end = base + end_index;
56 // Push the non-NULL elements of the next stride on the marking stack.
57 for (T* e = beg; e < end; e++) {
58 MarkSweep::mark_and_push<T>(e);
59 }
61 if (end_index < len) {
62 MarkSweep::push_objarray(a, end_index); // Push the continuation.
63 }
64 }
66 #ifndef SERIALGC
67 void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,
68 int index) {
69 if (UseCompressedOops) {
70 objarray_follow_contents<narrowOop>(cm, obj, index);
71 } else {
72 objarray_follow_contents<oop>(cm, obj, index);
73 }
74 }
76 template <class T>
77 void objArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,
78 int index) {
79 objArrayOop a = objArrayOop(obj);
80 const size_t len = size_t(a->length());
81 const size_t beg_index = size_t(index);
82 assert(beg_index < len || len == 0, "index too large");
84 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
85 const size_t end_index = beg_index + stride;
86 T* const base = (T*)a->base();
87 T* const beg = base + beg_index;
88 T* const end = base + end_index;
90 // Push the non-NULL elements of the next stride on the marking stack.
91 for (T* e = beg; e < end; e++) {
92 PSParallelCompact::mark_and_push<T>(cm, e);
93 }
95 if (end_index < len) {
96 cm->push_objarray(a, end_index); // Push the continuation.
97 }
98 }
99 #endif // #ifndef SERIALGC
101 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP