Mercurial > hg > truffle
annotate src/share/vm/shark/sharkMemoryManager.hpp @ 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 #ifndef SHARE_VM_SHARK_SHARKMEMORYMANAGER_HPP |
27 #define SHARE_VM_SHARK_SHARKMEMORYMANAGER_HPP | |
28 | |
29 #include "shark/llvmHeaders.hpp" | |
30 #include "shark/sharkEntry.hpp" | |
31 | |
1692 | 32 // SharkMemoryManager wraps the LLVM JIT Memory Manager. We could use |
33 // this to run our own memory allocation policies, but for now all we | |
34 // use it for is figuring out where the resulting native code ended up. | |
35 | |
36 class SharkMemoryManager : public llvm::JITMemoryManager { | |
37 public: | |
38 SharkMemoryManager() | |
39 : _mm(llvm::JITMemoryManager::CreateDefaultMemManager()) {} | |
40 | |
41 private: | |
42 llvm::JITMemoryManager* _mm; | |
43 | |
44 private: | |
45 llvm::JITMemoryManager* mm() const { | |
46 return _mm; | |
47 } | |
48 | |
49 private: | |
50 std::map<const llvm::Function*, SharkEntry*> _entry_map; | |
51 | |
52 public: | |
53 void set_entry_for_function(const llvm::Function* function, | |
54 SharkEntry* entry) { | |
55 _entry_map[function] = entry; | |
56 } | |
57 SharkEntry* get_entry_for_function(const llvm::Function* function) { | |
58 return _entry_map[function]; | |
59 } | |
60 | |
61 public: | |
62 void AllocateGOT(); | |
63 unsigned char* getGOTBase() const; | |
64 unsigned char* allocateStub(const llvm::GlobalValue* F, | |
65 unsigned StubSize, | |
66 unsigned Alignment); | |
67 unsigned char* startFunctionBody(const llvm::Function* F, | |
68 uintptr_t& ActualSize); | |
69 void endFunctionBody(const llvm::Function* F, | |
70 unsigned char* FunctionStart, | |
71 unsigned char* FunctionEnd); | |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
72 unsigned char* startExceptionTable(const llvm::Function* F, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
73 uintptr_t& ActualSize); |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
74 void endExceptionTable(const llvm::Function* F, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
75 unsigned char* TableStart, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
76 unsigned char* TableEnd, |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
77 unsigned char* FrameRegister); |
7195 | 78 void *getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure = true); |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
79 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); |
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
80 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); |
1692 | 81 void setPoisonMemory(bool); |
82 uint8_t* allocateGlobal(uintptr_t, unsigned int); | |
83 void setMemoryWritable(); | |
84 void setMemoryExecutable(); | |
14726
92aa6797d639
Backed out merge changeset: b51e29501f30
Doug Simon <doug.simon@oracle.com>
parents:
14669
diff
changeset
|
85 void deallocateExceptionTable(void *ptr); |
1692 | 86 void deallocateFunctionBody(void *ptr); |
87 unsigned char *allocateSpace(intptr_t Size, | |
88 unsigned int Alignment); | |
89 }; | |
1972 | 90 |
91 #endif // SHARE_VM_SHARK_SHARKMEMORYMANAGER_HPP |