< prev index next >

src/share/vm/gc/parallel/psPromotionManager.cpp

Print this page


   1 /*
   2  * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 298 
 299   OopStarTaskQueue* const tq = claimed_stack_depth();
 300   do {
 301     StarTask p;
 302 
 303     // Drain overflow stack first, so other threads can steal from
 304     // claimed stack while we work.
 305     while (tq->pop_overflow(p)) {
 306       process_popped_location_depth(p);
 307     }
 308 
 309     if (totally_drain) {
 310       while (tq->pop_local(p)) {
 311         process_popped_location_depth(p);
 312       }
 313     } else {
 314       while (tq->size() > _target_stack_size && tq->pop_local(p)) {
 315         process_popped_location_depth(p);
 316       }
 317     }
 318   } while (totally_drain && !tq->taskqueue_empty() || !tq->overflow_empty());
 319 
 320   assert(!totally_drain || tq->taskqueue_empty(), "Sanity");
 321   assert(totally_drain || tq->size() <= _target_stack_size, "Sanity");
 322   assert(tq->overflow_empty(), "Sanity");
 323 }
 324 
 325 void PSPromotionManager::flush_labs() {
 326   assert(stacks_empty(), "Attempt to flush lab with live stack");
 327 
 328   // If either promotion lab fills up, we can flush the
 329   // lab but not refill it, so check first.
 330   assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity");
 331   if (!_young_lab.is_flushed())
 332     _young_lab.flush();
 333 
 334   assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity");
 335   if (!_old_lab.is_flushed())
 336     _old_lab.flush();
 337 
 338   // Let PSScavenge know if we overflowed


   1 /*
   2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 298 
 299   OopStarTaskQueue* const tq = claimed_stack_depth();
 300   do {
 301     StarTask p;
 302 
 303     // Drain overflow stack first, so other threads can steal from
 304     // claimed stack while we work.
 305     while (tq->pop_overflow(p)) {
 306       process_popped_location_depth(p);
 307     }
 308 
 309     if (totally_drain) {
 310       while (tq->pop_local(p)) {
 311         process_popped_location_depth(p);
 312       }
 313     } else {
 314       while (tq->size() > _target_stack_size && tq->pop_local(p)) {
 315         process_popped_location_depth(p);
 316       }
 317     }
 318   } while ((totally_drain && !tq->taskqueue_empty()) || !tq->overflow_empty());
 319 
 320   assert(!totally_drain || tq->taskqueue_empty(), "Sanity");
 321   assert(totally_drain || tq->size() <= _target_stack_size, "Sanity");
 322   assert(tq->overflow_empty(), "Sanity");
 323 }
 324 
 325 void PSPromotionManager::flush_labs() {
 326   assert(stacks_empty(), "Attempt to flush lab with live stack");
 327 
 328   // If either promotion lab fills up, we can flush the
 329   // lab but not refill it, so check first.
 330   assert(!_young_lab.is_flushed() || _young_gen_is_full, "Sanity");
 331   if (!_young_lab.is_flushed())
 332     _young_lab.flush();
 333 
 334   assert(!_old_lab.is_flushed() || _old_gen_is_full, "Sanity");
 335   if (!_old_lab.is_flushed())
 336     _old_lab.flush();
 337 
 338   // Let PSScavenge know if we overflowed


< prev index next >