1612N/A/*
1879N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
1612N/A * Copyright 2009 Red Hat, Inc.
1612N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1612N/A *
1612N/A * This code is free software; you can redistribute it and/or modify it
1612N/A * under the terms of the GNU General Public License version 2 only, as
1612N/A * published by the Free Software Foundation.
1612N/A *
1612N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1612N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1612N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1612N/A * version 2 for more details (a copy is included in the LICENSE file that
1612N/A * accompanied this code).
1612N/A *
1612N/A * You should have received a copy of the GNU General Public License version
1612N/A * 2 along with this work; if not, write to the Free Software Foundation,
1612N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1612N/A *
1612N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1612N/A * or visit www.oracle.com if you need additional information or have any
1612N/A * questions.
1612N/A *
1612N/A */
1612N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "shark/llvmHeaders.hpp"
1879N/A#include "shark/sharkEntry.hpp"
1879N/A#include "shark/sharkMemoryManager.hpp"
1612N/A
1612N/Ausing namespace llvm;
1612N/A
1612N/Avoid SharkMemoryManager::AllocateGOT() {
1612N/A mm()->AllocateGOT();
1612N/A}
1612N/A
1612N/Aunsigned char* SharkMemoryManager::getGOTBase() const {
1612N/A return mm()->getGOTBase();
1612N/A}
1612N/A
1612N/Aunsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F,
1612N/A unsigned StubSize,
1612N/A unsigned Alignment) {
1612N/A return mm()->allocateStub(F, StubSize, Alignment);
1612N/A}
1612N/A
1612N/Aunsigned char* SharkMemoryManager::startFunctionBody(const Function* F,
1612N/A uintptr_t& ActualSize) {
1612N/A return mm()->startFunctionBody(F, ActualSize);
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::endFunctionBody(const Function* F,
1612N/A unsigned char* FunctionStart,
1612N/A unsigned char* FunctionEnd) {
1612N/A mm()->endFunctionBody(F, FunctionStart, FunctionEnd);
1612N/A
1612N/A SharkEntry *entry = get_entry_for_function(F);
1612N/A if (entry != NULL)
1612N/A entry->set_code_limit(FunctionEnd);
1612N/A}
1612N/A
1612N/Aunsigned char* SharkMemoryManager::startExceptionTable(const Function* F,
1612N/A uintptr_t& ActualSize) {
1612N/A return mm()->startExceptionTable(F, ActualSize);
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::endExceptionTable(const Function* F,
1612N/A unsigned char* TableStart,
1612N/A unsigned char* TableEnd,
1612N/A unsigned char* FrameRegister) {
1612N/A mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::setMemoryWritable() {
1612N/A mm()->setMemoryWritable();
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::setMemoryExecutable() {
1612N/A mm()->setMemoryExecutable();
1612N/A}
1612N/A
1612N/A#if SHARK_LLVM_VERSION >= 27
1612N/Avoid SharkMemoryManager::deallocateExceptionTable(void *ptr) {
1612N/A mm()->deallocateExceptionTable(ptr);
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::deallocateFunctionBody(void *ptr) {
1612N/A mm()->deallocateFunctionBody(ptr);
1612N/A}
1612N/A#else
1612N/Avoid SharkMemoryManager::deallocateMemForFunction(const Function* F) {
1612N/A return mm()->deallocateMemForFunction(F);
1612N/A}
1612N/A#endif
1612N/A
1612N/Auint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size,
1612N/A unsigned int Alignment) {
1612N/A return mm()->allocateGlobal(Size, Alignment);
1612N/A}
1612N/A
1612N/A#if SHARK_LLVM_VERSION < 27
1612N/Avoid* SharkMemoryManager::getDlsymTable() const {
1612N/A return mm()->getDlsymTable();
1612N/A}
1612N/A
1612N/Avoid SharkMemoryManager::SetDlsymTable(void *ptr) {
1612N/A mm()->SetDlsymTable(ptr);
1612N/A}
1612N/A#endif
1612N/A
1612N/Avoid SharkMemoryManager::setPoisonMemory(bool poison) {
1612N/A mm()->setPoisonMemory(poison);
1612N/A}
1612N/A
1612N/Aunsigned char *SharkMemoryManager::allocateSpace(intptr_t Size,
1612N/A unsigned int Alignment) {
1612N/A return mm()->allocateSpace(Size, Alignment);
1612N/A}