src/hotspot/share/gc/g1/g1BiasedArray.cpp
author tschatzl
Wed, 17 Jul 2019 16:33:19 +0200
changeset 55722 5ee183a90e65
parent 47216 71c04702a3d5
permissions -rw-r--r--
8227084: Add timing information for merge heap root preparation Reviewed-by: sangheki, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     1
/*
41732
25dcacf3d009 8165621: Convert TestG1BiasedArray_test to GTest
dfazunen
parents: 33105
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     4
 *
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     8
 *
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    14
 *
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    18
 *
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    21
 * questions.
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    22
 *
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    23
 */
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    24
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 24424
diff changeset
    26
#include "gc/g1/g1BiasedArray.hpp"
23458
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    27
#include "memory/padded.inline.hpp"
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    28
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    29
// Allocate a new array, generic version.
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    30
address G1BiasedMappedArrayBase::create_new_base_array(size_t length, size_t elem_size) {
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    31
  assert(length > 0, "just checking");
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    32
  assert(elem_size > 0, "just checking");
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    33
  return PaddedPrimitiveArray<u_char, mtGC>::create_unfreeable(length * elem_size);
947a3d680f3e 8036860: Pad and cache-align the BiasedMappedArray
tschatzl
parents: 20083
diff changeset
    34
}
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    35
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    36
#ifndef PRODUCT
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    37
void G1BiasedMappedArrayBase::verify_index(idx_t index) const {
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    38
  guarantee(_base != NULL, "Array not initialized");
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    39
  guarantee(index < length(), "Index out of bounds index: " SIZE_FORMAT " length: " SIZE_FORMAT, index, length());
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    40
}
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    41
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    42
void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const {
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    43
  guarantee(_biased_base != NULL, "Array not initialized");
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    44
  guarantee(biased_index >= bias() && biased_index < (bias() + length()),
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    45
            "Biased index out of bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT,
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    46
            biased_index, bias(), length());
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    47
}
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    48
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    49
void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const {
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    50
  guarantee(_biased_base != NULL, "Array not initialized");
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    51
  guarantee(biased_index >= bias() && biased_index <= (bias() + length()),
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    52
            "Biased index out of inclusive bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT,
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31592
diff changeset
    53
            biased_index, bias(), length());
20083
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    54
}
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    55
df032615dd00 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents:
diff changeset
    56
#endif