Mercurial > hg > graal-compiler
comparison src/share/vm/code/nmethod.hpp @ 12324:510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
Summary: Code cache sweeping based on method hotness; removed speculatively disconnect
Reviewed-by: kvn, iveresov
author | anoll |
---|---|
date | Fri, 27 Sep 2013 10:50:55 +0200 |
parents | 9758d9f36299 |
children | cefad50507d8 df832bd8edb9 |
comparison
equal
deleted
inserted
replaced
12323:c9ccd7b85f20 | 12324:510fbd28919c |
---|---|
117 jmethodID _jmethod_id; // Cache of method()->jmethod_id() | 117 jmethodID _jmethod_id; // Cache of method()->jmethod_id() |
118 | 118 |
119 // To support simple linked-list chaining of nmethods: | 119 // To support simple linked-list chaining of nmethods: |
120 nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head | 120 nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head |
121 nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods | 121 nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods |
122 nmethod* _saved_nmethod_link; // from CodeCache::speculatively_disconnect | |
123 | 122 |
124 static nmethod* volatile _oops_do_mark_nmethods; | 123 static nmethod* volatile _oops_do_mark_nmethods; |
125 nmethod* volatile _oops_do_mark_link; | 124 nmethod* volatile _oops_do_mark_link; |
126 | 125 |
127 AbstractCompiler* _compiler; // The compiler which compiled this nmethod | 126 AbstractCompiler* _compiler; // The compiler which compiled this nmethod |
163 int _compile_id; // which compilation made this nmethod | 162 int _compile_id; // which compilation made this nmethod |
164 int _comp_level; // compilation level | 163 int _comp_level; // compilation level |
165 | 164 |
166 // protected by CodeCache_lock | 165 // protected by CodeCache_lock |
167 bool _has_flushed_dependencies; // Used for maintenance of dependencies (CodeCache_lock) | 166 bool _has_flushed_dependencies; // Used for maintenance of dependencies (CodeCache_lock) |
168 bool _speculatively_disconnected; // Marked for potential unload | |
169 | 167 |
170 bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper) | 168 bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper) |
171 bool _marked_for_deoptimization; // Used for stack deoptimization | 169 bool _marked_for_deoptimization; // Used for stack deoptimization |
172 | 170 |
173 // used by jvmti to track if an unload event has been posted for this nmethod. | 171 // used by jvmti to track if an unload event has been posted for this nmethod. |
178 unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? | 176 unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? |
179 unsigned int _lazy_critical_native:1; // Lazy JNI critical native | 177 unsigned int _lazy_critical_native:1; // Lazy JNI critical native |
180 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints | 178 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints |
181 | 179 |
182 // Protected by Patching_lock | 180 // Protected by Patching_lock |
183 unsigned char _state; // {alive, not_entrant, zombie, unloaded} | 181 volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} |
184 | 182 |
185 #ifdef ASSERT | 183 #ifdef ASSERT |
186 bool _oops_are_stale; // indicates that it's no longer safe to access oops section | 184 bool _oops_are_stale; // indicates that it's no longer safe to access oops section |
187 #endif | 185 #endif |
188 | 186 |
200 // event processing needs to be done. | 198 // event processing needs to be done. |
201 jint _lock_count; | 199 jint _lock_count; |
202 | 200 |
203 // not_entrant method removal. Each mark_sweep pass will update | 201 // not_entrant method removal. Each mark_sweep pass will update |
204 // this mark to current sweep invocation count if it is seen on the | 202 // this mark to current sweep invocation count if it is seen on the |
205 // stack. An not_entrant method can be removed when there is no | 203 // stack. An not_entrant method can be removed when there are no |
206 // more activations, i.e., when the _stack_traversal_mark is less than | 204 // more activations, i.e., when the _stack_traversal_mark is less than |
207 // current sweep traversal index. | 205 // current sweep traversal index. |
208 long _stack_traversal_mark; | 206 long _stack_traversal_mark; |
207 | |
208 // The _hotness_counter indicates the hotness of a method. The higher | |
209 // the value the hotter the method. The hotness counter of a nmethod is | |
210 // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method | |
211 // is active while stack scanning (mark_active_nmethods()). The hotness | |
212 // counter is decreased (by 1) while sweeping. | |
213 int _hotness_counter; | |
209 | 214 |
210 ExceptionCache *_exception_cache; | 215 ExceptionCache *_exception_cache; |
211 PcDescCache _pc_desc_cache; | 216 PcDescCache _pc_desc_cache; |
212 | 217 |
213 // These are used for compiled synchronized native methods to | 218 // These are used for compiled synchronized native methods to |
380 int handler_table_size() const { return handler_table_end() - handler_table_begin(); } | 385 int handler_table_size() const { return handler_table_end() - handler_table_begin(); } |
381 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } | 386 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } |
382 | 387 |
383 int total_size () const; | 388 int total_size () const; |
384 | 389 |
390 void dec_hotness_counter() { _hotness_counter--; } | |
391 void set_hotness_counter(int val) { _hotness_counter = val; } | |
392 int hotness_counter() const { return _hotness_counter; } | |
393 | |
385 // Containment | 394 // Containment |
386 bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } | 395 bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } |
387 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } | 396 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } |
388 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } | 397 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } |
389 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } | 398 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } |
406 | 415 |
407 // Make the nmethod non entrant. The nmethod will continue to be | 416 // Make the nmethod non entrant. The nmethod will continue to be |
408 // alive. It is used when an uncommon trap happens. Returns true | 417 // alive. It is used when an uncommon trap happens. Returns true |
409 // if this thread changed the state of the nmethod or false if | 418 // if this thread changed the state of the nmethod or false if |
410 // another thread performed the transition. | 419 // another thread performed the transition. |
411 bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } | 420 bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } |
412 bool make_zombie() { return make_not_entrant_or_zombie(zombie); } | 421 bool make_zombie() { return make_not_entrant_or_zombie(zombie); } |
413 | 422 |
414 // used by jvmti to track if the unload event has been reported | 423 // used by jvmti to track if the unload event has been reported |
415 bool unload_reported() { return _unload_reported; } | 424 bool unload_reported() { return _unload_reported; } |
416 void set_unload_reported() { _unload_reported = true; } | 425 void set_unload_reported() { _unload_reported = true; } |
417 | 426 |
434 bool has_unsafe_access() const { return _has_unsafe_access; } | 443 bool has_unsafe_access() const { return _has_unsafe_access; } |
435 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } | 444 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } |
436 | 445 |
437 bool has_method_handle_invokes() const { return _has_method_handle_invokes; } | 446 bool has_method_handle_invokes() const { return _has_method_handle_invokes; } |
438 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } | 447 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } |
439 | |
440 bool is_speculatively_disconnected() const { return _speculatively_disconnected; } | |
441 void set_speculatively_disconnected(bool z) { _speculatively_disconnected = z; } | |
442 | 448 |
443 bool is_lazy_critical_native() const { return _lazy_critical_native; } | 449 bool is_lazy_critical_native() const { return _lazy_critical_native; } |
444 void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } | 450 void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } |
445 | 451 |
446 bool has_wide_vectors() const { return _has_wide_vectors; } | 452 bool has_wide_vectors() const { return _has_wide_vectors; } |
497 // N.B. there is no positive marked query, and we only use the not_marked query for asserts. | 503 // N.B. there is no positive marked query, and we only use the not_marked query for asserts. |
498 #endif //PRODUCT | 504 #endif //PRODUCT |
499 nmethod* scavenge_root_link() const { return _scavenge_root_link; } | 505 nmethod* scavenge_root_link() const { return _scavenge_root_link; } |
500 void set_scavenge_root_link(nmethod *n) { _scavenge_root_link = n; } | 506 void set_scavenge_root_link(nmethod *n) { _scavenge_root_link = n; } |
501 | 507 |
502 nmethod* saved_nmethod_link() const { return _saved_nmethod_link; } | |
503 void set_saved_nmethod_link(nmethod *n) { _saved_nmethod_link = n; } | |
504 | |
505 public: | 508 public: |
506 | 509 |
507 // Sweeper support | 510 // Sweeper support |
508 long stack_traversal_mark() { return _stack_traversal_mark; } | 511 long stack_traversal_mark() { return _stack_traversal_mark; } |
509 void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; } | 512 void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; } |