8209189: Make CompiledMethod::do_unloading more concurrent

Reviewed-by: kvn, coleenp
This commit is contained in:
Erik Österlund 2018-11-02 08:33:59 +01:00
parent 97d3dc7902
commit 25f14cd757
15 changed files with 309 additions and 447 deletions

View file

@ -27,6 +27,7 @@
#include "code/codeBlob.hpp"
#include "code/nmethod.hpp"
#include "gc/shared/gcBehaviours.hpp"
#include "memory/allocation.hpp"
#include "memory/heap.hpp"
#include "oops/instanceKlass.hpp"
@ -90,8 +91,8 @@ class CodeCache : AllStatic {
static address _low_bound; // Lower bound of CodeHeap addresses
static address _high_bound; // Upper bound of CodeHeap addresses
static int _number_of_nmethods_with_dependencies; // Total number of nmethods with dependencies
static bool _needs_cache_clean; // True if inline caches of the nmethods needs to be flushed
static nmethod* _scavenge_root_nmethods; // linked via nm->scavenge_root_link()
static uint8_t _unloading_cycle; // Global state for recognizing old nmethods that need to be unloaded
static void mark_scavenge_root_nmethods() PRODUCT_RETURN;
static void verify_perm_nmethods(CodeBlobClosure* f_or_null) PRODUCT_RETURN;
@ -172,7 +173,24 @@ class CodeCache : AllStatic {
// to) any unmarked codeBlobs in the cache. Sets "marked_for_unloading"
// to "true" iff some code got unloaded.
// "unloading_occurred" controls whether metadata should be cleaned because of class unloading.
class UnloadingScope: StackObj {
ClosureIsUnloadingBehaviour _is_unloading_behaviour;
public:
UnloadingScope(BoolObjectClosure* is_alive)
: _is_unloading_behaviour(is_alive)
{
IsUnloadingBehaviour::set_current(&_is_unloading_behaviour);
increment_unloading_cycle();
}
~UnloadingScope() {
IsUnloadingBehaviour::set_current(NULL);
}
};
static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
static uint16_t unloading_cycle() { return _unloading_cycle; }
static void increment_unloading_cycle();
static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
// Apply f to every live code blob in scavengable nmethods. Prune nmethods
@ -222,12 +240,8 @@ class CodeCache : AllStatic {
static double reverse_free_ratio(int code_blob_type);
static bool needs_cache_clean() { return _needs_cache_clean; }
static void set_needs_cache_clean(bool v) { _needs_cache_clean = v; }
static void clear_inline_caches(); // clear all inline caches
static void cleanup_inline_caches(); // clean unloaded/zombie nmethods from inline caches
static void do_unloading_nmethod_caches(bool class_unloading_occurred); // clean all nmethod caches for unloading, including inline caches
// Returns true if an own CodeHeap for the given CodeBlobType is available
static bool heap_available(int code_blob_type);