diff --git a/hotspot/make/linux/makefiles/zeroshark.make b/hotspot/make/linux/makefiles/zeroshark.make index 890a0910e7f..3c10770d42a 100644 --- a/hotspot/make/linux/makefiles/zeroshark.make +++ b/hotspot/make/linux/makefiles/zeroshark.make @@ -25,6 +25,9 @@ # Setup common to Zero (non-Shark) and Shark versions of VM +# override this from the main file because some version of llvm do not like -Wundef +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wunused-function -Wunused-value + # The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) # The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized diff --git a/hotspot/src/share/vm/shark/llvmHeaders.hpp b/hotspot/src/share/vm/shark/llvmHeaders.hpp index 1f2c2c79778..05ef7fea1d3 100644 --- a/hotspot/src/share/vm/shark/llvmHeaders.hpp +++ b/hotspot/src/share/vm/shark/llvmHeaders.hpp @@ -36,21 +36,43 @@ #endif #include +#include + +// includes specific to each version +#if SHARK_LLVM_VERSION <= 31 +#include +#include #include #include #include -#include #include #include #include -#if SHARK_LLVM_VERSION <= 31 -#include -#else +#elif SHARK_LLVM_VERSION <= 32 #include +#include +#include +#include +#include +#include +#include +#include +#else // SHARK_LLVM_VERSION <= 34 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif + +// common includes #include #include -#include #include #include #include diff --git a/hotspot/src/share/vm/shark/sharkCompiler.cpp b/hotspot/src/share/vm/shark/sharkCompiler.cpp index 17fdcfcbbe3..fe62efdecbd 100644 --- a/hotspot/src/share/vm/shark/sharkCompiler.cpp +++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp @@ -364,3 +364,7 @@ const char* SharkCompiler::methodname(const char* klass, const char* method) { *(dst++) = '\0'; return buf; } + +void SharkCompiler::print_timers() { + // do nothing +} diff --git a/hotspot/src/share/vm/shark/sharkCompiler.hpp b/hotspot/src/share/vm/shark/sharkCompiler.hpp index 97400298865..1b8681771a0 100644 --- a/hotspot/src/share/vm/shark/sharkCompiler.hpp +++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp @@ -56,6 +56,9 @@ class SharkCompiler : public AbstractCompiler { // Compile a normal (bytecode) method and install it in the VM void compile_method(ciEnv* env, ciMethod* target, int entry_bci); + // Print compilation timers and statistics + void print_timers(); + // Generate a wrapper for a native (JNI) method nmethod* generate_native_wrapper(MacroAssembler* masm, methodHandle target, diff --git a/hotspot/src/share/vm/shark/sharkInliner.cpp b/hotspot/src/share/vm/shark/sharkInliner.cpp index 76b63a16342..47465848d7d 100644 --- a/hotspot/src/share/vm/shark/sharkInliner.cpp +++ b/hotspot/src/share/vm/shark/sharkInliner.cpp @@ -744,6 +744,10 @@ bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) { } bool SharkInliner::attempt_inline(ciMethod *target, SharkState *state) { + if (!Inline) { + return false; + } + if (SharkIntrinsics::is_intrinsic(target)) { SharkIntrinsics::inline_intrinsic(target, state); return true; diff --git a/hotspot/src/share/vm/shark/sharkMemoryManager.cpp b/hotspot/src/share/vm/shark/sharkMemoryManager.cpp index 20cb0e5ebfe..d986ae8868b 100644 --- a/hotspot/src/share/vm/shark/sharkMemoryManager.cpp +++ b/hotspot/src/share/vm/shark/sharkMemoryManager.cpp @@ -59,18 +59,6 @@ void SharkMemoryManager::endFunctionBody(const Function* F, entry->set_code_limit(FunctionEnd); } -unsigned char* SharkMemoryManager::startExceptionTable(const Function* F, - uintptr_t& ActualSize) { - return mm()->startExceptionTable(F, ActualSize); -} - -void SharkMemoryManager::endExceptionTable(const Function* F, - unsigned char* TableStart, - unsigned char* TableEnd, - unsigned char* FrameRegister) { - mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister); -} - void SharkMemoryManager::setMemoryWritable() { mm()->setMemoryWritable(); } @@ -79,10 +67,6 @@ void SharkMemoryManager::setMemoryExecutable() { mm()->setMemoryExecutable(); } -void SharkMemoryManager::deallocateExceptionTable(void *ptr) { - mm()->deallocateExceptionTable(ptr); -} - void SharkMemoryManager::deallocateFunctionBody(void *ptr) { mm()->deallocateFunctionBody(ptr); } @@ -96,14 +80,6 @@ void* SharkMemoryManager::getPointerToNamedFunction(const std::string &Name, boo return mm()->getPointerToNamedFunction(Name, AbortOnFailure); } -uint8_t* SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { - return mm()->allocateCodeSection(Size, Alignment, SectionID); -} - -uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { - return mm()->allocateDataSection(Size, Alignment, SectionID); -} - void SharkMemoryManager::setPoisonMemory(bool poison) { mm()->setPoisonMemory(poison); } @@ -112,3 +88,45 @@ unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size, unsigned int Alignment) { return mm()->allocateSpace(Size, Alignment); } + +#if SHARK_LLVM_VERSION <= 32 + +uint8_t* SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { + return mm()->allocateCodeSection(Size, Alignment, SectionID); +} + +uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { + return mm()->allocateDataSection(Size, Alignment, SectionID); +} + +void SharkMemoryManager::deallocateExceptionTable(void *ptr) { + mm()->deallocateExceptionTable(ptr); +} + +unsigned char* SharkMemoryManager::startExceptionTable(const Function* F, + uintptr_t& ActualSize) { + return mm()->startExceptionTable(F, ActualSize); +} + +void SharkMemoryManager::endExceptionTable(const Function* F, + unsigned char* TableStart, + unsigned char* TableEnd, + unsigned char* FrameRegister) { + mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister); +} + +#else + +uint8_t *SharkMemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) { + return mm()->allocateCodeSection(Size, Alignment, SectionID, SectionName); +} + +uint8_t* SharkMemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) { + return mm()->allocateDataSection(Size, Alignment, SectionID, SectionName, IsReadOnly); +} + +bool SharkMemoryManager::finalizeMemory(std::string *ErrMsg) { + return mm()->finalizeMemory(ErrMsg); +} + +#endif diff --git a/hotspot/src/share/vm/shark/sharkMemoryManager.hpp b/hotspot/src/share/vm/shark/sharkMemoryManager.hpp index fa725a14502..7a5ad7b3e1c 100644 --- a/hotspot/src/share/vm/shark/sharkMemoryManager.hpp +++ b/hotspot/src/share/vm/shark/sharkMemoryManager.hpp @@ -69,23 +69,32 @@ class SharkMemoryManager : public llvm::JITMemoryManager { void endFunctionBody(const llvm::Function* F, unsigned char* FunctionStart, unsigned char* FunctionEnd); - unsigned char* startExceptionTable(const llvm::Function* F, - uintptr_t& ActualSize); - void endExceptionTable(const llvm::Function* F, - unsigned char* TableStart, - unsigned char* TableEnd, - unsigned char* FrameRegister); + void *getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure = true); - uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); - uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); void setPoisonMemory(bool); uint8_t* allocateGlobal(uintptr_t, unsigned int); void setMemoryWritable(); void setMemoryExecutable(); - void deallocateExceptionTable(void *ptr); void deallocateFunctionBody(void *ptr); unsigned char *allocateSpace(intptr_t Size, unsigned int Alignment); + +#if SHARK_LLVM_VERSION <= 32 +uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); +uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID); +unsigned char* startExceptionTable(const llvm::Function* F, + uintptr_t& ActualSize); +void deallocateExceptionTable(void *ptr); +void endExceptionTable(const llvm::Function* F, + unsigned char* TableStart, + unsigned char* TableEnd, + unsigned char* FrameRegister); +#else +uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName); +uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName, bool IsReadOnly); +bool finalizeMemory(std::string *ErrMsg = 0); +#endif + }; #endif // SHARE_VM_SHARK_SHARKMEMORYMANAGER_HPP