Module method IsJITIntrinsic (#77)

This commit is contained in:
Patrick Stevens
2025-06-30 22:21:00 +01:00
committed by GitHub
parent ddd6374c72
commit 4dbb737648
2 changed files with 7 additions and 5 deletions

View File

@@ -226,9 +226,12 @@ type MethodInfo<'typeGenerics, 'methodGenerics
member this.IsPinvokeImpl : bool = member this.IsPinvokeImpl : bool =
this.MethodAttributes.HasFlag MethodAttributes.PinvokeImpl this.MethodAttributes.HasFlag MethodAttributes.PinvokeImpl
member this.IsJITIntrinsic [<RequireQualifiedAccess>]
module MethodInfo =
let isJITIntrinsic
(getMemberRefParentType : MemberReferenceHandle -> TypeRef) (getMemberRefParentType : MemberReferenceHandle -> TypeRef)
(methodDefs : IReadOnlyDictionary<MethodDefinitionHandle, MethodInfo<FakeUnit, GenericParameter>>) (methodDefs : IReadOnlyDictionary<MethodDefinitionHandle, MethodInfo<'a, 'b>>)
(this : MethodInfo<'d, 'e>)
: bool : bool
= =
this.CustomAttributes this.CustomAttributes
@@ -248,8 +251,6 @@ type MethodInfo<'typeGenerics, 'methodGenerics
| con -> failwith $"TODO: {con}" | con -> failwith $"TODO: {con}"
) )
[<RequireQualifiedAccess>]
module MethodInfo =
let mapTypeGenerics<'a, 'b, 'methodGen let mapTypeGenerics<'a, 'b, 'methodGen
when 'a :> IComparable<'a> and 'a : comparison and 'b : comparison and 'b :> IComparable<'b>> when 'a :> IComparable<'a> and 'a : comparison and 'b : comparison and 'b :> IComparable<'b>>
(f : int -> 'a -> 'b) (f : int -> 'a -> 'b)

View File

@@ -740,13 +740,14 @@ module IlMachineState =
// Check for intrinsics first // Check for intrinsics first
let isIntrinsic = let isIntrinsic =
methodToCall.IsJITIntrinsic MethodInfo.isJITIntrinsic
(fun handle -> (fun handle ->
match activeAssy.Members.[handle].Parent with match activeAssy.Members.[handle].Parent with
| MetadataToken.TypeReference r -> activeAssy.TypeRefs.[r] | MetadataToken.TypeReference r -> activeAssy.TypeRefs.[r]
| x -> failwith $"{x}" | x -> failwith $"{x}"
) )
activeAssy.Methods activeAssy.Methods
methodToCall
match match
if isIntrinsic then if isIntrinsic then