示例#1
0
        public static MCJITMemoryManager Create(IntPtr opaque, AllocCodeSectionCallback allocateCodeSection, AllocDataSectionCallback allocateDataSection, FinalizeMemoryCallback finalizeMemory, Action <IntPtr> destroy)
        {
            var allocCodeSectionCallback = new LLVMMemoryManagerAllocateCodeSectionCallback(allocateCodeSection);
            var allocDataSectionCallback = new LLVMMemoryManagerAllocateDataSectionCallback((a, b, c, d, e, f) => allocateDataSection(a, b, c, d, e, f));
            var finalizeMemoryCallback   = new LLVMMemoryManagerFinalizeMemoryCallback(new MemoryManagerFinalizeMemoryClosure(finalizeMemory).Invoke);
            var destroyCallback          = new LLVMMemoryManagerDestroyCallback(destroy);
            var memoryManager            = LLVM.CreateSimpleMCJITMemoryManager(opaque, allocCodeSectionCallback, allocDataSectionCallback, finalizeMemoryCallback, destroyCallback)
                                           .Wrap()
                                           .MakeHandleOwner <MCJITMemoryManager, LLVMMCJITMemoryManagerRef>();

            memoryManager._allocCodeSectionCallback = allocCodeSectionCallback;
            memoryManager._allocDataSectionCallback = allocDataSectionCallback;
            memoryManager._finalizeMemoryCallback   = finalizeMemoryCallback;
            memoryManager._destroyCallback          = destroyCallback;
            return(memoryManager);
        }
示例#2
0
 public static extern LLVMMCJITMemoryManagerRef CreateSimpleMCJITMemoryManager(IntPtr @Opaque, LLVMMemoryManagerAllocateCodeSectionCallback @AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback @AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback @FinalizeMemory, LLVMMemoryManagerDestroyCallback @Destroy);
示例#3
0
        public static MCJITMemoryManager Create(IntPtr opaque, LLVMMemoryManagerAllocateCodeSectionCallback allocCodeSectionCallback, LLVMMemoryManagerAllocateDataSectionCallback allocDataSectionCallback, LLVMMemoryManagerFinalizeMemoryCallback finalizeMemoryCallback, LLVMMemoryManagerDestroyCallback destroyCallback)
        {
            var memoryManager = LLVM.CreateSimpleMCJITMemoryManager(opaque, allocCodeSectionCallback, allocDataSectionCallback, finalizeMemoryCallback, destroyCallback)
                                .Wrap()
                                .MakeHandleOwner <MCJITMemoryManager, LLVMMCJITMemoryManagerRef>();

            memoryManager._allocCodeSectionCallback = allocCodeSectionCallback;
            memoryManager._allocDataSectionCallback = allocDataSectionCallback;
            memoryManager._finalizeMemoryCallback   = finalizeMemoryCallback;
            memoryManager._destroyCallback          = destroyCallback;
            return(memoryManager);
        }