src/hotspot/share/gc/epsilon/epsilonHeap.hpp
author shade
Fri, 13 Apr 2018 10:31:49 +0200
branchepsilon-gc-branch
changeset 56422 b09629f4b243
parent 56354 4b9449c330fb
child 56492 e1871d34a188
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: 56277
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
#ifndef SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    25
#define SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    26
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    27
#include "gc/shared/collectedHeap.hpp"
56354
4b9449c330fb Fix non-PCH build
shade
parents: 56352
diff changeset
    28
#include "gc/shared/softRefPolicy.hpp"
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    29
#include "gc/shared/space.hpp"
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    30
#include "services/memoryManager.hpp"
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    31
#include "gc/epsilon/epsilonCollectorPolicy.hpp"
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    32
#include "gc/epsilon/epsilonMonitoringSupport.hpp"
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    33
#include "gc/epsilon/epsilonBarrierSet.hpp"
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    34
#include "gc/epsilon/epsilon_globals.hpp"
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    35
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
    36
class EpsilonHeap : public CollectedHeap {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    37
private:
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    38
  EpsilonCollectorPolicy* _policy;
56276
shade
parents: 55979
diff changeset
    39
  SoftRefPolicy _soft_ref_policy;
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    40
  EpsilonMonitoringSupport* _monitoring_support;
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    41
  MemoryPool* _pool;
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    42
  GCMemoryManager _memory_manager;
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    43
  ContiguousSpace* _space;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    44
  VirtualSpace _virtual_space;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    45
  size_t _max_tlab_size;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    46
  size_t _last_counter_update;
55979
669f8c047c9c Print heap counters occasionally
shade
parents: 55975
diff changeset
    47
  size_t _last_heap_print;
669f8c047c9c Print heap counters occasionally
shade
parents: 55975
diff changeset
    48
  size_t _step_counter_update;
669f8c047c9c Print heap counters occasionally
shade
parents: 55975
diff changeset
    49
  size_t _step_heap_print;
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    50
public:
55975
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    51
  EpsilonHeap(EpsilonCollectorPolicy* p) :
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    52
          _policy(p),
26d15be1c920 Fixup serviceability for Epsilon.
shade
parents: 55974
diff changeset
    53
          _memory_manager("Epsilon Heap", "") {};
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    54
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    55
  virtual Name kind() const {
56422
shade
parents: 56354
diff changeset
    56
    return CollectedHeap::Epsilon;
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
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    59
  virtual const char* name() const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    60
    return "Epsilon";
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    61
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    62
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    63
  virtual jint initialize();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    64
55974
shade
parents: 55939
diff changeset
    65
  virtual void post_initialize();
shade
parents: 55939
diff changeset
    66
shade
parents: 55939
diff changeset
    67
  virtual void initialize_serviceability();
shade
parents: 55939
diff changeset
    68
  virtual GrowableArray<GCMemoryManager*> memory_managers();
shade
parents: 55939
diff changeset
    69
  virtual GrowableArray<MemoryPool*> memory_pools();
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    70
55939
c5c3e1a5c3f0 Rename EpsilonCollectedHeap to EpsilonHeap.
shade
parents: 55767
diff changeset
    71
  static EpsilonHeap* heap();
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    72
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    73
  virtual size_t capacity()     const { return _virtual_space.committed_size(); }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    74
  virtual size_t used()         const { return _space->used(); }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    75
  virtual size_t max_capacity() const { return _virtual_space.reserved_size(); }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    76
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    77
  virtual bool is_maximal_no_gc() const {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    78
    // No GC is going to happen, unless we are at capacity.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    79
    // At which point we will fail anyway.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    80
    return used() == capacity();
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    81
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    82
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    83
  virtual bool is_in(const void* p) const { return _space->is_in(p); }
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    84
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    85
  virtual bool is_scavengable(oop obj) {
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    86
    // No GC is going to happen, therefore no objects ever move.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    87
    return false;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    88
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    89
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    90
  HeapWord* allocate_work(size_t size);
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    91
  virtual HeapWord* 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
    92
  virtual HeapWord* allocate_new_tlab(size_t size);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    93
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    94
  // TLAB allocations
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    95
  virtual bool supports_tlab_allocation()           const { return UseTLAB; }
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    96
  virtual size_t tlab_capacity(Thread* thr)         const { return capacity(); }
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    97
  virtual size_t tlab_used(Thread* thr)             const { return used(); }
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
    98
  virtual size_t max_tlab_size()                    const { return _max_tlab_size; }
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
    99
  virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
55767
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
  virtual void collect(GCCause::Cause cause);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   102
  virtual void do_full_collection(bool clear_all_soft_refs);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   103
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   104
  virtual AdaptiveSizePolicy* size_policy() {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   105
    // No such thing for Epsilon
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   106
    return NULL;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   107
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   108
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   109
  virtual CollectorPolicy* collector_policy() const {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   110
    return _policy;
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
56276
shade
parents: 55979
diff changeset
   113
  virtual SoftRefPolicy* soft_ref_policy() {
shade
parents: 55979
diff changeset
   114
    return &_soft_ref_policy;
shade
parents: 55979
diff changeset
   115
  }
shade
parents: 55979
diff changeset
   116
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   117
  virtual void object_iterate(ObjectClosure* cl) {
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   118
    safe_object_iterate(cl);
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   119
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   120
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   121
  virtual void safe_object_iterate(ObjectClosure* cl);
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   122
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   123
  virtual HeapWord* block_start(const void* addr) const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   124
    // No support for block parsing.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   125
    return NULL;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   126
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   127
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   128
  virtual size_t block_size(const HeapWord* addr) const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   129
    // No support for block parsing.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   130
    return 0;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   131
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   132
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   133
  virtual bool block_is_obj(const HeapWord* addr) const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   134
    // No support for block parsing.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   135
    return false;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   136
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   137
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   138
  virtual jlong millis_since_last_gc() {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   139
    // Report time since the VM start
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   140
    return os::elapsed_counter() / NANOSECS_PER_MILLISEC;
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   141
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   142
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   143
  virtual void print_gc_threads_on(outputStream* st) const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   144
    // No GC threads.
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   145
  }
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   146
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   147
  virtual void gc_threads_do(ThreadClosure* tc) const {
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   148
    // No GC threads.
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   149
  }
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   150
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   151
  virtual void print_on(outputStream* st) const;
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   152
  virtual void print_tracing_info() const;
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   153
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   154
  virtual void prepare_for_verify() {
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   155
    // No heap verification.
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   156
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   157
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   158
  virtual void verify(VerifyOption option) {
56352
ebb84e128ed3 Whitespace, formatting, dead code elimination
shade
parents: 56350
diff changeset
   159
    // No heap verification.
55767
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   160
  }
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   161
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   162
};
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   163
8e22715afabc Initial import of Epsilon sources from jdk10/sandbox
shade
parents:
diff changeset
   164
#endif // SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP