< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp

Print this page
rev 55401 : 8225582: Shenandoah: Enable concurrent evacuation of JNIHandles


   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
  25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
  26 


  27 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  28 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
  29 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
  30 #include "gc/shenandoah/shenandoahUtils.hpp"
  31 #include "memory/resourceArea.hpp"




















  32 
  33 template <typename IsAlive, typename KeepAlive>
  34 void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
  35   _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
  36 }
  37 
  38 template <typename ITR>
  39 ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
  40   nmethod::oops_do_marking_prologue();
  41 }
  42 
  43 template <typename ITR>
  44 void ShenandoahCodeCacheRoots<ITR>::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
  45   ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
  46   ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
  47   _coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
  48 }
  49 
  50 template <typename ITR>
  51 ShenandoahCodeCacheRoots<ITR>::~ShenandoahCodeCacheRoots() {




   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
  25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
  26 
  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "gc/shared/oopStorageParState.inline.hpp"
  29 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  30 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
  31 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
  32 #include "gc/shenandoah/shenandoahUtils.hpp"
  33 #include "memory/resourceArea.hpp"
  34 
  35 template <bool CONCURRENT>
  36 ShenandoahJNIHandleRoots<CONCURRENT>::ShenandoahJNIHandleRoots() :
  37   _claimed(false),
  38   _itr(JNIHandles::global_handles()) {
  39 }
  40 
  41 template <bool CONCURRENT>
  42 template <typename T>
  43 void ShenandoahJNIHandleRoots<CONCURRENT>::oops_do(T* cl, uint worker_id) {
  44   if (CONCURRENT) {
  45     _itr.oops_do(cl);
  46   } else {
  47     if (!_claimed && Atomic::cmpxchg(true, &_claimed, false) == false) {
  48       ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
  49       ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIRoots, worker_id);
  50       _itr.oops_do(cl);
  51     }
  52   }
  53 }
  54 
  55 template <typename IsAlive, typename KeepAlive>
  56 void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
  57   _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
  58 }
  59 
  60 template <typename ITR>
  61 ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
  62   nmethod::oops_do_marking_prologue();
  63 }
  64 
  65 template <typename ITR>
  66 void ShenandoahCodeCacheRoots<ITR>::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
  67   ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
  68   ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
  69   _coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
  70 }
  71 
  72 template <typename ITR>
  73 ShenandoahCodeCacheRoots<ITR>::~ShenandoahCodeCacheRoots() {


< prev index next >