< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2013, 2020, Red Hat, Inc. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 166,16 ***
    static const int region_states_num() {
      return _REGION_STATES_NUM;
    }
  
    // Allowed transitions from the outside code:
!   void make_regular_allocation();
    void make_regular_bypass();
    void make_humongous_start();
    void make_humongous_cont();
!   void make_humongous_start_bypass();
!   void make_humongous_cont_bypass();
    void make_pinned();
    void make_unpinned();
    void make_cset();
    void make_trash();
    void make_trash_immediate();
--- 166,16 ---
    static const int region_states_num() {
      return _REGION_STATES_NUM;
    }
  
    // Allowed transitions from the outside code:
!   void make_regular_allocation(ShenandoahRegionAffiliation affiliation);
    void make_regular_bypass();
    void make_humongous_start();
    void make_humongous_cont();
!   void make_humongous_start_bypass(ShenandoahRegionAffiliation affiliation);
!   void make_humongous_cont_bypass(ShenandoahRegionAffiliation affiliation);
    void make_pinned();
    void make_unpinned();
    void make_cset();
    void make_trash();
    void make_trash_immediate();

*** 196,10 ***
--- 196,12 ---
    bool is_humongous_start()        const { return _state == _humongous_start || _state == _pinned_humongous_start; }
    bool is_humongous()              const { return is_humongous_start() || is_humongous_continuation(); }
    bool is_committed()              const { return !is_empty_uncommitted(); }
    bool is_cset()                   const { return _state == _cset   || _state == _pinned_cset; }
    bool is_pinned()                 const { return _state == _pinned || _state == _pinned_cset || _state == _pinned_humongous_start; }
+   bool is_young()                  const { return _affiliation == YOUNG_GENERATION; }
+   bool is_old()                    const { return _affiliation == OLD_GENERATION; }
  
    // Macro-properties:
    bool is_alloc_allowed()          const { return is_empty() || is_regular() || _state == _pinned; }
    bool is_stw_move_allowed()       const { return is_regular() || _state == _cset || (ShenandoahHumongousMoves && _state == _humongous_start); }
  

*** 208,10 ***
--- 210,14 ---
  
    void record_pin();
    void record_unpin();
    size_t pin_count() const;
  
+   void clear_young_lab_flags();
+   void set_young_lab_flag();
+   bool has_young_lab_flag();
+ 
  private:
    static size_t RegionCount;
    static size_t RegionSizeBytes;
    static size_t RegionSizeWords;
    static size_t RegionSizeBytesShift;

*** 232,22 ***
--- 238,29 ---
    HeapWord* _new_top;
    double _empty_time;
  
    // Seldom updated fields
    RegionState _state;
+   HeapWord* _coalesce_and_fill_boundary; // for old regions not selected as collection set candidates.
  
    // Frequently updated fields
    HeapWord* _top;
  
    size_t _tlab_allocs;
    size_t _gclab_allocs;
+   size_t _plab_allocs;
+ 
+   bool _has_young_lab;
  
    volatile size_t _live_data;
    volatile size_t _critical_pins;
  
    HeapWord* volatile _update_watermark;
  
+   ShenandoahRegionAffiliation _affiliation;
+   uint _age;
+ 
  public:
    ShenandoahHeapRegion(HeapWord* start, size_t index, bool committed);
  
    static const size_t MIN_NUM_REGIONS = 10;
  

*** 333,11 ***
    inline size_t index() const {
      return _index;
    }
  
    // Allocation (return NULL if full)
!   inline HeapWord* allocate(size_t word_size, ShenandoahAllocRequest::Type type);
  
    inline void clear_live_data();
    void set_live_data(size_t s);
  
    // Increase live data for newly allocated region
--- 346,14 ---
    inline size_t index() const {
      return _index;
    }
  
    // Allocation (return NULL if full)
!   inline HeapWord* allocate_aligned(size_t word_size, ShenandoahAllocRequest req, size_t alignment_in_words);
+ 
+   // Allocation (return NULL if full)
+   inline HeapWord* allocate(size_t word_size, ShenandoahAllocRequest req);
  
    inline void clear_live_data();
    void set_live_data(size_t s);
  
    // Increase live data for newly allocated region

*** 354,11 ***
  
    void print_on(outputStream* st) const;
  
    void recycle();
  
!   void oop_iterate(OopIterateClosure* cl);
  
    HeapWord* block_start(const void* p) const;
    size_t block_size(const HeapWord* p) const;
    bool block_is_obj(const HeapWord* p) const { return p < top(); }
  
--- 370,36 ---
  
    void print_on(outputStream* st) const;
  
    void recycle();
  
!   inline void begin_preemptible_coalesce_and_fill() {
+     _coalesce_and_fill_boundary = _bottom;
+   }
+ 
+   inline void end_preemptible_coalesce_and_fill() {
+     _coalesce_and_fill_boundary = _end;
+   }
+ 
+   inline void suspend_coalesce_and_fill(HeapWord* next_focus) {
+     _coalesce_and_fill_boundary = next_focus;
+   }
+ 
+   inline HeapWord* resume_coalesce_and_fill() {
+     return _coalesce_and_fill_boundary;
+   }
+ 
+   // Coalesce contiguous spans of garbage objects by filling header and reregistering start locations with remembered set.
+   // This is used by old-gen GC following concurrent marking to make old-gen HeapRegions parseable.  Return true iff
+   // region is completely coalesced and filled.  Returns false if cancelled before task is complete.
+   bool oop_fill_and_coalesce();
+ 
+   // During global collections, this service iterates through an old-gen heap region that is not part of collection
+   // set to fill and register ranges of dead memory.  Note that live objects were previously registered.  Some dead objects
+   // that are subsumed into coalesced ranges of dead memory need to be "unregistered".
+   void global_oop_iterate_and_fill_dead(OopIterateClosure* cl);
+   void oop_iterate_humongous(OopIterateClosure* cl);
  
    HeapWord* block_start(const void* p) const;
    size_t block_size(const HeapWord* p) const;
    bool block_is_obj(const HeapWord* p) const { return p < top(); }
  

*** 381,21 ***
    inline void adjust_alloc_metadata(ShenandoahAllocRequest::Type type, size_t);
    void reset_alloc_metadata();
    size_t get_shared_allocs() const;
    size_t get_tlab_allocs() const;
    size_t get_gclab_allocs() const;
  
    inline HeapWord* get_update_watermark() const;
    inline void set_update_watermark(HeapWord* w);
    inline void set_update_watermark_at_safepoint(HeapWord* w);
  
  private:
    void do_commit();
    void do_uncommit();
  
!   void oop_iterate_objects(OopIterateClosure* cl);
!   void oop_iterate_humongous(OopIterateClosure* cl);
  
    inline void internal_increase_live_data(size_t s);
  
    void set_state(RegionState to);
  };
--- 422,36 ---
    inline void adjust_alloc_metadata(ShenandoahAllocRequest::Type type, size_t);
    void reset_alloc_metadata();
    size_t get_shared_allocs() const;
    size_t get_tlab_allocs() const;
    size_t get_gclab_allocs() const;
+   size_t get_plab_allocs() const;
  
    inline HeapWord* get_update_watermark() const;
    inline void set_update_watermark(HeapWord* w);
    inline void set_update_watermark_at_safepoint(HeapWord* w);
  
+   ShenandoahRegionAffiliation affiliation() const {
+     return _affiliation;
+   }
+ 
+   void set_affiliation(ShenandoahRegionAffiliation new_affiliation);
+ 
+   uint age()           { return _age; }
+   void increment_age() { if (_age < markWord::max_age) { _age++; } }
+   void reset_age()     { _age = 0; }
+ 
+   // Sets all remembered set cards to dirty.  Returns the number of regions spanned by the associated humongous object.
+   size_t promote_humongous();
+ 
  private:
    void do_commit();
    void do_uncommit();
  
!   // This is an old-region that was not part of the collection set during a GLOBAL collection.  We coalesce the dead
!   // objects, but do not need to register the live objects as they are already registered.
+   void global_oop_iterate_objects_and_fill_dead(OopIterateClosure* cl);
  
    inline void internal_increase_live_data(size_t s);
  
    void set_state(RegionState to);
  };
< prev index next >