Mercurial > hg > truffle
changeset 17843:81d7a4b28dc5
8036619: Shark: add LLVM 3.4 support
Reviewed-by: twisti, kvn
author | neugens |
---|---|
date | Tue, 08 Apr 2014 14:55:16 -0700 |
parents | 3ef5c627634a |
children | 8847586c9037 21dd1c827123 |
files | make/linux/makefiles/zeroshark.make src/share/vm/shark/llvmHeaders.hpp src/share/vm/shark/sharkMemoryManager.cpp src/share/vm/shark/sharkMemoryManager.hpp |
diffstat | 4 files changed, 87 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/make/linux/makefiles/zeroshark.make Mon Apr 07 22:13:55 2014 -0700 +++ b/make/linux/makefiles/zeroshark.make Tue Apr 08 14:55:16 2014 -0700 @@ -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
--- a/src/share/vm/shark/llvmHeaders.hpp Mon Apr 07 22:13:55 2014 -0700 +++ b/src/share/vm/shark/llvmHeaders.hpp Tue Apr 08 14:55:16 2014 -0700 @@ -36,21 +36,43 @@ #endif #include <llvm/Analysis/Verifier.h> +#include <llvm/ExecutionEngine/ExecutionEngine.h> + +// includes specific to each version +#if SHARK_LLVM_VERSION <= 31 +#include <llvm/Support/IRBuilder.h> +#include <llvm/Type.h> #include <llvm/Argument.h> #include <llvm/Constants.h> #include <llvm/DerivedTypes.h> -#include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/Instructions.h> #include <llvm/LLVMContext.h> #include <llvm/Module.h> -#if SHARK_LLVM_VERSION <= 31 -#include <llvm/Support/IRBuilder.h> -#else +#elif SHARK_LLVM_VERSION <= 32 #include <llvm/IRBuilder.h> +#include <llvm/Type.h> +#include <llvm/Argument.h> +#include <llvm/Constants.h> +#include <llvm/DerivedTypes.h> +#include <llvm/Instructions.h> +#include <llvm/LLVMContext.h> +#include <llvm/Module.h> +#else // SHARK_LLVM_VERSION <= 34 +#include <llvm/IR/IRBuilder.h> +#include <llvm/IR/Argument.h> +#include <llvm/IR/Constants.h> +#include <llvm/IR/DerivedTypes.h> +#include <llvm/ExecutionEngine/ExecutionEngine.h> +#include <llvm/IR/Instructions.h> +#include <llvm/IR/LLVMContext.h> +#include <llvm/IR/Module.h> +#include <llvm/ADT/StringRef.h> +#include <llvm/IR/Type.h> #endif + +// common includes #include <llvm/Support/Threading.h> #include <llvm/Support/TargetSelect.h> -#include <llvm/Type.h> #include <llvm/ExecutionEngine/JITMemoryManager.h> #include <llvm/Support/CommandLine.h> #include <llvm/ExecutionEngine/MCJIT.h>
--- a/src/share/vm/shark/sharkMemoryManager.cpp Mon Apr 07 22:13:55 2014 -0700 +++ b/src/share/vm/shark/sharkMemoryManager.cpp Tue Apr 08 14:55:16 2014 -0700 @@ -59,18 +59,6 @@ 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 @@ mm()->setMemoryExecutable(); } -void SharkMemoryManager::deallocateExceptionTable(void *ptr) { - mm()->deallocateExceptionTable(ptr); -} - void SharkMemoryManager::deallocateFunctionBody(void *ptr) { mm()->deallocateFunctionBody(ptr); } @@ -96,6 +80,17 @@ return mm()->getPointerToNamedFunction(Name, AbortOnFailure); } +void SharkMemoryManager::setPoisonMemory(bool poison) { + mm()->setPoisonMemory(poison); +} + +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); } @@ -104,11 +99,34 @@ return mm()->allocateDataSection(Size, Alignment, SectionID); } -void SharkMemoryManager::setPoisonMemory(bool poison) { - mm()->setPoisonMemory(poison); +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); } -unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size, - unsigned int Alignment) { - return mm()->allocateSpace(Size, Alignment); +#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
--- a/src/share/vm/shark/sharkMemoryManager.hpp Mon Apr 07 22:13:55 2014 -0700 +++ b/src/share/vm/shark/sharkMemoryManager.hpp Tue Apr 08 14:55:16 2014 -0700 @@ -69,23 +69,32 @@ 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