Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/shark/sharkMemoryManager.cpp
32285 views
/*1* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.2* Copyright 2009 Red Hat, Inc.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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "shark/llvmHeaders.hpp"27#include "shark/sharkEntry.hpp"28#include "shark/sharkMemoryManager.hpp"2930using namespace llvm;3132void SharkMemoryManager::AllocateGOT() {33mm()->AllocateGOT();34}3536unsigned char* SharkMemoryManager::getGOTBase() const {37return mm()->getGOTBase();38}3940unsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F,41unsigned StubSize,42unsigned Alignment) {43return mm()->allocateStub(F, StubSize, Alignment);44}4546unsigned char* SharkMemoryManager::startFunctionBody(const Function* F,47uintptr_t& ActualSize) {48return mm()->startFunctionBody(F, ActualSize);49}5051void SharkMemoryManager::endFunctionBody(const Function* F,52unsigned char* FunctionStart,53unsigned char* FunctionEnd) {54mm()->endFunctionBody(F, FunctionStart, FunctionEnd);5556SharkEntry *entry = get_entry_for_function(F);57if (entry != NULL)58entry->set_code_limit(FunctionEnd);59}6061void SharkMemoryManager::setMemoryWritable() {62mm()->setMemoryWritable();63}6465void SharkMemoryManager::setMemoryExecutable() {66mm()->setMemoryExecutable();67}6869void SharkMemoryManager::deallocateFunctionBody(void *ptr) {70mm()->deallocateFunctionBody(ptr);71}7273uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size,74unsigned int Alignment) {75return mm()->allocateGlobal(Size, Alignment);76}7778void* SharkMemoryManager::getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) {79return mm()->getPointerToNamedFunction(Name, AbortOnFailure);80}8182void SharkMemoryManager::setPoisonMemory(bool poison) {83mm()->setPoisonMemory(poison);84}8586unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size,87unsigned int Alignment) {88return mm()->allocateSpace(Size, Alignment);89}9091#if SHARK_LLVM_VERSION <= 329293uint8_t* SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {94return mm()->allocateCodeSection(Size, Alignment, SectionID);95}9697uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {98return mm()->allocateDataSection(Size, Alignment, SectionID);99}100101void SharkMemoryManager::deallocateExceptionTable(void *ptr) {102mm()->deallocateExceptionTable(ptr);103}104105unsigned char* SharkMemoryManager::startExceptionTable(const Function* F,106uintptr_t& ActualSize) {107return mm()->startExceptionTable(F, ActualSize);108}109110void SharkMemoryManager::endExceptionTable(const Function* F,111unsigned char* TableStart,112unsigned char* TableEnd,113unsigned char* FrameRegister) {114mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister);115}116117#else118119uint8_t *SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) {120return mm()->allocateCodeSection(Size, Alignment, SectionID, SectionName);121}122123uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) {124return mm()->allocateDataSection(Size, Alignment, SectionID, SectionName, IsReadOnly);125}126127bool SharkMemoryManager::finalizeMemory(std::string *ErrMsg) {128return mm()->finalizeMemory(ErrMsg);129}130131#endif132133134