< prev index next >

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

Print this page
@@ -1,7 +1,8 @@
  /*
   * Copyright (c) 2017, 2021, 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.

@@ -30,29 +31,31 @@
  #include "gc/shared/gcWhen.hpp"
  #include "gc/shared/referenceProcessorStats.hpp"
  #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
  #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  #include "gc/shenandoah/shenandoahHeap.inline.hpp"
+ #include "gc/shenandoah/shenandoahOldGeneration.hpp"
  #include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
  #include "gc/shenandoah/shenandoahUtils.hpp"
+ #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
  #include "utilities/debug.hpp"
  
  ShenandoahPhaseTimings::Phase ShenandoahTimingsTracker::_current_phase = ShenandoahPhaseTimings::_invalid_phase;
  
- ShenandoahGCSession::ShenandoahGCSession(GCCause::Cause cause) :
+ ShenandoahGCSession::ShenandoahGCSession(GCCause::Cause cause, ShenandoahGeneration* generation) :
    _heap(ShenandoahHeap::heap()),
+   _generation(generation),
    _timer(_heap->gc_timer()),
    _tracer(_heap->tracer()) {
    assert(!ShenandoahGCPhase::is_current_phase_valid(), "No current GC phase");
  
-   _heap->set_gc_cause(cause);
+   _heap->on_cycle_start(cause, _generation);
+ 
    _timer->register_gc_start();
    _tracer->report_gc_start(cause, _timer->gc_start());
    _heap->trace_heap_before_gc(_tracer);
  
-   _heap->shenandoah_policy()->record_cycle_start();
-   _heap->heuristics()->record_cycle_start();
    _trace_cycle.initialize(_heap->cycle_memory_manager(), cause,
            "end of GC cycle",
            /* allMemoryPoolsAffected */    true,
            /* recordGCBeginTime = */       true,
            /* recordPreGCUsage = */        true,

@@ -63,17 +66,17 @@
            /* countCollection = */         true
    );
  }
  
  ShenandoahGCSession::~ShenandoahGCSession() {
-   _heap->heuristics()->record_cycle_end();
+   _heap->on_cycle_end(_generation);
    _timer->register_gc_end();
    _heap->trace_heap_after_gc(_tracer);
-   _tracer->report_gc_reference_stats(_heap->ref_processor()->reference_process_stats());
+   _tracer->report_gc_reference_stats(_generation->ref_processor()->reference_process_stats());
    _tracer->report_gc_end(_timer->gc_end(), _timer->time_partitions());
    assert(!ShenandoahGCPhase::is_current_phase_valid(), "No current GC phase");
-   _heap->set_gc_cause(GCCause::_no_gc);
+ 
  }
  
  ShenandoahGCPauseMark::ShenandoahGCPauseMark(uint gc_id, const char* notification_message, SvcGCMarker::reason_type type) :
    _heap(ShenandoahHeap::heap()), _gc_id_mark(gc_id), _svc_gc_mark(type), _is_gc_active_mark() {
    _trace_pause.initialize(_heap->stw_memory_manager(), _heap->gc_cause(),
< prev index next >