comparison src/share/vm/oops/klassKlass.cpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents f95d63e2154a
children d25d4ca69222 e5383553fd4e
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
35 #include "oops/klassOop.hpp" 35 #include "oops/klassOop.hpp"
36 #include "oops/methodKlass.hpp" 36 #include "oops/methodKlass.hpp"
37 #include "oops/objArrayKlass.hpp" 37 #include "oops/objArrayKlass.hpp"
38 #include "oops/oop.inline.hpp" 38 #include "oops/oop.inline.hpp"
39 #include "oops/oop.inline2.hpp" 39 #include "oops/oop.inline2.hpp"
40 #include "oops/symbolKlass.hpp" 40 #include "oops/symbol.hpp"
41 #include "oops/symbolOop.hpp"
42 #include "oops/typeArrayKlass.hpp" 41 #include "oops/typeArrayKlass.hpp"
43 #include "runtime/handles.inline.hpp" 42 #include "runtime/handles.inline.hpp"
44 #ifndef SERIALGC 43 #ifndef SERIALGC
45 #include "oops/oop.pcgc.inline.hpp" 44 #include "oops/oop.pcgc.inline.hpp"
46 #endif 45 #endif
68 for (juint i = 0; i < Klass::primary_super_limit(); i++) 67 for (juint i = 0; i < Klass::primary_super_limit(); i++)
69 MarkSweep::mark_and_push(k->adr_primary_supers()+i); 68 MarkSweep::mark_and_push(k->adr_primary_supers()+i);
70 MarkSweep::mark_and_push(k->adr_secondary_super_cache()); 69 MarkSweep::mark_and_push(k->adr_secondary_super_cache());
71 MarkSweep::mark_and_push(k->adr_secondary_supers()); 70 MarkSweep::mark_and_push(k->adr_secondary_supers());
72 MarkSweep::mark_and_push(k->adr_java_mirror()); 71 MarkSweep::mark_and_push(k->adr_java_mirror());
73 MarkSweep::mark_and_push(k->adr_name());
74 // We follow the subklass and sibling links at the end of the 72 // We follow the subklass and sibling links at the end of the
75 // marking phase, since otherwise following them will prevent 73 // marking phase, since otherwise following them will prevent
76 // class unloading (all classes are transitively linked from 74 // class unloading (all classes are transitively linked from
77 // java.lang.Object). 75 // java.lang.Object).
78 MarkSweep::revisit_weak_klass_link(k); 76 MarkSweep::revisit_weak_klass_link(k);
88 for (juint i = 0; i < Klass::primary_super_limit(); i++) 86 for (juint i = 0; i < Klass::primary_super_limit(); i++)
89 PSParallelCompact::mark_and_push(cm, k->adr_primary_supers()+i); 87 PSParallelCompact::mark_and_push(cm, k->adr_primary_supers()+i);
90 PSParallelCompact::mark_and_push(cm, k->adr_secondary_super_cache()); 88 PSParallelCompact::mark_and_push(cm, k->adr_secondary_super_cache());
91 PSParallelCompact::mark_and_push(cm, k->adr_secondary_supers()); 89 PSParallelCompact::mark_and_push(cm, k->adr_secondary_supers());
92 PSParallelCompact::mark_and_push(cm, k->adr_java_mirror()); 90 PSParallelCompact::mark_and_push(cm, k->adr_java_mirror());
93 PSParallelCompact::mark_and_push(cm, k->adr_name());
94 // We follow the subklass and sibling links at the end of the 91 // We follow the subklass and sibling links at the end of the
95 // marking phase, since otherwise following them will prevent 92 // marking phase, since otherwise following them will prevent
96 // class unloading (all classes are transitively linked from 93 // class unloading (all classes are transitively linked from
97 // java.lang.Object). 94 // java.lang.Object).
98 PSParallelCompact::revisit_weak_klass_link(cm, k); 95 PSParallelCompact::revisit_weak_klass_link(cm, k);
108 for (juint i = 0; i < Klass::primary_super_limit(); i++) 105 for (juint i = 0; i < Klass::primary_super_limit(); i++)
109 blk->do_oop(k->adr_primary_supers()+i); 106 blk->do_oop(k->adr_primary_supers()+i);
110 blk->do_oop(k->adr_secondary_super_cache()); 107 blk->do_oop(k->adr_secondary_super_cache());
111 blk->do_oop(k->adr_secondary_supers()); 108 blk->do_oop(k->adr_secondary_supers());
112 blk->do_oop(k->adr_java_mirror()); 109 blk->do_oop(k->adr_java_mirror());
113 blk->do_oop(k->adr_name());
114 // The following are in the perm gen and are treated 110 // The following are in the perm gen and are treated
115 // specially in a later phase of a perm gen collection; ... 111 // specially in a later phase of a perm gen collection; ...
116 assert(oop(k)->is_perm(), "should be in perm"); 112 assert(oop(k)->is_perm(), "should be in perm");
117 assert(oop(k->subklass())->is_perm_or_null(), "should be in perm"); 113 assert(oop(k->subklass())->is_perm_or_null(), "should be in perm");
118 assert(oop(k->next_sibling())->is_perm_or_null(), "should be in perm"); 114 assert(oop(k->next_sibling())->is_perm_or_null(), "should be in perm");
142 if (mr.contains(adr)) blk->do_oop(adr); 138 if (mr.contains(adr)) blk->do_oop(adr);
143 adr = k->adr_secondary_supers(); 139 adr = k->adr_secondary_supers();
144 if (mr.contains(adr)) blk->do_oop(adr); 140 if (mr.contains(adr)) blk->do_oop(adr);
145 adr = k->adr_java_mirror(); 141 adr = k->adr_java_mirror();
146 if (mr.contains(adr)) blk->do_oop(adr); 142 if (mr.contains(adr)) blk->do_oop(adr);
147 adr = k->adr_name();
148 if (mr.contains(adr)) blk->do_oop(adr);
149 // The following are "weak links" in the perm gen and are 143 // The following are "weak links" in the perm gen and are
150 // treated specially in a later phase of a perm gen collection. 144 // treated specially in a later phase of a perm gen collection.
151 assert(oop(k)->is_perm(), "should be in perm"); 145 assert(oop(k)->is_perm(), "should be in perm");
152 assert(oop(k->adr_subklass())->is_perm(), "should be in perm"); 146 assert(oop(k->adr_subklass())->is_perm(), "should be in perm");
153 assert(oop(k->adr_next_sibling())->is_perm(), "should be in perm"); 147 assert(oop(k->adr_next_sibling())->is_perm(), "should be in perm");
172 for (juint i = 0; i < Klass::primary_super_limit(); i++) 166 for (juint i = 0; i < Klass::primary_super_limit(); i++)
173 MarkSweep::adjust_pointer(k->adr_primary_supers()+i); 167 MarkSweep::adjust_pointer(k->adr_primary_supers()+i);
174 MarkSweep::adjust_pointer(k->adr_secondary_super_cache()); 168 MarkSweep::adjust_pointer(k->adr_secondary_super_cache());
175 MarkSweep::adjust_pointer(k->adr_secondary_supers()); 169 MarkSweep::adjust_pointer(k->adr_secondary_supers());
176 MarkSweep::adjust_pointer(k->adr_java_mirror()); 170 MarkSweep::adjust_pointer(k->adr_java_mirror());
177 MarkSweep::adjust_pointer(k->adr_name());
178 MarkSweep::adjust_pointer(k->adr_subklass()); 171 MarkSweep::adjust_pointer(k->adr_subklass());
179 MarkSweep::adjust_pointer(k->adr_next_sibling()); 172 MarkSweep::adjust_pointer(k->adr_next_sibling());
180 return size; 173 return size;
181 } 174 }
182 175
254 if (k->java_mirror() != NULL || (k->oop_is_instance() && instanceKlass::cast(klassOop(obj))->is_loaded())) { 247 if (k->java_mirror() != NULL || (k->oop_is_instance() && instanceKlass::cast(klassOop(obj))->is_loaded())) {
255 guarantee(k->java_mirror() != NULL, "should be allocated"); 248 guarantee(k->java_mirror() != NULL, "should be allocated");
256 guarantee(k->java_mirror()->is_perm(), "should be in permspace"); 249 guarantee(k->java_mirror()->is_perm(), "should be in permspace");
257 guarantee(k->java_mirror()->is_instance(), "should be instance"); 250 guarantee(k->java_mirror()->is_instance(), "should be instance");
258 } 251 }
259 if (k->name() != NULL) { 252 }
260 guarantee(Universe::heap()->is_in_permanent(k->name()),
261 "should be in permspace");
262 guarantee(k->name()->is_symbol(), "should be symbol");
263 }
264 }