def finalize(self): """ Finalize the library. After this call, nothing can be added anymore. Finalization involves various stages of code optimization and linking. """ require_global_compiler_lock() # Report any LLVM-related problems to the user self._codegen._check_llvm_bugs() self._raise_if_finalized() if config.DUMP_FUNC_OPT: dump("FUNCTION OPTIMIZED DUMP %s" % self._name, self.get_llvm_str()) # Link libraries for shared code for library in self._linking_libraries: self._final_module.link_in(library._get_module_for_linking(), preserve=True) for library in self._codegen._libraries: self._final_module.link_in(library._get_module_for_linking(), preserve=True) # Optimize the module after all dependences are linked in above, # to allow for inlining. self._optimize_final_module() self._final_module.verify() self._finalize_final_module()
def test_gcl_as_context_manager(self): with global_compiler_lock: require_global_compiler_lock()
def func(): require_global_compiler_lock()