0N/A/*
1879N/A * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP
1879N/A#define SHARE_VM_MEMORY_SPACE_INLINE_HPP
1879N/A
1879N/A#include "gc_interface/collectedHeap.hpp"
1879N/A#include "memory/space.hpp"
1879N/A#include "memory/universe.hpp"
1879N/A#include "runtime/safepoint.hpp"
1879N/A
342N/Ainline HeapWord* Space::block_start(const void* p) {
342N/A return block_start_const(p);
342N/A}
342N/A
0N/Ainline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
0N/A HeapWord* res = ContiguousSpace::allocate(size);
0N/A if (res != NULL) {
0N/A _offsets.alloc_block(res, size);
0N/A }
0N/A return res;
0N/A}
0N/A
0N/A// Because of the requirement of keeping "_offsets" up to date with the
0N/A// allocations, we sequentialize these with a lock. Therefore, best if
0N/A// this is used for larger LAB allocations only.
0N/Ainline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) {
0N/A MutexLocker x(&_par_alloc_lock);
0N/A // This ought to be just "allocate", because of the lock above, but that
0N/A // ContiguousSpace::allocate asserts that either the allocating thread
0N/A // holds the heap lock or it is the VM thread and we're at a safepoint.
0N/A // The best I (dld) could figure was to put a field in ContiguousSpace
0N/A // meaning "locking at safepoint taken care of", and set/reset that
0N/A // here. But this will do for now, especially in light of the comment
0N/A // above. Perhaps in the future some lock-free manner of keeping the
0N/A // coordination.
0N/A HeapWord* res = ContiguousSpace::par_allocate(size);
0N/A if (res != NULL) {
0N/A _offsets.alloc_block(res, size);
0N/A }
0N/A return res;
0N/A}
0N/A
342N/Ainline HeapWord*
342N/AOffsetTableContigSpace::block_start_const(const void* p) const {
0N/A return _offsets.block_start(p);
0N/A}
0N/A
1879N/A#endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP