Пример #1
0
 protected override void Setup()
 {
     if (TypeLayout.NativePointerSize == 4)
         NativePatchType = PatchType.I4;
     else
         NativePatchType = PatchType.I8;
 }
Пример #2
0
        private static byte GetPatchTypeSize(PatchType patchType)
        {
            switch (patchType)
            {
            case PatchType.I4: return(32);

            case PatchType.I8: return(64);

            default:
                throw new CompilerException("unknown patch type: " + patchType.ToString());
            }
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of LinkRequest.
        /// </summary>
        /// <param name="linkType">Type of the link.</param>
        /// <param name="patchType">Type of the patch.</param>
        /// <param name="patchSymbol">The patch symbol.</param>
        /// <param name="patchOffset">The patch offset.</param>
        /// <param name="referenceSymbol">The reference symbol.</param>
        /// <param name="referenceOffset">The reference offset.</param>
        ///
        public LinkRequest(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            Debug.Assert(patchSymbol != null);
            Debug.Assert(referenceSymbol != null);

            LinkType = linkType;
            PatchType = patchType;

            PatchSymbol = patchSymbol;
            PatchOffset = patchOffset;

            ReferenceSymbol = referenceSymbol;
            ReferenceOffset = referenceOffset;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of LinkRequest.
        /// </summary>
        /// <param name="linkType">Type of the link.</param>
        /// <param name="patchType">Type of the patch.</param>
        /// <param name="patchSymbol">The patch symbol.</param>
        /// <param name="patchOffset">The patch offset.</param>
        /// <param name="referenceSymbol">The reference symbol.</param>
        /// <param name="referenceOffset">The reference offset.</param>
        ///
        public LinkRequest(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            Debug.Assert(patchSymbol != null);
            Debug.Assert(referenceSymbol != null);

            LinkType  = linkType;
            PatchType = patchType;

            PatchSymbol = patchSymbol;
            PatchOffset = patchOffset;

            ReferenceSymbol = referenceSymbol;
            ReferenceOffset = referenceOffset;
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of LinkRequest.
        /// </summary>
        /// <param name="linkType">Type of the link.</param>
        /// <param name="patchType">Type of the patch.</param>
        /// <param name="patchSymbol">The patch symbol.</param>
        /// <param name="patchOffset">The patch offset.</param>
        /// <param name="relativeBase">The relative base.</param>
        /// <param name="referenceSymbol">The reference symbol.</param>
        /// <param name="referenceOffset">The reference offset.</param>
        public LinkRequest(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            Debug.Assert(patchSymbol != null);
            Debug.Assert(referenceSymbol != null);
            Debug.Assert(patchType != null);

            this.LinkType  = linkType;
            this.PatchType = patchType;

            this.PatchSymbol = patchSymbol;
            this.PatchOffset = patchOffset;

            this.RelativeBase    = relativeBase;
            this.ReferenceSymbol = referenceSymbol;
            this.ReferenceOffset = referenceOffset;
        }
        protected override void Run()
        {
            if (!HasProtectedRegions)
                return;

            ProtectedRegion.FinalizeAll(BasicBlocks, MethodCompiler.ProtectedRegions);

            codeEmitter = MethodCompiler.Pipeline.FindFirst<CodeGenerationStage>().CodeEmitter;

            if (TypeLayout.NativePointerSize == 4)
                NativePatchType = BuiltInPatch.I4;
            else
                NativePatchType = BuiltInPatch.I8;

            EmitProtectedRegionTable();
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of LinkRequest.
        /// </summary>
        /// <param name="linkType">Type of the link.</param>
        /// <param name="patchType">Type of the patch.</param>
        /// <param name="patchSymbol">The patch symbol.</param>
        /// <param name="patchOffset">The patch offset.</param>
        /// <param name="relativeBase">The relative base.</param>
        /// <param name="referenceSymbol">The reference symbol.</param>
        /// <param name="referenceOffset">The reference offset.</param>
        public LinkRequest(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            Debug.Assert(patchSymbol != null);
            Debug.Assert(referenceSymbol != null);
            Debug.Assert(patchType != null);

            this.LinkType = linkType;
            this.PatchType = patchType;

            this.PatchSymbol = patchSymbol;
            this.PatchOffset = patchOffset;

            this.RelativeBase = relativeBase;
            this.ReferenceSymbol = referenceSymbol;
            this.ReferenceOffset = referenceOffset;
        }
Пример #8
0
        public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, string referenceSymbol, SectionKind patchRelativeBase, int referenceOffset)
        {
            var referenceObject = GetSymbol(referenceSymbol, patchRelativeBase);

            Link(linkType, patchType, patchSymbol, patchOffset, relativeBase, referenceObject, referenceOffset);
        }
Пример #9
0
        public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, string referenceSymbol, SectionKind patchRelativeBase, int referenceOffset)
        {
            var referenceObject = GetSymbol(referenceSymbol, patchRelativeBase);

            Link(linkType, patchType, patchSymbol, patchOffset, relativeBase, referenceObject, referenceOffset);
        }
Пример #10
0
        public void Link(LinkType linkType, PatchType patchType, string patchSymbol, SectionKind patchKind, int patchOffset, int relativeBase, string referenceSymbol, SectionKind referenceKind, int referenceOffset)
        {
            var referenceObject = GetSymbol(referenceSymbol, referenceKind);
            var patchObject = GetSymbol(patchSymbol, patchKind);

            Link(linkType, patchType, patchObject, patchOffset, relativeBase, referenceObject, referenceOffset);
        }
Пример #11
0
 public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset)
 {
     lock (mylock)
     {
         var linkRequest = new LinkRequest(linkType, patchType, patchSymbol, patchOffset, relativeBase, referenceSymbol, referenceOffset);
         //LinkRequests.Add(linkRequest);
         patchSymbol.AddPatch(linkRequest);
     }
 }
Пример #12
0
        public void Link(LinkType linkType, PatchType patchType, string patchSymbolName, SectionKind patchKind, int patchOffset, int relativeBase, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            var patchObject = GetSymbol(patchSymbolName, patchKind);

            Link(linkType, patchType, patchObject, patchOffset, relativeBase, referenceSymbol, referenceOffset);
        }
Пример #13
0
        public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, SectionKind referenceKind, string referenceSymbolName, int referenceOffset)
        {
            var referenceObject = GetSymbol(referenceSymbolName, referenceKind);

            Link(linkType, patchType, patchSymbol, patchOffset, referenceObject, referenceOffset);
        }
Пример #14
0
 private static byte GetPatchTypeSize(PatchType patchType)
 {
     switch (patchType)
     {
         case PatchType.I4: return 32;
         case PatchType.I8: return 64;
         default:
             throw new CompilerException("unknown patch type: " + patchType.ToString());
     }
 }
Пример #15
0
        public void Link(LinkType linkType, PatchType patchType, LinkerSymbol patchSymbol, int patchOffset, SectionKind referenceKind, string referenceSymbolName, int referenceOffset)
        {
            var referenceObject = GetSymbol(referenceSymbolName, referenceKind);

            Link(linkType, patchType, patchSymbol, patchOffset, referenceObject, referenceOffset);
        }
Пример #16
0
        public void Link(LinkType linkType, PatchType patchType, SectionKind patchKind, string patchSymbolName, int patchOffset, LinkerSymbol referenceSymbol, int referenceOffset)
        {
            var patchObject = GetSymbol(patchSymbolName, patchKind);

            Link(linkType, patchType, patchObject, patchOffset, referenceSymbol, referenceOffset);
        }