hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp
changeset 30613 a7815bb05ae2
parent 29464 02c245ad3ec9
equal deleted inserted replaced
30612:89fd070a30a3 30613:a7815bb05ae2
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    75     set_active(true);
    75     set_active(true);
    76   }
    76   }
    77 }
    77 }
    78 
    78 
    79 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
    79 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
    80   SuspendibleThreadSetJoiner sts;
    80   SuspendibleThreadSetJoiner sts_join;
    81   G1CollectedHeap* g1h = G1CollectedHeap::heap();
    81   G1CollectedHeap* g1h = G1CollectedHeap::heap();
    82   G1CollectorPolicy* g1p = g1h->g1_policy();
    82   G1CollectorPolicy* g1p = g1h->g1_policy();
    83   if (g1p->adaptive_young_list_length()) {
    83   if (g1p->adaptive_young_list_length()) {
    84     int regions_visited = 0;
    84     int regions_visited = 0;
    85     g1h->young_list()->rs_length_sampling_init();
    85     g1h->young_list()->rs_length_sampling_init();
    87       g1h->young_list()->rs_length_sampling_next();
    87       g1h->young_list()->rs_length_sampling_next();
    88       ++regions_visited;
    88       ++regions_visited;
    89 
    89 
    90       // we try to yield every time we visit 10 regions
    90       // we try to yield every time we visit 10 regions
    91       if (regions_visited == 10) {
    91       if (regions_visited == 10) {
    92         if (sts.should_yield()) {
    92         if (sts_join.should_yield()) {
    93           sts.yield();
    93           sts_join.yield();
    94           // we just abandon the iteration
    94           // we just abandon the iteration
    95           break;
    95           break;
    96         }
    96         }
    97         regions_visited = 0;
    97         regions_visited = 0;
    98       }
    98       }
   186     if (_should_terminate) {
   186     if (_should_terminate) {
   187       break;
   187       break;
   188     }
   188     }
   189 
   189 
   190     {
   190     {
   191       SuspendibleThreadSetJoiner sts;
   191       SuspendibleThreadSetJoiner sts_join;
   192 
   192 
   193       do {
   193       do {
   194         int curr_buffer_num = (int)dcqs.completed_buffers_num();
   194         int curr_buffer_num = (int)dcqs.completed_buffers_num();
   195         // If the number of the buffers falls down into the yellow zone,
   195         // If the number of the buffers falls down into the yellow zone,
   196         // that means that the transition period after the evacuation pause has ended.
   196         // that means that the transition period after the evacuation pause has ended.