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

View File

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