src/hotspot/share/gc/shared/preservedMarks.cpp
author stefank
Thu, 22 Feb 2018 18:36:07 +0100
changeset 49047 8f004146e407
parent 47885 5caa1d5f74c1
child 49722 a47d1e21b3f1
permissions -rw-r--r--
8198515: Extract SoftReferencePolicy code out of CollectorPolicy Reviewed-by: pliden, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     1
/*
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     4
 *
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     8
 *
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    13
 * accompanied this code).
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    14
 *
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    18
 *
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    21
 * questions.
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    22
 *
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    23
 */
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    24
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    25
#include "precompiled.hpp"
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    26
#include "gc/shared/preservedMarks.inline.hpp"
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    27
#include "gc/shared/workgroup.hpp"
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    28
#include "memory/allocation.inline.hpp"
38080
bb02a3ad3b0a 8154153: PS: Restore preserved marks in parallel
tonyp
parents: 37422
diff changeset
    29
#include "memory/resourceArea.hpp"
38187
f1879f6d7e63 8155946: Minimal VM fails to built after 8154153: PS: Restore preserved marks in parallel
lmesnik
parents: 38080
diff changeset
    30
#include "utilities/macros.hpp"
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    31
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    32
void PreservedMarks::restore() {
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    33
  while (!_stack.is_empty()) {
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    34
    const OopAndMarkOop elem = _stack.pop();
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    35
    elem.set_mark();
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    36
  }
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    37
  assert_empty();
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    38
}
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    39
47885
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    40
void PreservedMarks::adjust_during_full_gc() {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    41
  StackIterator<OopAndMarkOop, mtGC> iter(_stack);
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    42
  while (!iter.is_empty()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    43
    OopAndMarkOop* elem = iter.next_addr();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    44
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    45
    oop obj = elem->get_oop();
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    46
    if (obj->is_forwarded()) {
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    47
      elem->set_oop(obj->forwardee());
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    48
    }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    49
  }
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    50
}
5caa1d5f74c1 8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents: 47216
diff changeset
    51
39228
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    52
void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    53
  const size_t stack_size = size();
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    54
  restore();
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    55
  // Only do the atomic add if the size is > 0.
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    56
  if (stack_size > 0) {
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    57
    Atomic::add(stack_size, total_size_addr);
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    58
  }
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    59
}
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
    60
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    61
#ifndef PRODUCT
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    62
void PreservedMarks::assert_empty() {
39625
8702e5b9bfed 8160356: invalid suffix on literal warning is occurred with GCC 6
kbarrett
parents: 39230
diff changeset
    63
  assert(_stack.is_empty(), "stack expected to be empty, size = " SIZE_FORMAT,
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    64
         _stack.size());
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    65
  assert(_stack.cache_size() == 0,
39625
8702e5b9bfed 8160356: invalid suffix on literal warning is occurred with GCC 6
kbarrett
parents: 39230
diff changeset
    66
         "stack expected to have no cached segments, cache size = " SIZE_FORMAT,
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    67
         _stack.cache_size());
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    68
}
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    69
#endif // ndef PRODUCT
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    70
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    71
void RemoveForwardedPointerClosure::do_object(oop obj) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    72
  if (obj->is_forwarded()) {
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    73
    PreservedMarks::init_forwarded_mark(obj);
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    74
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    75
}
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    76
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    77
void PreservedMarksSet::init(uint num) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    78
  assert(_stacks == NULL && _num == 0, "do not re-initialize");
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    79
  assert(num > 0, "pre-condition");
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    80
  if (_in_c_heap) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    81
    _stacks = NEW_C_HEAP_ARRAY(Padded<PreservedMarks>, num, mtGC);
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    82
  } else {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    83
    _stacks = NEW_RESOURCE_ARRAY(Padded<PreservedMarks>, num);
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    84
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    85
  for (uint i = 0; i < num; i += 1) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    86
    ::new (_stacks + i) PreservedMarks();
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    87
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    88
  _num = num;
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    89
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    90
  assert_empty();
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    91
}
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
    92
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    93
class ParRestoreTask : public AbstractGangTask {
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    94
private:
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    95
  PreservedMarksSet* const _preserved_marks_set;
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    96
  SequentialSubTasksDone _sub_tasks;
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    97
  volatile size_t* const _total_size_addr;
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    98
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
    99
public:
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   100
  virtual void work(uint worker_id) {
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   101
    uint task_id = 0;
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   102
    while (!_sub_tasks.is_task_claimed(/* reference */ task_id)) {
39228
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   103
      _preserved_marks_set->get(task_id)->restore_and_increment(_total_size_addr);
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   104
    }
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   105
    _sub_tasks.all_tasks_completed();
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   106
  }
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   107
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   108
  ParRestoreTask(uint worker_num,
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   109
                 PreservedMarksSet* preserved_marks_set,
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   110
                 volatile size_t* total_size_addr)
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   111
      : AbstractGangTask("Parallel Preserved Mark Restoration"),
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   112
        _preserved_marks_set(preserved_marks_set),
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   113
        _total_size_addr(total_size_addr) {
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   114
    _sub_tasks.set_n_threads(worker_num);
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   115
    _sub_tasks.set_n_tasks(preserved_marks_set->num());
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   116
  }
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   117
};
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   118
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   119
void PreservedMarksSet::reclaim() {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   120
  assert_empty();
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   121
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   122
  for (uint i = 0; i < _num; i += 1) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   123
    _stacks[i].~Padded<PreservedMarks>();
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   124
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   125
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   126
  if (_in_c_heap) {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   127
    FREE_C_HEAP_ARRAY(Padded<PreservedMarks>, _stacks);
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   128
  } else {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   129
    // the array was resource-allocated, so nothing to do
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   130
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   131
  _stacks = NULL;
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   132
  _num = 0;
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   133
}
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   134
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   135
#ifndef PRODUCT
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   136
void PreservedMarksSet::assert_empty() {
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   137
  assert(_stacks != NULL && _num > 0, "should have been initialized");
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   138
  for (uint i = 0; i < _num; i += 1) {
37422
8a7443b5edf8 8152312: ParNew: Restore preserved marks in parallel
tonyp
parents: 37045
diff changeset
   139
    get(i)->assert_empty();
36202
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   140
  }
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   141
}
219f8808c3bd 8146989: Introduce per-worker preserved mark stacks in ParNew
tonyp
parents:
diff changeset
   142
#endif // ndef PRODUCT
39228
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   143
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   144
void SharedRestorePreservedMarksTaskExecutor::restore(PreservedMarksSet* preserved_marks_set,
39230
b991240ffb0d 8159237: PreservedMarks verification code fails
stefank
parents: 39228
diff changeset
   145
                                                      volatile size_t* total_size_addr) {
39228
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   146
  if (_workers == NULL) {
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   147
    for (uint i = 0; i < preserved_marks_set->num(); i += 1) {
39230
b991240ffb0d 8159237: PreservedMarks verification code fails
stefank
parents: 39228
diff changeset
   148
      *total_size_addr += preserved_marks_set->get(i)->size();
39228
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   149
      preserved_marks_set->get(i)->restore();
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   150
    }
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   151
  } else {
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   152
    ParRestoreTask task(_workers->active_workers(), preserved_marks_set, total_size_addr);
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   153
    _workers->run_task(&task);
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   154
  }
32ce84798166 8156032: Clean up parallel GC specific code from vm/gc/shared/preservedMarks.cpp
lmesnik
parents: 38187
diff changeset
   155
}