src/hotspot/share/gc/z/zPhysicalMemory.inline.hpp
changeset 50525 767cdb97f103
child 50979 270b11dadbaf
equal deleted inserted replaced
50524:04f4e983c2f7 50525:767cdb97f103
       
     1 /*
       
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 #ifndef SHARE_GC_Z_ZPHYSICALMEMORY_INLINE_HPP
       
    25 #define SHARE_GC_Z_ZPHYSICALMEMORY_INLINE_HPP
       
    26 
       
    27 #include "gc/z/zPhysicalMemory.hpp"
       
    28 #include "utilities/debug.hpp"
       
    29 
       
    30 inline ZPhysicalMemorySegment::ZPhysicalMemorySegment(uintptr_t start, size_t size) :
       
    31     _start(start),
       
    32     _end(start + size) {}
       
    33 
       
    34 inline uintptr_t ZPhysicalMemorySegment::start() const {
       
    35   return _start;
       
    36 }
       
    37 
       
    38 inline uintptr_t ZPhysicalMemorySegment::end() const {
       
    39   return _end;
       
    40 }
       
    41 
       
    42 inline size_t ZPhysicalMemorySegment::size() const {
       
    43   return end() - start();
       
    44 }
       
    45 
       
    46 inline void ZPhysicalMemorySegment::expand(size_t size) {
       
    47   _end += size;
       
    48 }
       
    49 
       
    50 inline ZPhysicalMemorySegment ZPhysicalMemorySegment::split(size_t split_size) {
       
    51   assert(split_size <= size(), "Invalid size");
       
    52   ZPhysicalMemorySegment segment(_start, split_size);
       
    53   _start += split_size;
       
    54   return segment;
       
    55 }
       
    56 
       
    57 inline bool ZPhysicalMemory::is_null() const {
       
    58   return _nsegments == 0;
       
    59 }
       
    60 
       
    61 inline size_t ZPhysicalMemory::nsegments() const {
       
    62   return _nsegments;
       
    63 }
       
    64 
       
    65 inline ZPhysicalMemorySegment ZPhysicalMemory::segment(size_t index) const {
       
    66   assert(index < _nsegments, "Invalid segment index");
       
    67   return _segments[index];
       
    68 }
       
    69 
       
    70 inline size_t ZPhysicalMemoryManager::max_capacity() const {
       
    71   return _max_capacity;
       
    72 }
       
    73 
       
    74 inline size_t ZPhysicalMemoryManager::capacity() const {
       
    75   return _capacity;
       
    76 }
       
    77 
       
    78 inline size_t ZPhysicalMemoryManager::used() const {
       
    79   return _used;
       
    80 }
       
    81 
       
    82 inline size_t ZPhysicalMemoryManager::available() const {
       
    83   return _max_capacity - _used;
       
    84 }
       
    85 
       
    86 #endif // SHARE_GC_Z_ZPHYSICALMEMORY_INLINE_HPP