From 4dbb737648f3822f2b521dd236ac348d17166f65 Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:21:00 +0100 Subject: [PATCH] Module method IsJITIntrinsic (#77) --- WoofWare.PawPrint.Domain/MethodInfo.fs | 9 +++++---- WoofWare.PawPrint/IlMachineState.fs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/WoofWare.PawPrint.Domain/MethodInfo.fs b/WoofWare.PawPrint.Domain/MethodInfo.fs index c68debc..216bb1f 100644 --- a/WoofWare.PawPrint.Domain/MethodInfo.fs +++ b/WoofWare.PawPrint.Domain/MethodInfo.fs @@ -226,9 +226,12 @@ type MethodInfo<'typeGenerics, 'methodGenerics member this.IsPinvokeImpl : bool = this.MethodAttributes.HasFlag MethodAttributes.PinvokeImpl - member this.IsJITIntrinsic +[] +module MethodInfo = + let isJITIntrinsic (getMemberRefParentType : MemberReferenceHandle -> TypeRef) - (methodDefs : IReadOnlyDictionary>) + (methodDefs : IReadOnlyDictionary>) + (this : MethodInfo<'d, 'e>) : bool = this.CustomAttributes @@ -248,8 +251,6 @@ type MethodInfo<'typeGenerics, 'methodGenerics | con -> failwith $"TODO: {con}" ) -[] -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) diff --git a/WoofWare.PawPrint/IlMachineState.fs b/WoofWare.PawPrint/IlMachineState.fs index 841232f..8eb59d5 100644 --- a/WoofWare.PawPrint/IlMachineState.fs +++ b/WoofWare.PawPrint/IlMachineState.fs @@ -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