1162 assert(is_alive(), "Must be an alive method");
1163 // Set the traversal mark to ensure that the sweeper does 2
1164 // cleaning passes before moving to zombie.
1165 set_stack_traversal_mark(NMethodSweeper::traversal_count());
1166 }
1167
1168 // Tell if a non-entrant method can be converted to a zombie (i.e.,
1169 // there are no activations on the stack, not in use by the VM,
1170 // and not in use by the ServiceThread)
1171 bool nmethod::can_not_entrant_be_converted() {
1172 assert(is_not_entrant(), "must be a non-entrant method");
1173
1174 // Since the nmethod sweeper only does partial sweep the sweeper's traversal
1175 // count can be greater than the stack traversal count before it hits the
1176 // nmethod for the second time.
1177 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
1178 !is_locked_by_vm();
1179 }
1180
1181 void nmethod::inc_decompile_count() {
1182 if (!is_compiled_by_c2()) return;
1183 // Could be gated by ProfileTraps, but do not bother...
1184 Method* m = method();
1185 if (m == NULL) return;
1186 MethodData* mdo = m->method_data();
1187 if (mdo == NULL) return;
1188 // There is a benign race here. See comments in methodData.hpp.
1189 mdo->inc_decompile_count();
1190 }
1191
1192 void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
1193
1194 post_compiled_method_unload();
1195
1196 // Since this nmethod is being unloaded, make sure that dependencies
1197 // recorded in instanceKlasses get flushed and pass non-NULL closure to
1198 // indicate that this work is being done during a GC.
1199 assert(Universe::heap()->is_gc_active(), "should only be called during gc");
1200 assert(is_alive != NULL, "Should be non-NULL");
1201 // A non-NULL is_alive closure indicates that this is being called during GC.
1202 flush_dependencies(is_alive);
|
1162 assert(is_alive(), "Must be an alive method");
1163 // Set the traversal mark to ensure that the sweeper does 2
1164 // cleaning passes before moving to zombie.
1165 set_stack_traversal_mark(NMethodSweeper::traversal_count());
1166 }
1167
1168 // Tell if a non-entrant method can be converted to a zombie (i.e.,
1169 // there are no activations on the stack, not in use by the VM,
1170 // and not in use by the ServiceThread)
1171 bool nmethod::can_not_entrant_be_converted() {
1172 assert(is_not_entrant(), "must be a non-entrant method");
1173
1174 // Since the nmethod sweeper only does partial sweep the sweeper's traversal
1175 // count can be greater than the stack traversal count before it hits the
1176 // nmethod for the second time.
1177 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
1178 !is_locked_by_vm();
1179 }
1180
1181 void nmethod::inc_decompile_count() {
1182 if (!is_compiled_by_c2() || !is_compiled_by_c1()) return;
1183 // Could be gated by ProfileTraps, but do not bother...
1184 Method* m = method();
1185 if (m == NULL) return;
1186 MethodData* mdo = m->method_data();
1187 if (mdo == NULL) return;
1188 // There is a benign race here. See comments in methodData.hpp.
1189 mdo->inc_decompile_count();
1190 }
1191
1192 void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
1193
1194 post_compiled_method_unload();
1195
1196 // Since this nmethod is being unloaded, make sure that dependencies
1197 // recorded in instanceKlasses get flushed and pass non-NULL closure to
1198 // indicate that this work is being done during a GC.
1199 assert(Universe::heap()->is_gc_active(), "should only be called during gc");
1200 assert(is_alive != NULL, "Should be non-NULL");
1201 // A non-NULL is_alive closure indicates that this is being called during GC.
1202 flush_dependencies(is_alive);
|