diff options
author | Richard Leitner <richard.leitner@skidata.com> | 2019-12-30 15:35:59 +0100 |
---|---|---|
committer | Richard Leitner <richard.leitner@skidata.com> | 2020-01-27 11:02:06 +0100 |
commit | cb6eedeb1f7fa877497e6ff2aa893e8089fe6541 (patch) | |
tree | ba4b6977735e331c5cb6a7585a185fba895f2dc7 /recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch | |
parent | 19b569281cc30e3aa94e772d6885cd340b1d1724 (diff) | |
download | meta-java-cb6eedeb1f7fa877497e6ff2aa893e8089fe6541.tar.gz |
openjdk-8: update to latest ga version 242
As OpenJDK-8 is now tagging "ga" versions in addition to the "build"
version the recipes are adapted to use those "ga" versions.
All existing patches got re-applied and renamed. For better handling Hotspot
patches now start at patch number 1001 and jdk patches at 2001.
Furthermore architecture dependent patches are prefixed with the
architecture they apply on.
Following patches/hunks were completely dropped:
- 0002-hotspot-fix-compilation-with-security-flags-enabled.patch
got backported to hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/c40a28e54185
- 0011-hotspot-backport-patch-to-fix-misuses-of-strncpy-str.patch
ostream.cpp:112 got fixed in hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/f3108e56b502
- 0014-hotspot-zero-fix-undefined-behaviour-gcc-v8-fix.patch
got backported to hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/ca4663e58916
- 0018-hotspot-Fix-debug-build-after-8062808-Turn-on-the-Wr.patch
fixed in hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/32bc598624bd
- 0020-Enable-HotSpot-builds-on-5.x-Linux-kernels.patch
fixed in hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/5af8ec63c21c
- openjdk8-add-missing-linker-flags.patch
fixed in hotspot jdk8u
https://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/f175513c2c3a
- openjdk8-fix-shark-stdc++11.patch
fixed in hotspot jdk8u
- openjdk8-fix-libpng-neon-build.patch
fixed in jdk
https://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/5d57817931e1
- aarch64-hotspot-fix-undefined-behaviour-gcc-v8-fix.patch
got backported to hotspot jdk8u
Following patches were newly added:
- 0011-autoconf-fix-CC-with-arguments-detection.patch
needed because of jdk8u commit "8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris"
- 0012-autoconf-NativeCompilation-remove-sysroot.patch
needed because of jdk8u commit "8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris"
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Diffstat (limited to 'recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch')
-rw-r--r-- | recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch | 448 |
1 files changed, 448 insertions, 0 deletions
diff --git a/recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch b/recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch new file mode 100644 index 0000000..8fe5489 --- /dev/null +++ b/recipes-core/openjdk/patches-openjdk-8/1011-hotspot-fix-shark-build-common.patch | |||
@@ -0,0 +1,448 @@ | |||
1 | From 1015cc718ba25cabf613b96fd58baa8dfb8492fe Mon Sep 17 00:00:00 2001 | ||
2 | From: Jens Rehsack <rehsack@gmail.com> | ||
3 | Date: Thu, 2 Jan 2020 10:22:19 +0100 | ||
4 | Subject: [PATCH 1011/1012] hotspot: fix shark build (common) | ||
5 | |||
6 | Signed-off-by: Richard Leitner <richard.leitner@skidata.com> | ||
7 | --- | ||
8 | make/Makefile | 2 +- | ||
9 | src/cpu/zero/vm/interpreter_zero.cpp | 2 +- | ||
10 | src/share/vm/ci/ciTypeFlow.cpp | 4 ++ | ||
11 | src/share/vm/classfile/systemDictionary.cpp | 4 ++ | ||
12 | src/share/vm/runtime/handles.inline.hpp | 8 +++- | ||
13 | src/share/vm/shark/llvmHeaders.hpp | 4 ++ | ||
14 | src/share/vm/shark/sharkCompiler.cpp | 39 ++++++++++++++++--- | ||
15 | src/share/vm/shark/sharkCompiler.hpp | 2 + | ||
16 | src/share/vm/shark/sharkContext.cpp | 9 ++++- | ||
17 | src/share/vm/shark/sharkContext.hpp | 43 ++++++++++++++++++++- | ||
18 | src/share/vm/shark/sharkEntry.hpp | 1 + | ||
19 | src/share/vm/shark/sharkIntrinsics.cpp | 4 ++ | ||
20 | src/share/vm/shark/sharkRuntime.cpp | 1 + | ||
21 | src/share/vm/shark/sharkTopLevelBlock.cpp | 12 ++++++ | ||
22 | 14 files changed, 123 insertions(+), 12 deletions(-) | ||
23 | |||
24 | diff --git a/hotspot/make/Makefile b/hotspot/make/Makefile | ||
25 | index 5765f1e36..f8ff9ecd9 100644 | ||
26 | --- a/hotspot/make/Makefile | ||
27 | +++ b/hotspot/make/Makefile | ||
28 | @@ -525,7 +525,7 @@ $(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD_DIR)/../generated/jvmtifiles/% | ||
29 | # Unix | ||
30 | $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) | ||
31 | $(install-file) | ||
32 | -$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_BUILD_DIR)/%.debuginfo | ||
33 | +$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(SHARK_BUILD_DIR)/%.debuginfo | ||
34 | $(install-file) | ||
35 | $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz | ||
36 | $(install-file) | ||
37 | diff --git a/hotspot/src/cpu/zero/vm/interpreter_zero.cpp b/hotspot/src/cpu/zero/vm/interpreter_zero.cpp | ||
38 | index 7172443db..5a4b4ad56 100644 | ||
39 | --- a/hotspot/src/cpu/zero/vm/interpreter_zero.cpp | ||
40 | +++ b/hotspot/src/cpu/zero/vm/interpreter_zero.cpp | ||
41 | @@ -49,7 +49,7 @@ | ||
42 | #ifdef COMPILER1 | ||
43 | #include "c1/c1_Runtime1.hpp" | ||
44 | #endif | ||
45 | -#ifdef CC_INTERP | ||
46 | +#if defined(CC_INTERP) || defined(SHARK) | ||
47 | #include "interpreter/cppInterpreter.hpp" | ||
48 | #endif | ||
49 | |||
50 | diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp | ||
51 | index 4707cc96e..a2b297ca0 100644 | ||
52 | --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp | ||
53 | +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp | ||
54 | @@ -35,8 +35,10 @@ | ||
55 | #include "interpreter/bytecode.hpp" | ||
56 | #include "interpreter/bytecodes.hpp" | ||
57 | #include "memory/allocation.inline.hpp" | ||
58 | +#ifdef COMPILER2 | ||
59 | #include "opto/compile.hpp" | ||
60 | #include "opto/node.hpp" | ||
61 | +#endif | ||
62 | #include "runtime/deoptimization.hpp" | ||
63 | #include "utilities/growableArray.hpp" | ||
64 | |||
65 | @@ -2648,6 +2650,7 @@ void ciTypeFlow::df_flow_types(Block* start, | ||
66 | assert (!blk->has_pre_order(), ""); | ||
67 | blk->set_next_pre_order(); | ||
68 | |||
69 | +#ifdef COMPILER2 | ||
70 | if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) { | ||
71 | // Too many basic blocks. Bail out. | ||
72 | // This can happen when try/finally constructs are nested to depth N, | ||
73 | @@ -2657,6 +2660,7 @@ void ciTypeFlow::df_flow_types(Block* start, | ||
74 | record_failure("too many basic blocks"); | ||
75 | return; | ||
76 | } | ||
77 | +#endif | ||
78 | if (do_flow) { | ||
79 | flow_block(blk, temp_vector, temp_set); | ||
80 | if (failing()) return; // Watch for bailouts. | ||
81 | diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp | ||
82 | index 5253afc22..ecb30cdef 100644 | ||
83 | --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp | ||
84 | +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp | ||
85 | @@ -2300,6 +2300,7 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid | ||
86 | spe = NULL; | ||
87 | // Must create lots of stuff here, but outside of the SystemDictionary lock. | ||
88 | m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty)); | ||
89 | +#ifndef SHARK | ||
90 | if (!Arguments::is_interpreter_only()) { | ||
91 | // Generate a compiled form of the MH intrinsic. | ||
92 | AdapterHandlerLibrary::create_native_wrapper(m); | ||
93 | @@ -2309,6 +2310,7 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid | ||
94 | "out of space in CodeCache for method handle intrinsic", empty); | ||
95 | } | ||
96 | } | ||
97 | +#endif | ||
98 | // Now grab the lock. We might have to throw away the new method, | ||
99 | // if a racing thread has managed to install one at the same time. | ||
100 | { | ||
101 | @@ -2322,9 +2324,11 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid | ||
102 | } | ||
103 | |||
104 | assert(spe != NULL && spe->method() != NULL, ""); | ||
105 | +#ifndef SHARK | ||
106 | assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() && | ||
107 | spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()), | ||
108 | "MH intrinsic invariant"); | ||
109 | +#endif | ||
110 | return spe->method(); | ||
111 | } | ||
112 | |||
113 | diff --git a/hotspot/src/share/vm/runtime/handles.inline.hpp b/hotspot/src/share/vm/runtime/handles.inline.hpp | ||
114 | index 761596a50..ca950c154 100644 | ||
115 | --- a/hotspot/src/share/vm/runtime/handles.inline.hpp | ||
116 | +++ b/hotspot/src/share/vm/runtime/handles.inline.hpp | ||
117 | @@ -51,6 +51,12 @@ inline Handle::Handle(Thread* thread, oop obj) { | ||
118 | } | ||
119 | #endif // ASSERT | ||
120 | |||
121 | +#ifdef SHARK | ||
122 | +#define assert_on_stack(expr) (void)(expr) | ||
123 | +#else | ||
124 | +#define assert_on_stack(expr) assert((expr), "not on stack?") | ||
125 | +#endif | ||
126 | + | ||
127 | // Constructors for metadata handles | ||
128 | #define DEF_METADATA_HANDLE_FN(name, type) \ | ||
129 | inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \ | ||
130 | @@ -79,7 +85,7 @@ inline name##Handle::name##Handle(const name##Handle &h) { \ | ||
131 | } else { \ | ||
132 | _thread = Thread::current(); \ | ||
133 | } \ | ||
134 | - assert (_thread->is_in_stack((address)this), "not on stack?"); \ | ||
135 | + assert_on_stack (_thread->is_in_stack((address)this)); \ | ||
136 | _thread->metadata_handles()->push((Metadata*)_value); \ | ||
137 | } else { \ | ||
138 | _thread = NULL; \ | ||
139 | diff --git a/hotspot/src/share/vm/shark/llvmHeaders.hpp b/hotspot/src/share/vm/shark/llvmHeaders.hpp | ||
140 | index 05ef7fea1..4d40ae3dd 100644 | ||
141 | --- a/hotspot/src/share/vm/shark/llvmHeaders.hpp | ||
142 | +++ b/hotspot/src/share/vm/shark/llvmHeaders.hpp | ||
143 | @@ -35,7 +35,11 @@ | ||
144 | #undef DEBUG | ||
145 | #endif | ||
146 | |||
147 | +#if SHARK_LLVM_VERSION <= 34 | ||
148 | #include <llvm/Analysis/Verifier.h> | ||
149 | +#else | ||
150 | +#include <llvm-c/Analysis.h> | ||
151 | +#endif | ||
152 | #include <llvm/ExecutionEngine/ExecutionEngine.h> | ||
153 | |||
154 | // includes specific to each version | ||
155 | diff --git a/hotspot/src/share/vm/shark/sharkCompiler.cpp b/hotspot/src/share/vm/shark/sharkCompiler.cpp | ||
156 | index 86c09932a..462eb98a7 100644 | ||
157 | --- a/hotspot/src/share/vm/shark/sharkCompiler.cpp | ||
158 | +++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp | ||
159 | @@ -61,11 +61,25 @@ SharkCompiler::SharkCompiler() | ||
160 | : AbstractCompiler() { | ||
161 | // Create the lock to protect the memory manager and execution engine | ||
162 | _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock"); | ||
163 | - MutexLocker locker(execution_engine_lock()); | ||
164 | + { | ||
165 | + MutexLocker locker(execution_engine_lock()); | ||
166 | + init_llvm(); | ||
167 | + } | ||
168 | + // All done | ||
169 | + set_state(initialized); | ||
170 | +} | ||
171 | |||
172 | +void SharkCompiler::init_llvm() { | ||
173 | + // with llvm 3.5, Multi-threading can only be enabled/disabled with the | ||
174 | + // compile time define LLVM_ENABLE_THREADS | ||
175 | +#if SHARK_LLVM_VERSION <= 34 | ||
176 | // Make LLVM safe for multithreading | ||
177 | if (!llvm_start_multithreaded()) | ||
178 | fatal("llvm_start_multithreaded() failed"); | ||
179 | +#else | ||
180 | + if (!llvm_is_multithreaded()) | ||
181 | + fatal("llvm_is_multithreaded() tells no multithreading support in llvm"); | ||
182 | +#endif | ||
183 | |||
184 | // Initialize the native target | ||
185 | InitializeNativeTarget(); | ||
186 | @@ -83,7 +97,7 @@ SharkCompiler::SharkCompiler() | ||
187 | // Finetune LLVM for the current host CPU. | ||
188 | StringMap<bool> Features; | ||
189 | bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features); | ||
190 | - std::string cpu("-mcpu=" + llvm::sys::getHostCPUName()); | ||
191 | + std::string cpu("-mcpu=" + std::string(llvm::sys::getHostCPUName())); | ||
192 | |||
193 | std::vector<const char*> args; | ||
194 | args.push_back(""); // program name | ||
195 | @@ -112,6 +126,9 @@ SharkCompiler::SharkCompiler() | ||
196 | builder.setMAttrs(MAttrs); | ||
197 | builder.setJITMemoryManager(memory_manager()); | ||
198 | builder.setEngineKind(EngineKind::JIT); | ||
199 | +#if SHARK_LLVM_VERSION > 34 | ||
200 | + builder.setUseMCJIT(true); | ||
201 | +#endif | ||
202 | builder.setErrorStr(&ErrorMsg); | ||
203 | if (! fnmatch(SharkOptimizationLevel, "None", 0)) { | ||
204 | tty->print_cr("Shark optimization level set to: None"); | ||
205 | @@ -133,10 +150,11 @@ SharkCompiler::SharkCompiler() | ||
206 | exit(1); | ||
207 | } | ||
208 | |||
209 | +#if SHARK_LLVM_VERSION > 34 | ||
210 | + _native_context->execution_engine(_execution_engine); | ||
211 | + _normal_context->execution_engine(_execution_engine); | ||
212 | +#endif | ||
213 | execution_engine()->addModule(_native_context->module()); | ||
214 | - | ||
215 | - // All done | ||
216 | - set_state(initialized); | ||
217 | } | ||
218 | |||
219 | void SharkCompiler::initialize() { | ||
220 | @@ -165,7 +183,7 @@ void SharkCompiler::compile_method(ciEnv* env, | ||
221 | } | ||
222 | |||
223 | // Create the recorders | ||
224 | - Arena arena; | ||
225 | + Arena arena(mtCompiler); | ||
226 | env->set_oop_recorder(new OopRecorder(&arena)); | ||
227 | OopMapSet oopmaps; | ||
228 | env->set_debug_info(new DebugInformationRecorder(env->oop_recorder())); | ||
229 | @@ -268,7 +286,12 @@ void SharkCompiler::generate_native_code(SharkEntry* entry, | ||
230 | |||
231 | if (SharkVerifyFunction != NULL) { | ||
232 | if (!fnmatch(SharkVerifyFunction, name, 0)) { | ||
233 | +#if SHARK_LLVM_VERSION <= 34 | ||
234 | verifyFunction(*function); | ||
235 | +#else | ||
236 | + LLVMValueRef F = wrap(function); | ||
237 | + LLVMVerifyFunction(F, LLVMAbortProcessAction); | ||
238 | +#endif | ||
239 | } | ||
240 | } | ||
241 | |||
242 | @@ -298,7 +321,11 @@ void SharkCompiler::generate_native_code(SharkEntry* entry, | ||
243 | #endif | ||
244 | #endif // !NDEBUG | ||
245 | memory_manager()->set_entry_for_function(function, entry); | ||
246 | +#if SHARK_LLVM_VERSION <= 34 | ||
247 | code = (address) execution_engine()->getPointerToFunction(function); | ||
248 | +#else | ||
249 | + code = (address) execution_engine()->getFunctionAddress(name); | ||
250 | +#endif | ||
251 | } | ||
252 | assert(code != NULL, "code must be != NULL"); | ||
253 | entry->set_entry_point(code); | ||
254 | diff --git a/hotspot/src/share/vm/shark/sharkCompiler.hpp b/hotspot/src/share/vm/shark/sharkCompiler.hpp | ||
255 | index 974002988..36b5b2427 100644 | ||
256 | --- a/hotspot/src/share/vm/shark/sharkCompiler.hpp | ||
257 | +++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp | ||
258 | @@ -40,6 +40,8 @@ class SharkCompiler : public AbstractCompiler { | ||
259 | // Creation | ||
260 | SharkCompiler(); | ||
261 | |||
262 | + void init_llvm(); | ||
263 | + | ||
264 | // Name of this compiler | ||
265 | const char *name() { return "shark"; } | ||
266 | |||
267 | diff --git a/hotspot/src/share/vm/shark/sharkContext.cpp b/hotspot/src/share/vm/shark/sharkContext.cpp | ||
268 | index 0fc86f0b1..e16318ccf 100644 | ||
269 | --- a/hotspot/src/share/vm/shark/sharkContext.cpp | ||
270 | +++ b/hotspot/src/share/vm/shark/sharkContext.cpp | ||
271 | @@ -34,8 +34,13 @@ | ||
272 | using namespace llvm; | ||
273 | |||
274 | SharkContext::SharkContext(const char* name) | ||
275 | - : LLVMContext(), | ||
276 | - _free_queue(NULL) { | ||
277 | + : LLVMContext() | ||
278 | + , _free_queue(0) | ||
279 | +#if SHARK_LLVM_VERSION > 34 | ||
280 | + , _ee(0) | ||
281 | + , func_mod_map() | ||
282 | +#endif | ||
283 | +{ | ||
284 | // Create a module to build our functions into | ||
285 | _module = new Module(name, *this); | ||
286 | |||
287 | diff --git a/hotspot/src/share/vm/shark/sharkContext.hpp b/hotspot/src/share/vm/shark/sharkContext.hpp | ||
288 | index 952cf13b7..85b48e99a 100644 | ||
289 | --- a/hotspot/src/share/vm/shark/sharkContext.hpp | ||
290 | +++ b/hotspot/src/share/vm/shark/sharkContext.hpp | ||
291 | @@ -29,6 +29,8 @@ | ||
292 | #include "shark/llvmHeaders.hpp" | ||
293 | #include "shark/sharkCompiler.hpp" | ||
294 | |||
295 | +#include <map> | ||
296 | + | ||
297 | // The LLVMContext class allows multiple instances of LLVM to operate | ||
298 | // independently of each other in a multithreaded context. We extend | ||
299 | // this here to store things in Shark that are LLVMContext-specific. | ||
300 | @@ -41,12 +43,28 @@ class SharkContext : public llvm::LLVMContext { | ||
301 | |||
302 | private: | ||
303 | llvm::Module* _module; | ||
304 | +#if SHARK_LLVM_VERSION > 34 | ||
305 | + llvm::ExecutionEngine *_ee; | ||
306 | + std::map<std::string, llvm::Module *> func_mod_map; | ||
307 | +#endif | ||
308 | |||
309 | public: | ||
310 | llvm::Module* module() const { | ||
311 | return _module; | ||
312 | } | ||
313 | |||
314 | +#if SHARK_LLVM_VERSION > 34 | ||
315 | + llvm::ExecutionEngine *execution_engine(llvm::ExecutionEngine *ee) { | ||
316 | + llvm::ExecutionEngine *oee = _ee; | ||
317 | + _ee = ee; | ||
318 | + return oee; | ||
319 | + } | ||
320 | + | ||
321 | + llvm::ExecutionEngine *execution_engine() const { | ||
322 | + return _ee; | ||
323 | + } | ||
324 | +#endif | ||
325 | + | ||
326 | // Get this thread's SharkContext | ||
327 | public: | ||
328 | static SharkContext& current() { | ||
329 | @@ -55,12 +73,35 @@ class SharkContext : public llvm::LLVMContext { | ||
330 | |||
331 | // Module accessors | ||
332 | public: | ||
333 | - void add_function(llvm::Function* function) const { | ||
334 | + void add_function(llvm::Function* function) { | ||
335 | +#if SHARK_LLVM_VERSION <= 34 | ||
336 | module()->getFunctionList().push_back(function); | ||
337 | +#else | ||
338 | + // shark compiles modules, not functions | ||
339 | + std::map<std::string, llvm::Module *>::iterator i = func_mod_map.find(function->getName().str()); | ||
340 | + if(func_mod_map.end() == i) { | ||
341 | + llvm::Module *mod4fun = new llvm::Module(function->getName(), *this); | ||
342 | + func_mod_map.insert(std::pair<std::string, llvm::Module *>(function->getName().str(), mod4fun)); | ||
343 | + mod4fun->getFunctionList().push_back(function); | ||
344 | + _ee->addModule(mod4fun); | ||
345 | + } | ||
346 | +#endif | ||
347 | } | ||
348 | llvm::Constant* get_external(const char* name, | ||
349 | llvm::FunctionType* sig) { | ||
350 | + // XXX see whether we need additional module map, too | ||
351 | +#if SHARK_LLVM_VERSION <= 34 | ||
352 | return module()->getOrInsertFunction(name, sig); | ||
353 | +#else | ||
354 | + // shark compiles modules, not functions | ||
355 | + std::map<std::string, llvm::Module *>::iterator i = func_mod_map.find(name); | ||
356 | + if(func_mod_map.end() == i) { | ||
357 | + llvm::Module *mod4fun = new llvm::Module(name, *this); | ||
358 | + func_mod_map.insert(std::pair<std::string, llvm::Module *>(name, mod4fun)); | ||
359 | + mod4fun->getOrInsertFunction(name, sig); | ||
360 | + _ee->addModule(mod4fun); | ||
361 | + } | ||
362 | +#endif | ||
363 | } | ||
364 | |||
365 | // Basic types | ||
366 | diff --git a/hotspot/src/share/vm/shark/sharkEntry.hpp b/hotspot/src/share/vm/shark/sharkEntry.hpp | ||
367 | index e0f535c69..c079e255a 100644 | ||
368 | --- a/hotspot/src/share/vm/shark/sharkEntry.hpp | ||
369 | +++ b/hotspot/src/share/vm/shark/sharkEntry.hpp | ||
370 | @@ -27,6 +27,7 @@ | ||
371 | #define SHARE_VM_SHARK_SHARKENTRY_HPP | ||
372 | |||
373 | #include "shark/llvmHeaders.hpp" | ||
374 | +#include "entry_zero.hpp" | ||
375 | |||
376 | class SharkContext; | ||
377 | |||
378 | diff --git a/hotspot/src/share/vm/shark/sharkIntrinsics.cpp b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | ||
379 | index 9ad91c96d..560bb83f4 100644 | ||
380 | --- a/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | ||
381 | +++ b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | ||
382 | @@ -265,7 +265,11 @@ void SharkIntrinsics::do_Unsafe_compareAndSwapInt() { | ||
383 | "addr"); | ||
384 | |||
385 | // Perform the operation | ||
386 | +#if SHARK_LLVM_VERSION <= 34 | ||
387 | Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent); | ||
388 | +#else | ||
389 | + Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); | ||
390 | + #endif | ||
391 | // Push the result | ||
392 | state()->push( | ||
393 | SharkValue::create_jint( | ||
394 | diff --git a/hotspot/src/share/vm/shark/sharkRuntime.cpp b/hotspot/src/share/vm/shark/sharkRuntime.cpp | ||
395 | index fd9916e11..1ae03753e 100644 | ||
396 | --- a/hotspot/src/share/vm/shark/sharkRuntime.cpp | ||
397 | +++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp | ||
398 | @@ -32,6 +32,7 @@ | ||
399 | #ifdef TARGET_ARCH_zero | ||
400 | # include "stack_zero.inline.hpp" | ||
401 | #endif | ||
402 | +#include "memory/oopFactory.hpp" | ||
403 | |||
404 | using namespace llvm; | ||
405 | |||
406 | diff --git a/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp b/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | ||
407 | index 243183c07..601ca7925 100644 | ||
408 | --- a/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | ||
409 | +++ b/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | ||
410 | @@ -1732,7 +1732,11 @@ void SharkTopLevelBlock::do_new() { | ||
411 | heap_object = builder()->CreateIntToPtr( | ||
412 | old_top, SharkType::oop_type(), "heap_object"); | ||
413 | |||
414 | +#if SHARK_LLVM_VERSION <= 34 | ||
415 | Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent); | ||
416 | +#else | ||
417 | + Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent, llvm::SequentiallyConsistent); | ||
418 | +#endif | ||
419 | builder()->CreateCondBr( | ||
420 | builder()->CreateICmpEQ(old_top, check), | ||
421 | initialize, retry); | ||
422 | @@ -1933,7 +1937,11 @@ void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action) { | ||
423 | |||
424 | Value *lock = builder()->CreatePtrToInt( | ||
425 | monitor_header_addr, SharkType::intptr_type()); | ||
426 | +#if SHARK_LLVM_VERSION <= 34 | ||
427 | Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire); | ||
428 | +#else | ||
429 | + Value *check = builder()->CreateAtomicCmpXchg(mark_addr, disp, lock, llvm::Acquire, llvm::Acquire); | ||
430 | +#endif | ||
431 | builder()->CreateCondBr( | ||
432 | builder()->CreateICmpEQ(disp, check), | ||
433 | acquired_fast, try_recursive); | ||
434 | @@ -2018,7 +2026,11 @@ void SharkTopLevelBlock::release_lock(int exception_action) { | ||
435 | PointerType::getUnqual(SharkType::intptr_type()), | ||
436 | "mark_addr"); | ||
437 | |||
438 | +#if SHARK_LLVM_VERSION <= 34 | ||
439 | Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release); | ||
440 | +#else | ||
441 | + Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release, llvm::Monotonic); | ||
442 | +#endif | ||
443 | builder()->CreateCondBr( | ||
444 | builder()->CreateICmpEQ(lock, check), | ||
445 | released_fast, slow_path); | ||
446 | -- | ||
447 | 2.24.1 | ||
448 | |||