Mercurial > hg > graal-compiler
changeset 10033:9d6f0c55cda7
Merge
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Wed, 12 Jun 2013 11:37:45 +0200 |
parents | 4a7dc38ae96b (diff) c4a0e878868f (current diff) |
children | 6cbb7fb49de5 |
files | |
diffstat | 6 files changed, 45 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/code/codeCache.cpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/code/codeCache.cpp Wed Jun 12 11:37:45 2013 +0200 @@ -303,6 +303,15 @@ } } +#ifdef GRAAL +void CodeCache::alive_nmethods_do_graal_methods(OopClosure* closure) { + assert_locked_or_safepoint(CodeCache_lock); + FOR_ALL_ALIVE_NMETHODS(nm) { + nm->mark_graal_reference(closure); + } +} +#endif + int CodeCache::alignment_unit() { return (int)_heap->alignment_unit(); }
--- a/src/share/vm/code/codeCache.hpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/code/codeCache.hpp Wed Jun 12 11:37:45 2013 +0200 @@ -81,7 +81,12 @@ static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods - +#ifdef GRAAL + //Special method iterating and marking all HotSpotNMethods which are weakly referenced by nmethods. + //This has to be done since the HotSpotNMethods are only referenced from within the nmethods and the GC + //believes they are dead since they are not marked. + static void alive_nmethods_do_graal_methods(OopClosure* closure); +#endif // Lookup static CodeBlob* find_blob(void* start); static nmethod* find_nmethod(void* start);
--- a/src/share/vm/code/nmethod.cpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/code/nmethod.cpp Wed Jun 12 11:37:45 2013 +0200 @@ -1861,6 +1861,13 @@ #endif } +#ifdef GRAAL +void nmethod::mark_graal_reference(OopClosure* f) { + if (_graal_installed_code != NULL) { + f->do_oop((oop*) &_graal_installed_code); + } +} +#endif // Iterate over metadata calling this function. Used by RedefineClasses void nmethod::metadata_do(void f(Metadata*)) {
--- a/src/share/vm/code/nmethod.hpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/code/nmethod.hpp Wed Jun 12 11:37:45 2013 +0200 @@ -743,6 +743,10 @@ nm->metadata_do(Metadata::mark_on_stack); } void metadata_do(void f(Metadata*)); + +#ifdef GRAAL + void mark_graal_reference(OopClosure* f); +#endif }; // Locks an nmethod so its code will not get removed and it will not
--- a/src/share/vm/memory/referenceProcessor.cpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/memory/referenceProcessor.cpp Wed Jun 12 11:37:45 2013 +0200 @@ -32,6 +32,10 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" #include "runtime/jniHandles.hpp" +#ifdef GRAAL +#include "code/codeCache.hpp" +#include "code/nmethod.hpp" +#endif ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; @@ -243,6 +247,9 @@ task_executor->set_single_threaded_mode(); } process_phaseJNI(is_alive, keep_alive, complete_gc); +#ifdef GRAAL + process_phaseGraalNMethods(keep_alive, complete_gc); +#endif } } @@ -284,6 +291,14 @@ complete_gc->do_void(); } +#ifdef GRAAL +void ReferenceProcessor::process_phaseGraalNMethods(OopClosure* keep_alive, + VoidClosure* complete_gc) { + CodeCache::alive_nmethods_do_graal_methods(keep_alive); + complete_gc->do_void(); +} + +#endif template <class T> bool enqueue_discovered_ref_helper(ReferenceProcessor* ref,
--- a/src/share/vm/memory/referenceProcessor.hpp Wed Jun 12 10:12:46 2013 +0200 +++ b/src/share/vm/memory/referenceProcessor.hpp Wed Jun 12 11:37:45 2013 +0200 @@ -293,6 +293,10 @@ void process_phaseJNI(BoolObjectClosure* is_alive, OopClosure* keep_alive, VoidClosure* complete_gc); +#ifdef GRAAL + void process_phaseGraalNMethods(OopClosure* keep_alive, + VoidClosure* complete_gc); +#endif // Work methods used by the method process_discovered_reflist // Phase1: keep alive all those referents that are otherwise