summaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch')
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch205
1 files changed, 103 insertions, 102 deletions
diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch
index bc1abbd..f241361 100644
--- a/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch
+++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-shark-build.patch
@@ -1,6 +1,6 @@
1--- hotspot/make/Makefile.orig 2015-08-31 19:44:44.459038814 +0200 1--- hotspot/make/Makefile.orig
2+++ hotspot/make/Makefile 2015-08-31 19:44:58.511038867 +0200 2+++ hotspot/make/Makefile
3@@ -525,7 +525,7 @@ 3@@ -525,7 +525,7 @@ $(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD
4 # Unix 4 # Unix
5 $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) 5 $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
6 $(install-file) 6 $(install-file)
@@ -9,28 +9,28 @@
9 $(install-file) 9 $(install-file)
10 $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz 10 $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz
11 $(install-file) 11 $(install-file)
12--- hotspot/src/share/vm/ci/ciTypeFlow.cpp.orig 2015-08-31 19:45:28.611038980 +0200 12--- hotspot/src/share/vm/ci/ciTypeFlow.cpp.orig
13+++ hotspot/src/share/vm/ci/ciTypeFlow.cpp 2015-08-31 19:47:17.539039390 +0200 13+++ hotspot/src/share/vm/ci/ciTypeFlow.cpp
14@@ -35,7 +35,9 @@ 14@@ -35,8 +35,10 @@
15 #include "interpreter/bytecode.hpp" 15 #include "interpreter/bytecode.hpp"
16 #include "interpreter/bytecodes.hpp" 16 #include "interpreter/bytecodes.hpp"
17 #include "memory/allocation.inline.hpp" 17 #include "memory/allocation.inline.hpp"
18-#include "opto/compile.hpp"
19+#ifdef COMPILER2 18+#ifdef COMPILER2
20+#include "opto/compile.hpp" 19 #include "opto/compile.hpp"
21 #include "opto/node.hpp" 20 #include "opto/node.hpp"
22+#endif 21+#endif
23 #include "runtime/deoptimization.hpp" 22 #include "runtime/deoptimization.hpp"
24 #include "utilities/growableArray.hpp" 23 #include "utilities/growableArray.hpp"
25@@ -2647,6 +2649,7 @@ 24
25@@ -2648,6 +2650,7 @@ void ciTypeFlow::df_flow_types(Block* st
26 assert (!blk->has_pre_order(), ""); 26 assert (!blk->has_pre_order(), "");
27 blk->set_next_pre_order(); 27 blk->set_next_pre_order();
28 28
29+#ifdef COMPILER2 29+#ifdef COMPILER2
30 if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) { 30 if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) {
31 // Too many basic blocks. Bail out. 31 // Too many basic blocks. Bail out.
32 // This can happen when try/finally constructs are nested to depth N, 32 // This can happen when try/finally constructs are nested to depth N,
33@@ -2656,6 +2659,7 @@ 33@@ -2657,6 +2660,7 @@ void ciTypeFlow::df_flow_types(Block* st
34 record_failure("too many basic blocks"); 34 record_failure("too many basic blocks");
35 return; 35 return;
36 } 36 }
@@ -38,9 +38,9 @@
38 if (do_flow) { 38 if (do_flow) {
39 flow_block(blk, temp_vector, temp_set); 39 flow_block(blk, temp_vector, temp_set);
40 if (failing()) return; // Watch for bailouts. 40 if (failing()) return; // Watch for bailouts.
41--- hotspot/src/share/vm/classfile/systemDictionary.cpp.orig 2015-08-31 19:50:00.367040003 +0200 41--- hotspot/src/share/vm/classfile/systemDictionary.cpp.orig
42+++ hotspot/src/share/vm/classfile/systemDictionary.cpp 2015-08-31 19:51:28.323040334 +0200 42+++ hotspot/src/share/vm/classfile/systemDictionary.cpp
43@@ -2276,6 +2276,7 @@ 43@@ -2289,6 +2289,7 @@ methodHandle SystemDictionary::find_meth
44 spe = NULL; 44 spe = NULL;
45 // Must create lots of stuff here, but outside of the SystemDictionary lock. 45 // Must create lots of stuff here, but outside of the SystemDictionary lock.
46 m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty)); 46 m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
@@ -48,7 +48,7 @@
48 if (!Arguments::is_interpreter_only()) { 48 if (!Arguments::is_interpreter_only()) {
49 // Generate a compiled form of the MH intrinsic. 49 // Generate a compiled form of the MH intrinsic.
50 AdapterHandlerLibrary::create_native_wrapper(m); 50 AdapterHandlerLibrary::create_native_wrapper(m);
51@@ -2285,6 +2286,7 @@ 51@@ -2298,6 +2299,7 @@ methodHandle SystemDictionary::find_meth
52 "out of space in CodeCache for method handle intrinsic", empty); 52 "out of space in CodeCache for method handle intrinsic", empty);
53 } 53 }
54 } 54 }
@@ -56,9 +56,9 @@
56 // Now grab the lock. We might have to throw away the new method, 56 // Now grab the lock. We might have to throw away the new method,
57 // if a racing thread has managed to install one at the same time. 57 // if a racing thread has managed to install one at the same time.
58 { 58 {
59@@ -2298,9 +2300,11 @@ 59@@ -2311,9 +2313,11 @@ methodHandle SystemDictionary::find_meth
60 } 60 }
61 61
62 assert(spe != NULL && spe->method() != NULL, ""); 62 assert(spe != NULL && spe->method() != NULL, "");
63+#ifndef SHARK 63+#ifndef SHARK
64 assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() && 64 assert(Arguments::is_interpreter_only() || (spe->method()->has_compiled_code() &&
@@ -67,13 +67,13 @@
67+#endif 67+#endif
68 return spe->method(); 68 return spe->method();
69 } 69 }
70 70
71--- hotspot/src/share/vm/runtime/handles.inline.hpp.orig 2015-08-31 20:01:39.295042634 +0200 71--- hotspot/src/share/vm/runtime/handles.inline.hpp.orig
72+++ hotspot/src/share/vm/runtime/handles.inline.hpp 2015-08-31 20:04:31.331043282 +0200 72+++ hotspot/src/share/vm/runtime/handles.inline.hpp
73@@ -51,6 +51,12 @@ 73@@ -51,6 +51,12 @@ inline Handle::Handle(Thread* thread, oo
74 } 74 }
75 #endif // ASSERT 75 #endif // ASSERT
76 76
77+#ifdef SHARK 77+#ifdef SHARK
78+#define assert_on_stack(expr) (void)(expr) 78+#define assert_on_stack(expr) (void)(expr)
79+#else 79+#else
@@ -83,7 +83,7 @@
83 // Constructors for metadata handles 83 // Constructors for metadata handles
84 #define DEF_METADATA_HANDLE_FN(name, type) \ 84 #define DEF_METADATA_HANDLE_FN(name, type) \
85 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \ 85 inline name##Handle::name##Handle(type* obj) : _value(obj), _thread(NULL) { \
86@@ -79,7 +85,7 @@ 86@@ -79,7 +85,7 @@ inline name##Handle::name##Handle(const
87 } else { \ 87 } else { \
88 _thread = Thread::current(); \ 88 _thread = Thread::current(); \
89 } \ 89 } \
@@ -92,12 +92,12 @@
92 _thread->metadata_handles()->push((Metadata*)_value); \ 92 _thread->metadata_handles()->push((Metadata*)_value); \
93 } else { \ 93 } else { \
94 _thread = NULL; \ 94 _thread = NULL; \
95--- hotspot/src/cpu/zero/vm/entry_zero.hpp.orig 2015-08-31 20:53:40.743054385 +0200 95--- hotspot/src/cpu/zero/vm/entry_zero.hpp.orig
96+++ hotspot/src/cpu/zero/vm/entry_zero.hpp 2015-08-31 20:53:54.459054436 +0200 96+++ hotspot/src/cpu/zero/vm/entry_zero.hpp
97@@ -26,6 +26,10 @@ 97@@ -26,6 +26,10 @@
98 #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP 98 #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP
99 #define CPU_ZERO_VM_ENTRY_ZERO_HPP 99 #define CPU_ZERO_VM_ENTRY_ZERO_HPP
100 100
101+#include "utilities/globalDefinitions.hpp" 101+#include "utilities/globalDefinitions.hpp"
102+#include "utilities/exceptions.hpp" 102+#include "utilities/exceptions.hpp"
103+#include "interpreter/cppInterpreter.hpp" 103+#include "interpreter/cppInterpreter.hpp"
@@ -105,22 +105,22 @@
105 class ZeroEntry { 105 class ZeroEntry {
106 public: 106 public:
107 ZeroEntry() { 107 ZeroEntry() {
108--- hotspot/src/share/vm/shark/sharkEntry.hpp.orig 2015-08-31 20:47:13.091052925 +0200 108--- hotspot/src/share/vm/shark/sharkEntry.hpp.orig
109+++ hotspot/src/share/vm/shark/sharkEntry.hpp 2015-08-31 20:49:42.755053489 +0200 109+++ hotspot/src/share/vm/shark/sharkEntry.hpp
110@@ -27,6 +27,7 @@ 110@@ -27,6 +27,7 @@
111 #define SHARE_VM_SHARK_SHARKENTRY_HPP 111 #define SHARE_VM_SHARK_SHARKENTRY_HPP
112 112
113 #include "shark/llvmHeaders.hpp" 113 #include "shark/llvmHeaders.hpp"
114+#include "entry_zero.hpp" 114+#include "entry_zero.hpp"
115 115
116 class SharkContext; 116 class SharkContext;
117 117
118--- hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp.orig 2015-08-31 21:01:14.847056094 +0200 118--- hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp.orig
119+++ hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp 2015-08-31 21:01:24.459056130 +0200 119+++ hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp
120@@ -30,6 +30,10 @@ 120@@ -30,6 +30,10 @@
121 121
122 #ifdef CC_INTERP 122 #ifdef CC_INTERP
123 123
124+#ifdef TARGET_ARCH_zero 124+#ifdef TARGET_ARCH_zero
125+#include "entry_zero.hpp" 125+#include "entry_zero.hpp"
126+#endif 126+#endif
@@ -128,8 +128,8 @@
128 class CppInterpreterGenerator: public AbstractInterpreterGenerator { 128 class CppInterpreterGenerator: public AbstractInterpreterGenerator {
129 protected: 129 protected:
130 // shared code sequences 130 // shared code sequences
131--- hotspot/src/cpu/zero/vm/nativeInst_zero.cpp.orig 2015-08-31 21:07:21.643057475 +0200 131--- hotspot/src/cpu/zero/vm/nativeInst_zero.cpp.orig
132+++ hotspot/src/cpu/zero/vm/nativeInst_zero.cpp 2015-08-31 21:14:49.019059159 +0200 132+++ hotspot/src/cpu/zero/vm/nativeInst_zero.cpp
133@@ -26,6 +26,9 @@ 133@@ -26,6 +26,9 @@
134 #include "precompiled.hpp" 134 #include "precompiled.hpp"
135 #include "assembler_zero.inline.hpp" 135 #include "assembler_zero.inline.hpp"
@@ -140,23 +140,23 @@
140 #include "nativeInst_zero.hpp" 140 #include "nativeInst_zero.hpp"
141 #include "oops/oop.inline.hpp" 141 #include "oops/oop.inline.hpp"
142 #include "runtime/handles.hpp" 142 #include "runtime/handles.hpp"
143--- hotspot/src/share/vm/shark/llvmHeaders.hpp.orig 2015-09-01 14:17:09.793868541 +0200 143--- hotspot/src/share/vm/shark/llvmHeaders.hpp.orig
144+++ hotspot/src/share/vm/shark/llvmHeaders.hpp 2015-09-01 16:20:25.653868618 +0200 144+++ hotspot/src/share/vm/shark/llvmHeaders.hpp
145@@ -35,7 +35,11 @@ 145@@ -35,7 +35,11 @@
146 #undef DEBUG 146 #undef DEBUG
147 #endif 147 #endif
148 148
149+#if SHARK_LLVM_VERSION <= 34 149+#if SHARK_LLVM_VERSION <= 34
150 #include <llvm/Analysis/Verifier.h> 150 #include <llvm/Analysis/Verifier.h>
151+#else 151+#else
152+#include <llvm-c/Analysis.h> 152+#include <llvm-c/Analysis.h>
153+#endif 153+#endif
154 #include <llvm/ExecutionEngine/ExecutionEngine.h> 154 #include <llvm/ExecutionEngine/ExecutionEngine.h>
155 155
156 // includes specific to each version 156 // includes specific to each version
157--- common/autoconf/libraries.m4.orig 2015-09-01 16:53:51.821868486 +0200 157--- common/autoconf/libraries.m4.orig
158+++ common/autoconf/libraries.m4 2015-09-01 16:55:27.653868542 +0200 158+++ common/autoconf/libraries.m4
159@@ -847,8 +847,9 @@ 159@@ -834,8 +834,9 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB
160 fi 160 fi
161 fi 161 fi
162 done 162 done
@@ -164,23 +164,23 @@
164+ llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//; s/\..*$//') 164+ llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//; s/\..*$//')
165 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}" 165 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
166+ AS_IF([test $llvm_version -ge 34], [LLVM_CFLAGS="${LLVM_CFLAGS} -std=gnu++11"]) 166+ AS_IF([test $llvm_version -ge 34], [LLVM_CFLAGS="${LLVM_CFLAGS} -std=gnu++11"])
167 167
168 unset LLVM_LDFLAGS 168 unset LLVM_LDFLAGS
169 for flag in $("${LLVM_CONFIG}" --ldflags); do 169 for flag in $("${LLVM_CONFIG}" --ldflags); do
170@@ -862,7 +862,7 @@ 170@@ -848,7 +849,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB
171 done 171 done
172 172
173 unset LLVM_LIBS 173 unset LLVM_LIBS
174- for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do 174- for flag in $("${LLVM_CONFIG}" --libs ${llvm_components}); do
175+ for flag in $("${LLVM_CONFIG}" --libs --system-libs ${llvm_components}); do 175+ for flag in $("${LLVM_CONFIG}" --libs --system-libs ${llvm_components}); do
176 if echo "${flag}" | grep -q '^-l'; then 176 if echo "${flag}" | grep -q '^-l'; then
177 if test "${LLVM_LIBS}" != ""; then 177 if test "${LLVM_LIBS}" != ""; then
178 LLVM_LIBS="${LLVM_LIBS} " 178 LLVM_LIBS="${LLVM_LIBS} "
179--- hotspot/src/share/vm/shark/sharkIntrinsics.cpp.orig 2015-09-02 16:58:17.000000000 +0200 179--- hotspot/src/share/vm/shark/sharkIntrinsics.cpp.orig
180+++ hotspot/src/share/vm/shark/sharkIntrinsics.cpp 2015-09-02 17:09:26.000000000 +0200 180+++ hotspot/src/share/vm/shark/sharkIntrinsics.cpp
181@@ -265,7 +265,11 @@ 181@@ -265,7 +265,11 @@ void SharkIntrinsics::do_Unsafe_compareA
182 "addr"); 182 "addr");
183 183
184 // Perform the operation 184 // Perform the operation
185+#if SHARK_LLVM_VERSION <= 34 185+#if SHARK_LLVM_VERSION <= 34
186 Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent); 186 Value *result = builder()->CreateAtomicCmpXchg(addr, e, x, llvm::SequentiallyConsistent);
@@ -190,22 +190,22 @@
190 // Push the result 190 // Push the result
191 state()->push( 191 state()->push(
192 SharkValue::create_jint( 192 SharkValue::create_jint(
193--- hotspot/src/share/vm/shark/sharkRuntime.cpp.orig 2015-09-02 17:11:58.000000000 +0200 193--- hotspot/src/share/vm/shark/sharkRuntime.cpp.orig
194+++ hotspot/src/share/vm/shark/sharkRuntime.cpp 2015-09-02 17:12:57.000000000 +0200 194+++ hotspot/src/share/vm/shark/sharkRuntime.cpp
195@@ -32,6 +32,7 @@ 195@@ -32,6 +32,7 @@
196 #ifdef TARGET_ARCH_zero 196 #ifdef TARGET_ARCH_zero
197 # include "stack_zero.inline.hpp" 197 # include "stack_zero.inline.hpp"
198 #endif 198 #endif
199+#include "memory/oopFactory.hpp" 199+#include "memory/oopFactory.hpp"
200 200
201 using namespace llvm; 201 using namespace llvm;
202 202
203--- hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp.orig 2015-09-02 17:23:07.000000000 +0200 203--- hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp.orig
204+++ hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp 2015-09-02 17:43:20.000000000 +0200 204+++ hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
205@@ -1732,7 +1732,11 @@ 205@@ -1732,7 +1732,11 @@ void SharkTopLevelBlock::do_new() {
206 heap_object = builder()->CreateIntToPtr( 206 heap_object = builder()->CreateIntToPtr(
207 old_top, SharkType::oop_type(), "heap_object"); 207 old_top, SharkType::oop_type(), "heap_object");
208 208
209+#if SHARK_LLVM_VERSION <= 34 209+#if SHARK_LLVM_VERSION <= 34
210 Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent); 210 Value *check = builder()->CreateAtomicCmpXchg(top_addr, old_top, new_top, llvm::SequentiallyConsistent);
211+#else 211+#else
@@ -214,8 +214,8 @@
214 builder()->CreateCondBr( 214 builder()->CreateCondBr(
215 builder()->CreateICmpEQ(old_top, check), 215 builder()->CreateICmpEQ(old_top, check),
216 initialize, retry); 216 initialize, retry);
217@@ -1933,7 +1937,11 @@ 217@@ -1933,7 +1937,11 @@ void SharkTopLevelBlock::acquire_lock(Va
218 218
219 Value *lock = builder()->CreatePtrToInt( 219 Value *lock = builder()->CreatePtrToInt(
220 monitor_header_addr, SharkType::intptr_type()); 220 monitor_header_addr, SharkType::intptr_type());
221+#if SHARK_LLVM_VERSION <= 34 221+#if SHARK_LLVM_VERSION <= 34
@@ -226,10 +226,10 @@
226 builder()->CreateCondBr( 226 builder()->CreateCondBr(
227 builder()->CreateICmpEQ(disp, check), 227 builder()->CreateICmpEQ(disp, check),
228 acquired_fast, try_recursive); 228 acquired_fast, try_recursive);
229@@ -2018,7 +2026,11 @@ 229@@ -2018,7 +2026,11 @@ void SharkTopLevelBlock::release_lock(in
230 PointerType::getUnqual(SharkType::intptr_type()), 230 PointerType::getUnqual(SharkType::intptr_type()),
231 "mark_addr"); 231 "mark_addr");
232 232
233+#if SHARK_LLVM_VERSION <= 34 233+#if SHARK_LLVM_VERSION <= 34
234 Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release); 234 Value *check = builder()->CreateAtomicCmpXchg(mark_addr, lock, disp, llvm::Release);
235+#else 235+#else
@@ -238,8 +238,8 @@
238 builder()->CreateCondBr( 238 builder()->CreateCondBr(
239 builder()->CreateICmpEQ(lock, check), 239 builder()->CreateICmpEQ(lock, check),
240 released_fast, slow_path); 240 released_fast, slow_path);
241--- hotspot/src/cpu/zero/vm/interpreter_zero.cpp.orig 2015-09-14 20:13:25.539432044 +0200 241--- hotspot/src/cpu/zero/vm/interpreter_zero.cpp.orig
242+++ hotspot/src/cpu/zero/vm/interpreter_zero.cpp 2015-09-14 20:13:46.107432122 +0200 242+++ hotspot/src/cpu/zero/vm/interpreter_zero.cpp
243@@ -49,7 +49,7 @@ 243@@ -49,7 +49,7 @@
244 #ifdef COMPILER1 244 #ifdef COMPILER1
245 #include "c1/c1_Runtime1.hpp" 245 #include "c1/c1_Runtime1.hpp"
@@ -248,21 +248,21 @@
248+#if defined(CC_INTERP) || defined(SHARK) 248+#if defined(CC_INTERP) || defined(SHARK)
249 #include "interpreter/cppInterpreter.hpp" 249 #include "interpreter/cppInterpreter.hpp"
250 #endif 250 #endif
251 251
252--- hotspot/src/share/vm/shark/sharkCompiler.hpp.orig 2015-08-31 20:08:44.723044236 +0200 252--- hotspot/src/share/vm/shark/sharkCompiler.hpp.orig
253+++ hotspot/src/share/vm/shark/sharkCompiler.hpp 2015-08-31 20:08:59.387044291 +0200 253+++ hotspot/src/share/vm/shark/sharkCompiler.hpp
254@@ -40,6 +40,8 @@ 254@@ -40,6 +40,8 @@ class SharkCompiler : public AbstractCom
255 // Creation 255 // Creation
256 SharkCompiler(); 256 SharkCompiler();
257 257
258+ void init_llvm(); 258+ void init_llvm();
259+ 259+
260 // Name of this compiler 260 // Name of this compiler
261 const char *name() { return "shark"; } 261 const char *name() { return "shark"; }
262 262
263--- hotspot/src/share/vm/shark/sharkCompiler.cpp.orig 2015-09-19 12:19:21.000000000 +0200 263--- hotspot/src/share/vm/shark/sharkCompiler.cpp.orig
264+++ hotspot/src/share/vm/shark/sharkCompiler.cpp 2015-09-19 12:27:17.000000000 +0200 264+++ hotspot/src/share/vm/shark/sharkCompiler.cpp
265@@ -61,11 +61,25 @@ 265@@ -61,11 +61,25 @@ SharkCompiler::SharkCompiler()
266 : AbstractCompiler() { 266 : AbstractCompiler() {
267 // Create the lock to protect the memory manager and execution engine 267 // Create the lock to protect the memory manager and execution engine
268 _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock"); 268 _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock");
@@ -274,7 +274,7 @@
274+ // All done 274+ // All done
275+ set_state(initialized); 275+ set_state(initialized);
276+} 276+}
277 277
278+void SharkCompiler::init_llvm() { 278+void SharkCompiler::init_llvm() {
279+ // with llvm 3.5, Multi-threading can only be enabled/disabled with the 279+ // with llvm 3.5, Multi-threading can only be enabled/disabled with the
280+ // compile time define LLVM_ENABLE_THREADS 280+ // compile time define LLVM_ENABLE_THREADS
@@ -286,19 +286,19 @@
286+ if (!llvm_is_multithreaded()) 286+ if (!llvm_is_multithreaded())
287+ fatal("llvm_is_multithreaded() tells no multithreading support in llvm"); 287+ fatal("llvm_is_multithreaded() tells no multithreading support in llvm");
288+#endif 288+#endif
289 289
290 // Initialize the native target 290 // Initialize the native target
291 InitializeNativeTarget(); 291 InitializeNativeTarget();
292@@ -83,7 +97,7 @@ 292@@ -83,7 +97,7 @@ SharkCompiler::SharkCompiler()
293 // Finetune LLVM for the current host CPU. 293 // Finetune LLVM for the current host CPU.
294 StringMap<bool> Features; 294 StringMap<bool> Features;
295 bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features); 295 bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features);
296- std::string cpu("-mcpu=" + llvm::sys::getHostCPUName()); 296- std::string cpu("-mcpu=" + llvm::sys::getHostCPUName());
297+ std::string cpu("-mcpu=" + std::string(llvm::sys::getHostCPUName())); 297+ std::string cpu("-mcpu=" + std::string(llvm::sys::getHostCPUName()));
298 298
299 std::vector<const char*> args; 299 std::vector<const char*> args;
300 args.push_back(""); // program name 300 args.push_back(""); // program name
301@@ -112,6 +126,9 @@ 301@@ -112,6 +126,9 @@ SharkCompiler::SharkCompiler()
302 builder.setMAttrs(MAttrs); 302 builder.setMAttrs(MAttrs);
303 builder.setJITMemoryManager(memory_manager()); 303 builder.setJITMemoryManager(memory_manager());
304 builder.setEngineKind(EngineKind::JIT); 304 builder.setEngineKind(EngineKind::JIT);
@@ -308,9 +308,10 @@
308 builder.setErrorStr(&ErrorMsg); 308 builder.setErrorStr(&ErrorMsg);
309 if (! fnmatch(SharkOptimizationLevel, "None", 0)) { 309 if (! fnmatch(SharkOptimizationLevel, "None", 0)) {
310 tty->print_cr("Shark optimization level set to: None"); 310 tty->print_cr("Shark optimization level set to: None");
311@@ -134,9 +151,10 @@ 311@@ -133,10 +150,11 @@ SharkCompiler::SharkCompiler()
312 exit(1);
312 } 313 }
313 314
314+#if SHARK_LLVM_VERSION > 34 315+#if SHARK_LLVM_VERSION > 34
315+ _native_context->execution_engine(_execution_engine); 316+ _native_context->execution_engine(_execution_engine);
316+ _normal_context->execution_engine(_execution_engine); 317+ _normal_context->execution_engine(_execution_engine);
@@ -320,19 +321,19 @@
320- // All done 321- // All done
321- set_state(initialized); 322- set_state(initialized);
322 } 323 }
323 324
324 void SharkCompiler::initialize() { 325 void SharkCompiler::initialize() {
325@@ -165,7 +179,7 @@ 326@@ -165,7 +183,7 @@ void SharkCompiler::compile_method(ciEnv
326 } 327 }
327 328
328 // Create the recorders 329 // Create the recorders
329- Arena arena; 330- Arena arena;
330+ Arena arena(mtCompiler); 331+ Arena arena(mtCompiler);
331 env->set_oop_recorder(new OopRecorder(&arena)); 332 env->set_oop_recorder(new OopRecorder(&arena));
332 OopMapSet oopmaps; 333 OopMapSet oopmaps;
333 env->set_debug_info(new DebugInformationRecorder(env->oop_recorder())); 334 env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
334@@ -268,7 +282,12 @@ 335@@ -268,7 +286,12 @@ void SharkCompiler::generate_native_code
335 336
336 if (SharkVerifyFunction != NULL) { 337 if (SharkVerifyFunction != NULL) {
337 if (!fnmatch(SharkVerifyFunction, name, 0)) { 338 if (!fnmatch(SharkVerifyFunction, name, 0)) {
338+#if SHARK_LLVM_VERSION <= 34 339+#if SHARK_LLVM_VERSION <= 34
@@ -343,8 +344,8 @@
343+#endif 344+#endif
344 } 345 }
345 } 346 }
346 347
347@@ -298,7 +317,11 @@ 348@@ -298,7 +321,11 @@ void SharkCompiler::generate_native_code
348 #endif 349 #endif
349 #endif // !NDEBUG 350 #endif // !NDEBUG
350 memory_manager()->set_entry_for_function(function, entry); 351 memory_manager()->set_entry_for_function(function, entry);
@@ -356,11 +357,11 @@
356 } 357 }
357 assert(code != NULL, "code must be != NULL"); 358 assert(code != NULL, "code must be != NULL");
358 entry->set_entry_point(code); 359 entry->set_entry_point(code);
359--- hotspot/src/share/vm/shark/sharkContext.cpp.orig 2015-09-21 11:22:51.707813194 +0200 360--- hotspot/src/share/vm/shark/sharkContext.cpp.orig
360+++ hotspot/src/share/vm/shark/sharkContext.cpp 2015-09-21 13:47:56.243845961 +0200 361+++ hotspot/src/share/vm/shark/sharkContext.cpp
361@@ -34,8 +34,13 @@ 362@@ -34,8 +34,13 @@
362 using namespace llvm; 363 using namespace llvm;
363 364
364 SharkContext::SharkContext(const char* name) 365 SharkContext::SharkContext(const char* name)
365- : LLVMContext(), 366- : LLVMContext(),
366- _free_queue(NULL) { 367- _free_queue(NULL) {
@@ -373,32 +374,32 @@
373+{ 374+{
374 // Create a module to build our functions into 375 // Create a module to build our functions into
375 _module = new Module(name, *this); 376 _module = new Module(name, *this);
376 377
377--- hotspot/src/share/vm/shark/sharkContext.hpp.orig 2015-09-21 10:58:37.195807719 +0200 378--- hotspot/src/share/vm/shark/sharkContext.hpp.orig
378+++ hotspot/src/share/vm/shark/sharkContext.hpp 2015-09-21 13:50:48.459846609 +0200 379+++ hotspot/src/share/vm/shark/sharkContext.hpp
379@@ -29,6 +29,8 @@ 380@@ -29,6 +29,8 @@
380 #include "shark/llvmHeaders.hpp" 381 #include "shark/llvmHeaders.hpp"
381 #include "shark/sharkCompiler.hpp" 382 #include "shark/sharkCompiler.hpp"
382 383
383+#include <map> 384+#include <map>
384+ 385+
385 // The LLVMContext class allows multiple instances of LLVM to operate 386 // The LLVMContext class allows multiple instances of LLVM to operate
386 // independently of each other in a multithreaded context. We extend 387 // independently of each other in a multithreaded context. We extend
387 // this here to store things in Shark that are LLVMContext-specific. 388 // this here to store things in Shark that are LLVMContext-specific.
388@@ -41,12 +43,28 @@ 389@@ -41,12 +43,28 @@ class SharkContext : public llvm::LLVMCo
389 390
390 private: 391 private:
391 llvm::Module* _module; 392 llvm::Module* _module;
392+#if SHARK_LLVM_VERSION > 34 393+#if SHARK_LLVM_VERSION > 34
393+ llvm::ExecutionEngine *_ee; 394+ llvm::ExecutionEngine *_ee;
394+ std::map<std::string, llvm::Module *> func_mod_map; 395+ std::map<std::string, llvm::Module *> func_mod_map;
395+#endif 396+#endif
396 397
397 public: 398 public:
398 llvm::Module* module() const { 399 llvm::Module* module() const {
399 return _module; 400 return _module;
400 } 401 }
401 402
402+#if SHARK_LLVM_VERSION > 34 403+#if SHARK_LLVM_VERSION > 34
403+ llvm::ExecutionEngine *execution_engine(llvm::ExecutionEngine *ee) { 404+ llvm::ExecutionEngine *execution_engine(llvm::ExecutionEngine *ee) {
404+ llvm::ExecutionEngine *oee = _ee; 405+ llvm::ExecutionEngine *oee = _ee;
@@ -414,8 +415,8 @@
414 // Get this thread's SharkContext 415 // Get this thread's SharkContext
415 public: 416 public:
416 static SharkContext& current() { 417 static SharkContext& current() {
417@@ -55,12 +73,35 @@ 418@@ -55,12 +73,35 @@ class SharkContext : public llvm::LLVMCo
418 419
419 // Module accessors 420 // Module accessors
420 public: 421 public:
421- void add_function(llvm::Function* function) const { 422- void add_function(llvm::Function* function) const {
@@ -449,5 +450,5 @@
449+ } 450+ }
450+#endif 451+#endif
451 } 452 }
452 453
453 // Basic types 454 // Basic types