hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp
author kbarrett
Wed, 02 Sep 2015 11:41:42 -0400
changeset 32612 79a64ccc4613
parent 31994 3721b7aa3a0d
child 37057 03b3e1870228
permissions -rw-r--r--
8134806: Clean up write_ref_field_work Summary: Remove unnecessary pure virtual decl and default argument values. Reviewed-by: jwilhelm, tbenson, jmasa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     1
/*
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     4
 *
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     8
 *
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    13
 * accompanied this code).
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    14
 *
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    18
 *
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    21
 * questions.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    22
 *
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    23
 */
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    25
#ifndef SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    26
#define SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    28
#include "gc/shared/taskqueue.hpp"
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    29
#include "memory/allocation.inline.hpp"
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    30
#include "oops/oop.inline.hpp"
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    31
#include "runtime/atomic.inline.hpp"
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    32
#include "runtime/orderAccess.inline.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    33
#include "utilities/debug.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
    34
#include "utilities/stack.inline.hpp"
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    35
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    36
template <class T, MEMFLAGS F>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    37
inline GenericTaskQueueSet<T, F>::GenericTaskQueueSet(int n) : _n(n) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    38
  typedef T* GenericTaskQueuePtr;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    39
  _queues = NEW_C_HEAP_ARRAY(GenericTaskQueuePtr, n, F);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    40
  for (int i = 0; i < n; i++) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    41
    _queues[i] = NULL;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    42
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    43
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    44
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    45
template<class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    46
inline void GenericTaskQueue<E, F, N>::initialize() {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    47
  _elems = _array_allocator.allocate(N);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    48
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    49
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    50
template<class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    51
inline GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    52
  FREE_C_HEAP_ARRAY(E, _elems);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    53
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    54
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    55
template<class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    56
bool GenericTaskQueue<E, F, N>::push_slow(E t, uint dirty_n_elems) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    57
  if (dirty_n_elems == N - 1) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    58
    // Actually means 0, so do the push.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    59
    uint localBot = _bottom;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    60
    // g++ complains if the volatile result of the assignment is
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    61
    // unused, so we cast the volatile away.  We cannot cast directly
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    62
    // to void, because gcc treats that as not using the result of the
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    63
    // assignment.  However, casting to E& means that we trigger an
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    64
    // unused-value warning.  So, we cast the E& to void.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    65
    (void)const_cast<E&>(_elems[localBot] = t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    66
    OrderAccess::release_store(&_bottom, increment_index(localBot));
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    67
    TASKQUEUE_STATS_ONLY(stats.record_push());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    68
    return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    69
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    70
  return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    71
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    72
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    73
template<class E, MEMFLAGS F, unsigned int N> inline bool
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    74
GenericTaskQueue<E, F, N>::push(E t) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    75
  uint localBot = _bottom;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    76
  assert(localBot < N, "_bottom out of range.");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    77
  idx_t top = _age.top();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    78
  uint dirty_n_elems = dirty_size(localBot, top);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    79
  assert(dirty_n_elems < N, "n_elems out of range.");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    80
  if (dirty_n_elems < max_elems()) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    81
    // g++ complains if the volatile result of the assignment is
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    82
    // unused, so we cast the volatile away.  We cannot cast directly
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    83
    // to void, because gcc treats that as not using the result of the
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    84
    // assignment.  However, casting to E& means that we trigger an
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    85
    // unused-value warning.  So, we cast the E& to void.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    86
    (void) const_cast<E&>(_elems[localBot] = t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    87
    OrderAccess::release_store(&_bottom, increment_index(localBot));
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    88
    TASKQUEUE_STATS_ONLY(stats.record_push());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    89
    return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    90
  } else {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    91
    return push_slow(t, dirty_n_elems);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    92
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    93
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    94
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    95
template <class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    96
inline bool OverflowTaskQueue<E, F, N>::push(E t)
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    97
{
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    98
  if (!taskqueue_t::push(t)) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
    99
    overflow_stack()->push(t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   100
    TASKQUEUE_STATS_ONLY(stats.record_overflow(overflow_stack()->size()));
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   101
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   102
  return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   103
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   104
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   105
// pop_local_slow() is done by the owning thread and is trying to
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   106
// get the last task in the queue.  It will compete with pop_global()
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   107
// that will be used by other threads.  The tag age is incremented
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   108
// whenever the queue goes empty which it will do here if this thread
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   109
// gets the last task or in pop_global() if the queue wraps (top == 0
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   110
// and pop_global() succeeds, see pop_global()).
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   111
template<class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   112
bool GenericTaskQueue<E, F, N>::pop_local_slow(uint localBot, Age oldAge) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   113
  // This queue was observed to contain exactly one element; either this
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   114
  // thread will claim it, or a competing "pop_global".  In either case,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   115
  // the queue will be logically empty afterwards.  Create a new Age value
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   116
  // that represents the empty queue for the given value of "_bottom".  (We
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   117
  // must also increment "tag" because of the case where "bottom == 1",
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   118
  // "top == 0".  A pop_global could read the queue element in that case,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   119
  // then have the owner thread do a pop followed by another push.  Without
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   120
  // the incrementing of "tag", the pop_global's CAS could succeed,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   121
  // allowing it to believe it has claimed the stale element.)
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   122
  Age newAge((idx_t)localBot, oldAge.tag() + 1);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   123
  // Perhaps a competing pop_global has already incremented "top", in which
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   124
  // case it wins the element.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   125
  if (localBot == oldAge.top()) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   126
    // No competing pop_global has yet incremented "top"; we'll try to
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   127
    // install new_age, thus claiming the element.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   128
    Age tempAge = _age.cmpxchg(newAge, oldAge);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   129
    if (tempAge == oldAge) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   130
      // We win.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   131
      assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   132
      TASKQUEUE_STATS_ONLY(stats.record_pop_slow());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   133
      return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   134
    }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   135
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   136
  // We lose; a completing pop_global gets the element.  But the queue is empty
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   137
  // and top is greater than bottom.  Fix this representation of the empty queue
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   138
  // to become the canonical one.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   139
  _age.set(newAge);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   140
  assert(dirty_size(localBot, _age.top()) != N - 1, "sanity");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   141
  return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   142
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   143
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   144
template<class E, MEMFLAGS F, unsigned int N> inline bool
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   145
GenericTaskQueue<E, F, N>::pop_local(volatile E& t) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   146
  uint localBot = _bottom;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   147
  // This value cannot be N-1.  That can only occur as a result of
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   148
  // the assignment to bottom in this method.  If it does, this method
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   149
  // resets the size to 0 before the next call (which is sequential,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   150
  // since this is pop_local.)
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   151
  uint dirty_n_elems = dirty_size(localBot, _age.top());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   152
  assert(dirty_n_elems != N - 1, "Shouldn't be possible...");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   153
  if (dirty_n_elems == 0) return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   154
  localBot = decrement_index(localBot);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   155
  _bottom = localBot;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   156
  // This is necessary to prevent any read below from being reordered
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   157
  // before the store just above.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   158
  OrderAccess::fence();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   159
  // g++ complains if the volatile result of the assignment is
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   160
  // unused, so we cast the volatile away.  We cannot cast directly
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   161
  // to void, because gcc treats that as not using the result of the
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   162
  // assignment.  However, casting to E& means that we trigger an
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   163
  // unused-value warning.  So, we cast the E& to void.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   164
  (void) const_cast<E&>(t = _elems[localBot]);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   165
  // This is a second read of "age"; the "size()" above is the first.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   166
  // If there's still at least one element in the queue, based on the
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   167
  // "_bottom" and "age" we've read, then there can be no interference with
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   168
  // a "pop_global" operation, and we're done.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   169
  idx_t tp = _age.top();    // XXX
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   170
  if (size(localBot, tp) > 0) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   171
    assert(dirty_size(localBot, tp) != N - 1, "sanity");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   172
    TASKQUEUE_STATS_ONLY(stats.record_pop());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   173
    return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   174
  } else {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   175
    // Otherwise, the queue contained exactly one element; we take the slow
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   176
    // path.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   177
    return pop_local_slow(localBot, _age.get());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   178
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   179
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   180
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   181
template <class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   182
bool OverflowTaskQueue<E, F, N>::pop_overflow(E& t)
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   183
{
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   184
  if (overflow_empty()) return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   185
  t = overflow_stack()->pop();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   186
  return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   187
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   188
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   189
template<class E, MEMFLAGS F, unsigned int N>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   190
bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   191
  Age oldAge = _age.get();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   192
  // Architectures with weak memory model require a barrier here
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   193
  // to guarantee that bottom is not older than age,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   194
  // which is crucial for the correctness of the algorithm.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   195
#if !(defined SPARC || defined IA32 || defined AMD64)
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   196
  OrderAccess::fence();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   197
#endif
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   198
  uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   199
  uint n_elems = size(localBot, oldAge.top());
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   200
  if (n_elems == 0) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   201
    return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   202
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   203
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   204
  // g++ complains if the volatile result of the assignment is
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   205
  // unused, so we cast the volatile away.  We cannot cast directly
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   206
  // to void, because gcc treats that as not using the result of the
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   207
  // assignment.  However, casting to E& means that we trigger an
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   208
  // unused-value warning.  So, we cast the E& to void.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   209
  (void) const_cast<E&>(t = _elems[oldAge.top()]);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   210
  Age newAge(oldAge);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   211
  newAge.increment();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   212
  Age resAge = _age.cmpxchg(newAge, oldAge);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   213
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   214
  // Note that using "_bottom" here might fail, since a pop_local might
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   215
  // have decremented it.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   216
  assert(dirty_size(localBot, newAge.top()) != N - 1, "sanity");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   217
  return resAge == oldAge;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   218
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   219
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   220
template<class T, MEMFLAGS F> bool
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   221
GenericTaskQueueSet<T, F>::steal_best_of_2(uint queue_num, int* seed, E& t) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   222
  if (_n > 2) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   223
    uint k1 = queue_num;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   224
    while (k1 == queue_num) k1 = TaskQueueSetSuper::randomParkAndMiller(seed) % _n;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   225
    uint k2 = queue_num;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   226
    while (k2 == queue_num || k2 == k1) k2 = TaskQueueSetSuper::randomParkAndMiller(seed) % _n;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   227
    // Sample both and try the larger.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   228
    uint sz1 = _queues[k1]->size();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   229
    uint sz2 = _queues[k2]->size();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   230
    if (sz2 > sz1) return _queues[k2]->pop_global(t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   231
    else return _queues[k1]->pop_global(t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   232
  } else if (_n == 2) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   233
    // Just try the other one.
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   234
    uint k = (queue_num + 1) % 2;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   235
    return _queues[k]->pop_global(t);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   236
  } else {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   237
    assert(_n == 1, "can't be zero.");
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   238
    return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   239
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   240
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   241
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   242
template<class T, MEMFLAGS F> bool
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   243
GenericTaskQueueSet<T, F>::steal(uint queue_num, int* seed, E& t) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   244
  for (uint i = 0; i < 2 * _n; i++) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   245
    if (steal_best_of_2(queue_num, seed, t)) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   246
      TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(true));
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   247
      return true;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   248
    }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   249
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   250
  TASKQUEUE_STATS_ONLY(queue(queue_num)->stats.record_steal(false));
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   251
  return false;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   252
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   253
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   254
template <unsigned int N, MEMFLAGS F>
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   255
inline typename TaskQueueSuper<N, F>::Age TaskQueueSuper<N, F>::Age::cmpxchg(const Age new_age, const Age old_age) volatile {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   256
  return (size_t) Atomic::cmpxchg_ptr((intptr_t)new_age._data,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   257
                                      (volatile intptr_t *)&_data,
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   258
                                      (intptr_t)old_age._data);
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   259
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   260
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   261
template<class E, MEMFLAGS F, unsigned int N>
31994
3721b7aa3a0d 8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents: 30764
diff changeset
   262
template<class Fn>
3721b7aa3a0d 8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents: 30764
diff changeset
   263
inline void GenericTaskQueue<E, F, N>::iterate(Fn fn) {
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   264
  uint iters = size();
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   265
  uint index = _bottom;
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   266
  for (uint i = 0; i < iters; ++i) {
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   267
    index = decrement_index(index);
31994
3721b7aa3a0d 8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents: 30764
diff changeset
   268
    fn(const_cast<E&>(_elems[index])); // cast away volatility
30566
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   269
  }
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   270
}
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   271
18eb9aa972d0 8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
diff changeset
   272
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30566
diff changeset
   273
#endif // SHARE_VM_GC_SHARED_TASKQUEUE_INLINE_HPP