[LLVMdev] getGlobalContext()
Junjie Gu
jgu222 at gmail.com
Mon Jun 21 11:36:23 PDT 2010
Suppose I have a multi-threaded application that needs to compile many
independant bitcodes. All threads do compilation concurrently.
For each thread, it creates its own context like the following:
LLVMContext *mycontext = new LLVMContext();
But it seems there are still places that explicitly refer to the
global context (like in Module.cpp). I wonder wether this is indended
or
has yet to be fixed ?
Thanks
Junjie
--------
Module.cpp
GlobalVariable *ilist_traits<GlobalVariable>::createSentinel() {
GlobalVariable *Ret = new GlobalVariable(Type::getInt32Ty(getGlobalContext()),
false, GlobalValue::ExternalLinkage);
// This should not be garbage monitored.
LeakDetector::removeGarbageObject(Ret);
return Ret;
}
GlobalAlias *ilist_traits<GlobalAlias>::createSentinel() {
GlobalAlias *Ret = new GlobalAlias(Type::getInt32Ty(getGlobalContext()),
GlobalValue::ExternalLinkage);
// This should not be garbage monitored.
LeakDetector::removeGarbageObject(Ret);
return Ret;
}
More information about the llvm-dev
mailing list