Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.hpp @ 20278:2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
Reviewed-by: tschatzl, ehelin, brutisso, coleenp, roland, iveresov
Contributed-by: stefan.karlsson@oracle.com, mikael.gerdin@oracle.com
author | stefank |
---|---|
date | Mon, 07 Jul 2014 10:12:40 +0200 |
parents | 9717199cb8de |
children | aff6ccb506cb |
comparison
equal
deleted
inserted
replaced
20277:882004b9e7e1 | 20278:2c6ef90f030a |
---|---|
114 class nmethod : public CodeBlob { | 114 class nmethod : public CodeBlob { |
115 friend class VMStructs; | 115 friend class VMStructs; |
116 friend class NMethodSweeper; | 116 friend class NMethodSweeper; |
117 friend class CodeCache; // scavengable oops | 117 friend class CodeCache; // scavengable oops |
118 private: | 118 private: |
119 | |
120 // GC support to help figure out if an nmethod has been | |
121 // cleaned/unloaded by the current GC. | |
122 static unsigned char _global_unloading_clock; | |
123 | |
119 // Shared fields for all nmethod's | 124 // Shared fields for all nmethod's |
120 Method* _method; | 125 Method* _method; |
121 int _entry_bci; // != InvocationEntryBci if this nmethod is an on-stack replacement method | 126 int _entry_bci; // != InvocationEntryBci if this nmethod is an on-stack replacement method |
122 jmethodID _jmethod_id; // Cache of method()->jmethod_id() | 127 jmethodID _jmethod_id; // Cache of method()->jmethod_id() |
123 | 128 |
124 // To support simple linked-list chaining of nmethods: | 129 // To support simple linked-list chaining of nmethods: |
125 nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head | 130 nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head |
126 nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods | 131 |
132 union { | |
133 // Used by G1 to chain nmethods. | |
134 nmethod* _unloading_next; | |
135 // Used by non-G1 GCs to chain nmethods. | |
136 nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods | |
137 }; | |
127 | 138 |
128 static nmethod* volatile _oops_do_mark_nmethods; | 139 static nmethod* volatile _oops_do_mark_nmethods; |
129 nmethod* volatile _oops_do_mark_link; | 140 nmethod* volatile _oops_do_mark_link; |
130 | 141 |
131 AbstractCompiler* _compiler; // The compiler which compiled this nmethod | 142 AbstractCompiler* _compiler; // The compiler which compiled this nmethod |
182 unsigned int _lazy_critical_native:1; // Lazy JNI critical native | 193 unsigned int _lazy_critical_native:1; // Lazy JNI critical native |
183 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints | 194 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints |
184 | 195 |
185 // Protected by Patching_lock | 196 // Protected by Patching_lock |
186 volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} | 197 volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} |
198 | |
199 volatile unsigned char _unloading_clock; // Incremented after GC unloaded/cleaned the nmethod | |
187 | 200 |
188 #ifdef ASSERT | 201 #ifdef ASSERT |
189 bool _oops_are_stale; // indicates that it's no longer safe to access oops section | 202 bool _oops_are_stale; // indicates that it's no longer safe to access oops section |
190 #endif | 203 #endif |
191 | 204 |
440 | 453 |
441 // used by jvmti to track if the unload event has been reported | 454 // used by jvmti to track if the unload event has been reported |
442 bool unload_reported() { return _unload_reported; } | 455 bool unload_reported() { return _unload_reported; } |
443 void set_unload_reported() { _unload_reported = true; } | 456 void set_unload_reported() { _unload_reported = true; } |
444 | 457 |
458 void set_unloading_next(nmethod* next) { _unloading_next = next; } | |
459 nmethod* unloading_next() { return _unloading_next; } | |
460 | |
461 static unsigned char global_unloading_clock() { return _global_unloading_clock; } | |
462 static void increase_unloading_clock(); | |
463 | |
464 void set_unloading_clock(unsigned char unloading_clock); | |
465 unsigned char unloading_clock(); | |
466 | |
445 bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; } | 467 bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; } |
446 void mark_for_deoptimization() { _marked_for_deoptimization = true; } | 468 void mark_for_deoptimization() { _marked_for_deoptimization = true; } |
447 | 469 |
448 void make_unloaded(BoolObjectClosure* is_alive, oop cause); | 470 void make_unloaded(BoolObjectClosure* is_alive, oop cause); |
449 | 471 |
555 void cleanup_inline_caches(); | 577 void cleanup_inline_caches(); |
556 bool inlinecache_check_contains(address addr) const { | 578 bool inlinecache_check_contains(address addr) const { |
557 return (addr >= code_begin() && addr < verified_entry_point()); | 579 return (addr >= code_begin() && addr < verified_entry_point()); |
558 } | 580 } |
559 | 581 |
582 // Verify calls to dead methods have been cleaned. | |
583 void verify_clean_inline_caches(); | |
584 // Verify and count cached icholder relocations. | |
585 int verify_icholder_relocations(); | |
560 // Check that all metadata is still alive | 586 // Check that all metadata is still alive |
561 void verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive); | 587 void verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive); |
562 | 588 |
563 // unlink and deallocate this nmethod | 589 // unlink and deallocate this nmethod |
564 // Only NMethodSweeper class is expected to use this. NMethodSweeper is not | 590 // Only NMethodSweeper class is expected to use this. NMethodSweeper is not |
580 // Evolution support. We make old (discarded) compiled methods point to new Method*s. | 606 // Evolution support. We make old (discarded) compiled methods point to new Method*s. |
581 void set_method(Method* method) { _method = method; } | 607 void set_method(Method* method) { _method = method; } |
582 | 608 |
583 // GC support | 609 // GC support |
584 void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); | 610 void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); |
611 // The parallel versions are used by G1. | |
612 bool do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred); | |
613 void do_unloading_parallel_postponed(BoolObjectClosure* is_alive, bool unloading_occurred); | |
614 // Unload a nmethod if the *root object is dead. | |
585 bool can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred); | 615 bool can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred); |
586 | 616 |
587 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, | 617 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, |
588 OopClosure* f); | 618 OopClosure* f); |
589 void oops_do(OopClosure* f) { oops_do(f, false); } | 619 void oops_do(OopClosure* f) { oops_do(f, false); } |