src/hotspot/share/gc/epsilon/epsilonHeap.cpp
author shade
Fri, 13 Apr 2018 10:31:49 +0200
branchepsilon-gc-branch
changeset 56422 b09629f4b243
parent 56354 4b9449c330fb
child 56449 a628f1855f4c
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     1
/*
56350
56014b46de69 Update copyrights
shade
parents: 56276
diff changeset
     2
 * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     3
 *
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     6
 * published by the Free Software Foundation.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     7
 *
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    12
 * accompanied this code).
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    13
 *
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    17
 *
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    20
 * questions.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    21
 *
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    22
 */
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    23
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    24
#include "precompiled.hpp"
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
    25
#include "gc/epsilon/epsilonHeap.hpp"
55974
shade
parents: 55939
diff changeset
    26
#include "gc/epsilon/epsilonMemoryPool.hpp"
56354
4b9449c330fb Fix non-PCH build
shade
parents: 56353
diff changeset
    27
#include "memory/allocation.hpp"
4b9449c330fb Fix non-PCH build
shade
parents: 56353
diff changeset
    28
#include "memory/allocation.inline.hpp"
4b9449c330fb Fix non-PCH build
shade
parents: 56353
diff changeset
    29
#include "memory/resourceArea.hpp"
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    30
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
    31
jint EpsilonHeap::initialize() {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    32
  size_t init_byte_size = _policy->initial_heap_byte_size();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    33
  size_t max_byte_size = _policy->max_heap_byte_size();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    34
  size_t align = _policy->heap_alignment();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    35
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    36
  ReservedSpace heap_rs = Universe::reserve_heap(max_byte_size,  align);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    37
  _virtual_space.initialize(heap_rs, init_byte_size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    38
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    39
  MemRegion committed_region((HeapWord*)_virtual_space.low(), (HeapWord*)_virtual_space.high());
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    40
  MemRegion reserved_region((HeapWord*)_virtual_space.low_boundary(), (HeapWord*)_virtual_space.high_boundary());
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    41
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    42
  initialize_reserved_region(reserved_region.start(), reserved_region.end());
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    43
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    44
  _space = new ContiguousSpace();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    45
  _space->initialize(committed_region, true, true);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    46
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    47
  set_barrier_set(new EpsilonBarrierSet());
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    48
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    49
  _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    50
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    51
  _monitoring_support = new EpsilonMonitoringSupport(this);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    52
  _last_counter_update = 0;
55979
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
    53
  _last_heap_print = 0;
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
    54
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
    55
  _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
    56
  _step_heap_print = (EpsilonPrintHeapStep == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapStep);
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    57
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    58
  if (init_byte_size != max_byte_size) {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    59
    log_info(gc)("Initialized with " SIZE_FORMAT "M heap, resizeable to up to " SIZE_FORMAT "M heap with " SIZE_FORMAT "M steps",
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    60
                 init_byte_size / M, max_byte_size / M, EpsilonMinHeapExpand / M);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    61
  } else {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    62
    log_info(gc)("Initialized with " SIZE_FORMAT "M non-resizeable heap", init_byte_size / M);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    63
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    64
  if (UseTLAB) {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    65
    log_info(gc)("Using TLAB allocation; min: " SIZE_FORMAT "K, max: " SIZE_FORMAT "K",
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    66
                                ThreadLocalAllocBuffer::min_size()*HeapWordSize / K,
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    67
                                _max_tlab_size*HeapWordSize / K);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    68
  } else {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    69
    log_info(gc)("Not using TLAB allocation");
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    70
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    71
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    72
  return JNI_OK;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    73
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    74
55974
shade
parents: 55939
diff changeset
    75
void EpsilonHeap::post_initialize() {
shade
parents: 55939
diff changeset
    76
  CollectedHeap::post_initialize();
shade
parents: 55939
diff changeset
    77
}
shade
parents: 55939
diff changeset
    78
shade
parents: 55939
diff changeset
    79
void EpsilonHeap::initialize_serviceability() {
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    80
  _pool = new EpsilonMemoryPool(this);
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    81
  _memory_manager.add_pool(_pool);
55974
shade
parents: 55939
diff changeset
    82
}
shade
parents: 55939
diff changeset
    83
shade
parents: 55939
diff changeset
    84
GrowableArray<GCMemoryManager*> EpsilonHeap::memory_managers() {
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    85
  GrowableArray<GCMemoryManager*> memory_managers(1);
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    86
  memory_managers.append(&_memory_manager);
55974
shade
parents: 55939
diff changeset
    87
  return memory_managers;
shade
parents: 55939
diff changeset
    88
}
shade
parents: 55939
diff changeset
    89
shade
parents: 55939
diff changeset
    90
GrowableArray<MemoryPool*> EpsilonHeap::memory_pools() {
shade
parents: 55939
diff changeset
    91
  GrowableArray<MemoryPool*> memory_pools(3);
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    92
  memory_pools.append(_pool);
55974
shade
parents: 55939
diff changeset
    93
  return memory_pools;
shade
parents: 55939
diff changeset
    94
}
shade
parents: 55939
diff changeset
    95
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    96
size_t EpsilonHeap::unsafe_max_tlab_alloc(Thread* thr) const {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    97
  // This is the only way we can control TLAB sizes without having safepoints.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    98
  // Implement exponential expansion within [MinTLABSize; _max_tlab_size], based
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    99
  // on previously "used" TLAB size.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   100
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   101
  size_t size = MIN2(_max_tlab_size * HeapWordSize, MAX2(MinTLABSize, thr->tlab().used() * HeapWordSize * 2));
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   102
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   103
  if (log_is_enabled(Trace, gc)) {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   104
    ResourceMark rm;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   105
    log_trace(gc)(
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   106
            "Selecting TLAB size for \"%s\" (Desired: " SIZE_FORMAT "K, Used: " SIZE_FORMAT "K) -> " SIZE_FORMAT "K",
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   107
            Thread::current()->name(),
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   108
            thr->tlab().desired_size() * HeapWordSize / K,
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   109
            thr->tlab().used() * HeapWordSize / K,
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   110
            size / K);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   111
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   112
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   113
  return size;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   114
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   115
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   116
EpsilonHeap* EpsilonHeap::heap() {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   117
  CollectedHeap* heap = Universe::heap();
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   118
  assert(heap != NULL, "Uninitialized access to EpsilonHeap::heap()");
56422
shade
parents: 56354
diff changeset
   119
  assert(heap->kind() == CollectedHeap::Epsilon, "Not a EpsilonHeap");
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   120
  return (EpsilonHeap*)heap;
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   121
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   122
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   123
HeapWord* EpsilonHeap::allocate_work(size_t size) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   124
  HeapWord* res = _space->par_allocate(size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   125
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   126
  while (res == NULL) {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   127
    // Allocation failed, attempt expansion, and retry:
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   128
    MutexLockerEx ml(Heap_lock);
55980
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   129
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   130
    size_t space_left = max_capacity() - capacity();
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   131
    size_t want_space = MAX2(size, EpsilonMinHeapExpand);
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   132
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   133
    if (want_space < space_left) {
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   134
      // Enough space to expand in bulk:
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   135
      bool expand = _virtual_space.expand_by(want_space);
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   136
      assert(expand, "Should be able to expand");
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   137
    } else if (size < space_left) {
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   138
      // No space to expand in bulk, and this allocation is still possible,
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   139
      // take all the space left:
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   140
      bool expand = _virtual_space.expand_by(space_left);
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   141
      assert(expand, "Should be able to expand");
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   142
    } else {
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   143
      // No space left:
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   144
      return NULL;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   145
    }
55980
67d289ae67f5 Make sure Epsilon is able to use the last bit of expanded heap
shade
parents: 55979
diff changeset
   146
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   147
    _space->set_end((HeapWord *) _virtual_space.high());
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   148
    res = _space->par_allocate(size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   149
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   150
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   151
  size_t used = _space->used();
55979
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   152
  if (used - _last_counter_update >= _step_counter_update) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   153
    _last_counter_update = used;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   154
    _monitoring_support->update_counters();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   155
  }
55979
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   156
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   157
  if (used - _last_heap_print >= _step_heap_print) {
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   158
    log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M committed, " SIZE_FORMAT "M used",
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   159
                 max_capacity() / M, capacity() / M, used / M);
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   160
    _last_heap_print = used;
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   161
  }
669f8c047c9c Print heap counters occasionally
shade
parents: 55976
diff changeset
   162
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   163
  return res;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   164
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   165
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   166
HeapWord* EpsilonHeap::allocate_new_tlab(size_t size) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   167
  return allocate_work(size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   168
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   169
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   170
HeapWord* EpsilonHeap::mem_allocate(size_t size, bool *gc_overhead_limit_was_exceeded) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   171
  *gc_overhead_limit_was_exceeded = false;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   172
  return allocate_work(size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   173
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   174
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   175
void EpsilonHeap::collect(GCCause::Cause cause) {
56353
eb96d40953f1 Rehash messages printed by Epsilon
shade
parents: 56352
diff changeset
   176
  log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause));
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   177
  _monitoring_support->update_counters();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   178
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   179
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   180
void EpsilonHeap::do_full_collection(bool clear_all_soft_refs) {
56353
eb96d40953f1 Rehash messages printed by Epsilon
shade
parents: 56352
diff changeset
   181
  log_info(gc)("Full GC request for \"%s\" is ignored", GCCause::to_string(gc_cause()));
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   182
  _monitoring_support->update_counters();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   183
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   184
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   185
void EpsilonHeap::safe_object_iterate(ObjectClosure *cl) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   186
  _space->safe_object_iterate(cl);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   187
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   188
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   189
void EpsilonHeap::print_on(outputStream *st) const {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   190
  st->print_cr("Epsilon Heap");
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   191
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   192
  // Cast away constness:
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   193
  ((VirtualSpace)_virtual_space).print_on(st);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   194
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   195
  st->print_cr("Allocation space:");
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   196
  _space->print_on(st);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   197
}
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   198
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
   199
void EpsilonHeap::print_tracing_info() const {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   200
  Log(gc) log;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   201
  size_t allocated_kb = used() / K;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   202
  log.info("Total allocated: " SIZE_FORMAT " KB",
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   203
           allocated_kb);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   204
  log.info("Average allocation rate: " SIZE_FORMAT " KB/sec",
55976
be6a0c9587da Fix implicit conversion out of size_t.
shade
parents: 55975
diff changeset
   205
           (size_t)(allocated_kb * NANOSECS_PER_SEC / os::elapsed_counter()));
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   206
}