Mercurial > hg > truffle
annotate src/share/vm/shark/sharkMemoryManager.cpp @ 14756:3e1e83287128
add assertion to detect infinite recursion in snippet inlining
author | Erik Eckstein <erik.eckstein@oracle.com> |
---|---|
date | Wed, 26 Mar 2014 10:08:31 +0100 |
parents | 92aa6797d639 |
children |
rev | line source |
---|---|
1692 | 1 /* |
1972 | 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
1692 | 3 * Copyright 2009 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 * | |
6 * This code is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License version 2 only, as | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
21 * or visit www.oracle.com if you need additional information or have any | |
22 * questions. | |
23 * | |
24 */ | |
25 | |
1972 | 26 #include "precompiled.hpp" |
27 #include "shark/llvmHeaders.hpp" | |
28 #include "shark/sharkEntry.hpp" | |
29 #include "shark/sharkMemoryManager.hpp" | |
1692 | 30 |
31 using namespace llvm; | |
32 | |
33 void SharkMemoryManager::AllocateGOT() { | |
34 mm()->AllocateGOT(); | |
35 } | |
36 | |
37 unsigned char* SharkMemoryManager::getGOTBase() const { | |
38 return mm()->getGOTBase(); | |
39 } | |
40 | |
41 unsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F, | |
42 unsigned StubSize, | |
43 unsigned Alignment) { | |
44 return mm()->allocateStub(F, StubSize, Alignment); | |
45 } | |
46 | |
47 unsigned char* SharkMemoryManager::startFunctionBody(const Function* F, | |
48 uintptr_t& ActualSize) { | |
49 return mm()->startFunctionBody(F, ActualSize); | |
50 } | |
51 | |
52 void SharkMemoryManager::endFunctionBody(const Function* F, | |
53 unsigned char* FunctionStart, | |
54 unsigned char* FunctionEnd) { | |
55 mm()->endFunctionBody(F, FunctionStart, FunctionEnd); | |
56 | |
57 SharkEntry *entry = get_entry_for_function(F); | |
58 if (entry != NULL) | |
59 entry->set_code_limit(FunctionEnd); | |
60 } | |
61 | |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
62 unsigned char* SharkMemoryManager::startExceptionTable(const Function* F, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
63 uintptr_t& ActualSize) { |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
64 return mm()->startExceptionTable(F, ActualSize); |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
65 } |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
66 |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
67 void SharkMemoryManager::endExceptionTable(const Function* F, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
68 unsigned char* TableStart, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
69 unsigned char* TableEnd, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
70 unsigned char* FrameRegister) { |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
71 mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister); |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
72 } |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
73 |
1692 | 74 void SharkMemoryManager::setMemoryWritable() { |
75 mm()->setMemoryWritable(); | |
76 } | |
77 | |
78 void SharkMemoryManager::setMemoryExecutable() { | |
79 mm()->setMemoryExecutable(); | |
80 } | |
81 | |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
82 void SharkMemoryManager::deallocateExceptionTable(void *ptr) { |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
83 mm()->deallocateExceptionTable(ptr); |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
84 } |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
85 |
1692 | 86 void SharkMemoryManager::deallocateFunctionBody(void *ptr) { |
87 mm()->deallocateFunctionBody(ptr); | |
88 } | |
89 | |
90 uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size, | |
91 unsigned int Alignment) { | |
92 return mm()->allocateGlobal(Size, Alignment); | |
93 } | |
94 | |
7195 | 95 void* SharkMemoryManager::getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) { |
96 return mm()->getPointerToNamedFunction(Name, AbortOnFailure); | |
1692 | 97 } |
98 | |
7195 | 99 uint8_t* SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { |
100 return mm()->allocateCodeSection(Size, Alignment, SectionID); | |
1692 | 101 } |
7195 | 102 |
103 uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { | |
104 return mm()->allocateDataSection(Size, Alignment, SectionID); | |
105 } | |
1692 | 106 |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
107 void SharkMemoryManager::setPoisonMemory(bool poison) { |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
108 mm()->setPoisonMemory(poison); |
1692 | 109 } |
110 | |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
111 unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
112 unsigned int Alignment) { |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
113 return mm()->allocateSpace(Size, Alignment); |
1692 | 114 } |