aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/CompiledFunction.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-01-23 19:37:53 -0300
committerGitHub <noreply@github.com>2023-01-23 22:37:53 +0000
commita1a4771ac1de95f2410c7fb8dfaf4a5986e5ebc6 (patch)
treeb79abb40024184b18b2ff821490de4ad5e7b9683 /ARMeilleure/CodeGen/CompiledFunction.cs
parent2fd819613ffcede43562b333602d17fa79c9751d (diff)
Remove use of GetFunctionPointerForDelegate to get JIT cache function pointer (#4337)1.1.594
* Remove use of GetFunctionPointerForDelegate to get JIT cache function pointer * Rename FuncPtr to FuncPointer
Diffstat (limited to 'ARMeilleure/CodeGen/CompiledFunction.cs')
-rw-r--r--ARMeilleure/CodeGen/CompiledFunction.cs16
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