예제 #1
0
        private static IntPtr GoThroughPrecode(Precode precode)
        {
            if (precode is StubPrecode || precode is RemotingPrecode)
            {
                if (precode.TargetPtr == ThePreStub.Address)
                {
                    return(IntPtr.Zero);
                }

                var addr = Utils.FollowRelJmp(precode.JmpToTargetPtr);
                if (addr == ThePreStub.Address)
                {
                    return(IntPtr.Zero);
                }
                else if (FixupPrecode.IsFixupPrecode(addr))
                {
                    return(GoThroughFixupPrecode(FixupPrecode.Create(addr)));
                }

                return(addr);
            }

            if (precode is FixupPrecode)
            {
                return(GoThroughFixupPrecode((FixupPrecode)precode));
            }

            throw new NotSupportedException("Unsupported precode type.");
        }
예제 #2
0
 private static IntPtr GoThroughFixupPrecode(FixupPrecode precode)
 {
     if (precode.TargetPtr == ThePreStub.Address)
     {
         return(IntPtr.Zero); // method is not jitted
     }
     return(Utils.FollowRelJmp(precode.JmpToTargetPtr));
 }
예제 #3
0
        public static Precode Create(IntPtr methodPtr)
        {
            if (StubPrecode.IsStubPrecode(methodPtr))
            {
                return(StubPrecode.Create(methodPtr));
            }

            if (FixupPrecode.IsFixupPrecode(methodPtr))
            {
                return(FixupPrecode.Create(methodPtr));
            }

            if (RemotingPrecode.IsRemotingPrecode(methodPtr))
            {
                return(RemotingPrecode.Create(methodPtr));
            }

            throw new NotSupportedException("Not supported precode type.");
        }
예제 #4
0
 public static bool HasPrecode(IntPtr methodPtr)
 {
     return(StubPrecode.IsStubPrecode(methodPtr) ||
            FixupPrecode.IsFixupPrecode(methodPtr) ||
            RemotingPrecode.IsRemotingPrecode(methodPtr));
 }