diff options
Diffstat (limited to 'ARMeilleure/CodeGen/CompiledFunction.cs')
-rw-r--r-- | ARMeilleure/CodeGen/CompiledFunction.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ARMeilleure/CodeGen/CompiledFunction.cs b/ARMeilleure/CodeGen/CompiledFunction.cs index ab5e88eb..0560bf2e 100644 --- a/ARMeilleure/CodeGen/CompiledFunction.cs +++ b/ARMeilleure/CodeGen/CompiledFunction.cs @@ -48,9 +48,21 @@ namespace ARMeilleure.CodeGen /// <returns>A delegate of type <typeparamref name="T"/> pointing to the mapped function</returns> public T Map<T>() { - IntPtr codePtr = JitCache.Map(this); + return MapWithPointer<T>(out _); + } + + /// <summary> + /// Maps the <see cref="CompiledFunction"/> onto the <see cref="JitCache"/> and returns a delegate of type + /// <typeparamref name="T"/> pointing to the mapped function. + /// </summary> + /// <typeparam name="T">Type of delegate</typeparam> + /// <param name="codePointer">Pointer to the function code in memory</param> + /// <returns>A delegate of type <typeparamref name="T"/> pointing to the mapped function</returns> + public T MapWithPointer<T>(out IntPtr codePointer) + { + codePointer = JitCache.Map(this); - return Marshal.GetDelegateForFunctionPointer<T>(codePtr); + return Marshal.GetDelegateForFunctionPointer<T>(codePointer); } } }
\ No newline at end of file |