|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
RFC: shark + llvm2.6svn LLVMContext api changeLLVM 2.6svn trunk now require the passing of a LLVMContext while
creating a LLVM Module in order for LLVM clients to use the LLVM JIT multithreaded. [1] Fortunate for us LLVM have also provided a new backward compatible API, by using getGlobalContext() a LLVMContext are returned that can be used by current singlethreaded compiler clients to quickly fullfill this change. [2] I have added some comments to help future shark hackers find what needs to change if someone wants to make the shark compiler multi-threaded. I have tested this patch using llvm r74781 and icedtea6 http://icedtea.classpath.org/hg/icedtea6/rev/308c172cd230 on ia32 / F11 [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-June/023505.html - [LLVMdev] MAJOR API CHANGE: LLVMContext [2] http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-June/023507.html Cheers Xerxes Index: icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp =================================================================== --- icedtea6.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp +++ icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp @@ -43,7 +43,15 @@ SharkCompiler::SharkCompiler() #endif // Create a module to build our functions into +#if SHARK_LLVM_VERSION >= 26 + // LLVM 2.6 and later requires passing a LLVMContext during module + // creation. The LLVM API getGlobalContext() returns a LLVMContext that + // can be used safely as long as the shark compiler stays single threaded + // and only uses one module. + _module = new Module("shark", getGlobalContext()); +#else _module = new Module("shark"); +#endif // Create the builder to build our functions _builder = new SharkBuilder(this); Index: icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp =================================================================== --- icedtea6.orig/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp +++ icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp @@ -32,6 +32,9 @@ #include <llvm/DerivedTypes.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/Instructions.h> +#if SHARK_LLVM_VERSION >= 26 +#include <llvm/LLVMContext.h> +#endif #include <llvm/Module.h> #include <llvm/ModuleProvider.h> #include <llvm/Support/IRBuilder.h> |
|
|
Re: RFC: shark + llvm2.6svn LLVMContext api changePlease commit this, it's better than the solution I made :)
Cheers, Gary Xerxes Rånby wrote: > LLVM 2.6svn trunk now require the passing of a LLVMContext while > creating a LLVM Module in order for LLVM clients to use the LLVM JIT > multithreaded. [1] > Fortunate for us LLVM have also provided a new backward compatible API, > by using getGlobalContext() a LLVMContext are returned that can be used > by current singlethreaded compiler clients to quickly fullfill this > change. [2] > > I have added some comments to help future shark hackers find what needs > to change if someone wants to make the shark compiler multi-threaded. > > I have tested this patch using llvm r74781 and icedtea6 > http://icedtea.classpath.org/hg/icedtea6/rev/308c172cd230 on ia32 / F11 > > [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-June/023505.html - > [LLVMdev] MAJOR API CHANGE: LLVMContext > [2] http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-June/023507.html > > Cheers > Xerxes > > > > Index: icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp > =================================================================== > --- icedtea6.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp > +++ icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp > @@ -43,7 +43,15 @@ SharkCompiler::SharkCompiler() > #endif > > // Create a module to build our functions into > +#if SHARK_LLVM_VERSION >= 26 > + // LLVM 2.6 and later requires passing a LLVMContext during module > + // creation. The LLVM API getGlobalContext() returns a LLVMContext that > + // can be used safely as long as the shark compiler stays single threaded > + // and only uses one module. > + _module = new Module("shark", getGlobalContext()); > +#else > _module = new Module("shark"); > +#endif > > // Create the builder to build our functions > _builder = new SharkBuilder(this); > Index: icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp > =================================================================== > --- icedtea6.orig/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp > +++ icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp > @@ -32,6 +32,9 @@ > #include <llvm/DerivedTypes.h> > #include <llvm/ExecutionEngine/ExecutionEngine.h> > #include <llvm/Instructions.h> > +#if SHARK_LLVM_VERSION >= 26 > +#include <llvm/LLVMContext.h> > +#endif > #include <llvm/Module.h> > #include <llvm/ModuleProvider.h> > #include <llvm/Support/IRBuilder.h> -- http://gbenson.net/ |
| Free embeddable forum powered by Nabble | Forum Help |