llvm 0.6.7.0 → 0.6.8.0
raw patch · 4 files changed
+32/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ LLVM.ExecutionEngine: getFreePointers :: Function f -> EngineAccess FreePointers
+ LLVM.ExecutionEngine: type FreePointers = (Ptr ExecutionEngine, ModuleProviderRef, ValueRef)
Files
- LLVM/ExecutionEngine.hs +1/−0
- LLVM/ExecutionEngine/Engine.hs +12/−0
- cbits/free.c +15/−0
- llvm.cabal +4/−1
LLVM/ExecutionEngine.hs view
@@ -11,6 +11,7 @@ runStaticDestructors, -} getPointerToFunction,+ getFreePointers, FreePointers, -- * Translation Translatable, Generic, generateFunction,
LLVM/ExecutionEngine/Engine.hs view
@@ -9,6 +9,7 @@ {- runStaticConstructors, runStaticDestructors, -} getExecutionEngineTargetData, getPointerToFunction,+ getFreePointers, FreePointers, runFunction, getRunFunction, GenericValue, Generic(..) ) where@@ -31,6 +32,7 @@ import LLVM.Core.Util(Module, ModuleProvider, withModuleProvider, createModule, createModuleProviderForExistingModule) import qualified LLVM.FFI.ExecutionEngine as FFI import qualified LLVM.FFI.Target as FFI+import qualified LLVM.FFI.Core as FFI(ModuleProviderRef, ValueRef) import qualified LLVM.Core.Util(Function) import LLVM.Core.Type(IsFirstClass, typeRef) @@ -156,6 +158,16 @@ addModule m = do mp <- liftIO $ createModuleProviderForExistingModule m addModuleProvider mp++-- | Get all the information needed to free a function.+-- Freeing code might have to be done from a (C) finalizer, so it has to done from C.+-- The function c_freeFunctionObject take these pointers as arguments and frees the function.+type FreePointers = (Ptr FFI.ExecutionEngine, FFI.ModuleProviderRef, FFI.ValueRef)+getFreePointers :: Function f -> EngineAccess FreePointers+getFreePointers (Value f) = do+ ea <- get+ liftIO $ withModuleProvider (head $ ea_providers ea) $ \ mpp ->+ return (ea_engine ea, mpp, f) --------------------------------------
+ cbits/free.c view
@@ -0,0 +1,15 @@+#include <llvm-c/Core.h>+#include <llvm-c/ExecutionEngine.h>++/* C function to free function object resources. Can be called from a finalizer. */+void+c_freeFunctionObject(LLVMExecutionEngineRef execEngine,+ LLVMModuleProviderRef moduleProvider,+ LLVMValueRef f)+{+ LLVMModuleRef mod;+ LLVMFreeMachineCodeForFunction(execEngine, f);+ if (!LLVMRemoveModuleProvider(execEngine, moduleProvider, &mod, 0)) {+ LLVMDisposeModule(mod);+ }+}
llvm.cabal view
@@ -1,9 +1,10 @@ name: llvm-version: 0.6.7.0+version: 0.6.8.0 license: BSD3 license-file: LICENSE synopsis: Bindings to the LLVM compiler toolkit. description: Bindings to the LLVM compiler toolkit.+ New in 0.6.8.0: Add functions to allow freeing function resources; New in 0.6.7.0: Struct types; New in 0.6.6.0: Bug fixes; New in 0.6.5.0: Adapted to LLVM 2.5;@@ -83,3 +84,5 @@ LLVM.Core.Vector LLVM.ExecutionEngine.Engine LLVM.ExecutionEngine.Target++ C-Sources: cbits/free.c