< prev index next >

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

Print this page
*** 1,7 ***
--- 1,8 ---
  /*
   * Copyright (c) 2015, 2022, Red Hat, Inc. All rights reserved.
+  * Copyright Amazon.com Inc. or its affiliates. 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.

*** 25,34 ***
  #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
  #define SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
  
  #include "gc/shared/stringdedup/stringDedup.hpp"
  #include "gc/shenandoah/shenandoahClosures.inline.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  #include "gc/shenandoah/shenandoahTaskqueue.hpp"
  #include "gc/shenandoah/shenandoahUtils.hpp"
  #include "memory/iterator.hpp"
  #include "runtime/javaThread.hpp"
  
- enum StringDedupMode {
-   NO_DEDUP,      // Do not do anything for String deduplication
-   ENQUEUE_DEDUP, // Enqueue candidate Strings for deduplication, if meet age threshold
-   ALWAYS_DEDUP   // Enqueue Strings for deduplication
- };
- 
  class ShenandoahMarkRefsSuperClosure : public MetadataVisitingOopIterateClosure {
  private:
    ShenandoahObjToScanQueue* _queue;
    ShenandoahMarkingContext* const _mark_context;
    bool _weak;
  
  protected:
!   template <class T>
    void work(T *p);
  
  public:
!   ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp);
  
    bool is_weak() const {
      return _weak;
    }
  
--- 26,30 ---
  #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
  #define SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
  
  #include "gc/shared/stringdedup/stringDedup.hpp"
  #include "gc/shenandoah/shenandoahClosures.inline.hpp"
+ #include "gc/shenandoah/shenandoahGenerationType.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  #include "gc/shenandoah/shenandoahTaskqueue.hpp"
  #include "gc/shenandoah/shenandoahUtils.hpp"
  #include "memory/iterator.hpp"
  #include "runtime/javaThread.hpp"
  
  class ShenandoahMarkRefsSuperClosure : public MetadataVisitingOopIterateClosure {
  private:
    ShenandoahObjToScanQueue* _queue;
+   ShenandoahObjToScanQueue* _old_queue;
    ShenandoahMarkingContext* const _mark_context;
    bool _weak;
  
  protected:
!   template <class T, ShenandoahGenerationType GENERATION>
    void work(T *p);
  
  public:
!   ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp, ShenandoahObjToScanQueue* old_q);
  
    bool is_weak() const {
      return _weak;
    }
  

*** 68,48 ***
  
  class ShenandoahMarkUpdateRefsSuperClosure : public ShenandoahMarkRefsSuperClosure {
  protected:
    ShenandoahHeap* const _heap;
  
!   template <class T>
    inline void work(T* p);
  
  public:
!   ShenandoahMarkUpdateRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
!     ShenandoahMarkRefsSuperClosure(q, rp),
      _heap(ShenandoahHeap::heap()) {
      assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
    };
  };
  
  class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkUpdateRefsSuperClosure {
  private:
    template <class T>
!   inline void do_oop_work(T* p)     { work<T>(p); }
  
  public:
!   ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
!     ShenandoahMarkUpdateRefsSuperClosure(q, rp) {}
  
    virtual void do_oop(narrowOop* p) { do_oop_work(p); }
    virtual void do_oop(oop* p)       { do_oop_work(p); }
  };
  
  class ShenandoahMarkRefsClosure : public ShenandoahMarkRefsSuperClosure {
  private:
    template <class T>
!   inline void do_oop_work(T* p)     { work<T>(p); }
  
  public:
!   ShenandoahMarkRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
!     ShenandoahMarkRefsSuperClosure(q, rp) {};
  
    virtual void do_oop(narrowOop* p) { do_oop_work(p); }
    virtual void do_oop(oop* p)       { do_oop_work(p); }
  };
  
- 
  class ShenandoahUpdateRefsSuperClosure : public ShenandoahOopClosureBase {
  protected:
    ShenandoahHeap* _heap;
  
  public:
--- 65,49 ---
  
  class ShenandoahMarkUpdateRefsSuperClosure : public ShenandoahMarkRefsSuperClosure {
  protected:
    ShenandoahHeap* const _heap;
  
!   template <class T, ShenandoahGenerationType GENERATION>
    inline void work(T* p);
  
  public:
!   ShenandoahMarkUpdateRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp, ShenandoahObjToScanQueue* old_q) :
!     ShenandoahMarkRefsSuperClosure(q, rp, old_q),
      _heap(ShenandoahHeap::heap()) {
      assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
    };
  };
  
+ template <ShenandoahGenerationType GENERATION>
  class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkUpdateRefsSuperClosure {
  private:
    template <class T>
!   inline void do_oop_work(T* p)     { work<T, GENERATION>(p); }
  
  public:
!   ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp, ShenandoahObjToScanQueue* old_q) :
!     ShenandoahMarkUpdateRefsSuperClosure(q, rp, old_q) {}
  
    virtual void do_oop(narrowOop* p) { do_oop_work(p); }
    virtual void do_oop(oop* p)       { do_oop_work(p); }
  };
  
+ template <ShenandoahGenerationType GENERATION>
  class ShenandoahMarkRefsClosure : public ShenandoahMarkRefsSuperClosure {
  private:
    template <class T>
!   inline void do_oop_work(T* p)     { work<T, GENERATION>(p); }
  
  public:
!   ShenandoahMarkRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp, ShenandoahObjToScanQueue* old_q) :
!     ShenandoahMarkRefsSuperClosure(q, rp, old_q) {};
  
    virtual void do_oop(narrowOop* p) { do_oop_work(p); }
    virtual void do_oop(oop* p)       { do_oop_work(p); }
  };
  
  class ShenandoahUpdateRefsSuperClosure : public ShenandoahOopClosureBase {
  protected:
    ShenandoahHeap* _heap;
  
  public:
< prev index next >