Esempio n. 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.");
        }
Esempio n. 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));
 }
        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.");
        }
 public static bool HasPrecode(IntPtr methodPtr)
 {
     return(StubPrecode.IsStubPrecode(methodPtr) ||
            FixupPrecode.IsFixupPrecode(methodPtr) ||
            RemotingPrecode.IsRemotingPrecode(methodPtr));
 }