--- old/src/share/vm/gc_implementation/g1/heapRegion.hpp 2013-06-26 14:23:33.555054820 -0700 +++ new/src/share/vm/gc_implementation/g1/heapRegion.hpp 2013-06-26 14:23:33.307922722 -0700 @@ -52,6 +52,7 @@ class HeapRegionRemSetIterator; class HeapRegion; class HeapRegionSetBase; +class nmethod; #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" #define HR_FORMAT_PARAMS(_hr_) \ @@ -337,6 +338,9 @@ // the total value for the collection set. size_t _predicted_bytes_to_copy; + // A list of code blobs (nmethods) whose code contains pointers into this region + GrowableArray* _strong_code_root_list; + public: HeapRegion(uint hrs_index, G1BlockOffsetSharedArray* sharedOffsetArray, @@ -371,7 +375,8 @@ RebuildRSClaimValue = 5, ParEvacFailureClaimValue = 6, AggregateCountClaimValue = 7, - VerifyCountClaimValue = 8 + VerifyCountClaimValue = 8, + ParMarkRootClaimValue = 9 }; inline HeapWord* par_allocate_no_bot_updates(size_t word_size) { @@ -796,6 +801,33 @@ virtual void reset_after_compaction(); + // Routines for managing the list of code roots that point into + // this heap region. + void add_strong_code_root(nmethod* nm); + void remove_strong_code_root(nmethod* nm); + + GrowableArray* strong_code_root_list() { + return _strong_code_root_list; + } + + // During a collection, migrate successfully evacuated strong + // code roots attached to this region to the new regions that + // they point into. Unsuccessfully evacuated code roots are + // not migrated. + void migrate_strong_code_roots(); + + // Applies blk->do_code_blob() to each of the entries in + // the strong code roots list; + void strong_code_roots_do(CodeBlobClosure* blk) const; + + // Returns the amount of memory, in bytes, currently + // consumed by the strong code roots. + size_t strong_code_root_mem_size(); + + // Verify that the entries on the strong code root list are live and + // include at least one pointer into this region. + void verify_strong_code_roots(VerifyOption vo, bool* failures) const; + void print() const; void print_on(outputStream* st) const;