< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Print this page
rev 50815 : Abstraction for TLAB dummy object


 863   }
 864 
 865   if (in_new_region) {
 866     control_thread()->notify_heap_changed();
 867   }
 868 
 869   if (result != NULL) {
 870     log_develop_trace(gc, alloc)("allocate memory chunk of size "SIZE_FORMAT" at addr "PTR_FORMAT " by thread %d ",
 871                                  word_size, p2i(result), Thread::current()->osthread()->thread_id());
 872     notify_alloc(word_size, false);
 873   }
 874 
 875   return result;
 876 }
 877 
 878 HeapWord* ShenandoahHeap::allocate_memory_under_lock(size_t word_size, AllocType type, bool& in_new_region) {
 879   ShenandoahHeapLocker locker(lock());
 880   return _free_set->allocate(word_size, type, in_new_region);
 881 }
 882 






 883 HeapWord* ShenandoahHeap::obj_allocate_raw(Klass* klass, size_t size,
 884                                            bool* gc_overhead_limit_was_exceeded, TRAPS) {
 885   size += BrooksPointer::word_size();
 886   HeapWord* result = CollectedHeap::obj_allocate_raw(klass, size, gc_overhead_limit_was_exceeded, THREAD);
 887   if (result != NULL) {
 888     result += BrooksPointer::word_size();
 889     BrooksPointer::initialize(oop(result));
 890     assert(! in_collection_set(result), "never allocate in targetted region");
 891   }
 892   return result;
 893 }
 894 
 895 HeapWord*  ShenandoahHeap::mem_allocate(size_t size,
 896                                         bool*  gc_overhead_limit_was_exceeded) {
 897   return  allocate_memory(size, _alloc_shared);
 898 }
 899 
 900 class ShenandoahEvacuateUpdateRootsClosure: public ExtendedOopClosure {
 901 private:
 902   ShenandoahHeap* _heap;


1938 
1939 void ShenandoahHeap::set_gc_state_mask(uint mask, bool value) {
1940   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should really be Shenandoah safepoint");
1941   _gc_state.set_cond(mask, value);
1942   set_gc_state_all_threads(_gc_state.raw_value());
1943 }
1944 
1945 void ShenandoahHeap::set_concurrent_mark_in_progress(bool in_progress) {
1946   set_gc_state_mask(MARKING, in_progress);
1947   ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress);
1948 }
1949 
1950 void ShenandoahHeap::set_concurrent_traversal_in_progress(bool in_progress) {
1951    set_gc_state_mask(TRAVERSAL | HAS_FORWARDED, in_progress);
1952    ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress);
1953 }
1954 
1955 void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
1956   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only call this at safepoint");
1957   set_gc_state_mask(EVACUATION, in_progress);
1958 }
1959 
1960 HeapWord* ShenandoahHeap::tlab_post_allocation_setup(HeapWord* obj) {
1961   // Initialize Brooks pointer for the next object
1962   HeapWord* result = obj + BrooksPointer::word_size();
1963   BrooksPointer::initialize(oop(result));
1964   return result;
1965 }
1966 
1967 uint ShenandoahHeap::oop_extra_words() {
1968   return BrooksPointer::word_size();
1969 }
1970 
1971 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
1972   _heap(ShenandoahHeap::heap_no_check()) {
1973 }
1974 
1975 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
1976   _heap(ShenandoahHeap::heap_no_check()) {
1977 }
1978 
1979 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
1980   if (CompressedOops::is_null(obj)) {
1981     return false;
1982   }
1983   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1984   shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_mark_in_progress() || _heap->is_concurrent_traversal_in_progress())




 863   }
 864 
 865   if (in_new_region) {
 866     control_thread()->notify_heap_changed();
 867   }
 868 
 869   if (result != NULL) {
 870     log_develop_trace(gc, alloc)("allocate memory chunk of size "SIZE_FORMAT" at addr "PTR_FORMAT " by thread %d ",
 871                                  word_size, p2i(result), Thread::current()->osthread()->thread_id());
 872     notify_alloc(word_size, false);
 873   }
 874 
 875   return result;
 876 }
 877 
 878 HeapWord* ShenandoahHeap::allocate_memory_under_lock(size_t word_size, AllocType type, bool& in_new_region) {
 879   ShenandoahHeapLocker locker(lock());
 880   return _free_set->allocate(word_size, type, in_new_region);
 881 }
 882 
 883 void ShenandoahHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) {
 884   HeapWord* obj = start + BrooksPointer::word_size();
 885   BrooksPointer::initialize(oop(obj));
 886   CollectedHeap::fill_with_object(obj, end, zap);
 887 }
 888 
 889 HeapWord* ShenandoahHeap::obj_allocate_raw(Klass* klass, size_t size,
 890                                            bool* gc_overhead_limit_was_exceeded, TRAPS) {
 891   size += BrooksPointer::word_size();
 892   HeapWord* result = CollectedHeap::obj_allocate_raw(klass, size, gc_overhead_limit_was_exceeded, THREAD);
 893   if (result != NULL) {
 894     result += BrooksPointer::word_size();
 895     BrooksPointer::initialize(oop(result));
 896     assert(! in_collection_set(result), "never allocate in targetted region");
 897   }
 898   return result;
 899 }
 900 
 901 HeapWord*  ShenandoahHeap::mem_allocate(size_t size,
 902                                         bool*  gc_overhead_limit_was_exceeded) {
 903   return  allocate_memory(size, _alloc_shared);
 904 }
 905 
 906 class ShenandoahEvacuateUpdateRootsClosure: public ExtendedOopClosure {
 907 private:
 908   ShenandoahHeap* _heap;


1944 
1945 void ShenandoahHeap::set_gc_state_mask(uint mask, bool value) {
1946   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should really be Shenandoah safepoint");
1947   _gc_state.set_cond(mask, value);
1948   set_gc_state_all_threads(_gc_state.raw_value());
1949 }
1950 
1951 void ShenandoahHeap::set_concurrent_mark_in_progress(bool in_progress) {
1952   set_gc_state_mask(MARKING, in_progress);
1953   ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress);
1954 }
1955 
1956 void ShenandoahHeap::set_concurrent_traversal_in_progress(bool in_progress) {
1957    set_gc_state_mask(TRAVERSAL | HAS_FORWARDED, in_progress);
1958    ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress);
1959 }
1960 
1961 void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
1962   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only call this at safepoint");
1963   set_gc_state_mask(EVACUATION, in_progress);







1964 }
1965 
1966 uint ShenandoahHeap::oop_extra_words() {
1967   return BrooksPointer::word_size();
1968 }
1969 
1970 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
1971   _heap(ShenandoahHeap::heap_no_check()) {
1972 }
1973 
1974 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
1975   _heap(ShenandoahHeap::heap_no_check()) {
1976 }
1977 
1978 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
1979   if (CompressedOops::is_null(obj)) {
1980     return false;
1981   }
1982   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
1983   shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_mark_in_progress() || _heap->is_concurrent_traversal_in_progress())


< prev index next >