diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2015-11-19 06:18:32 +0300 |
---|---|---|
committer | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2015-11-19 06:18:32 +0300 |
commit | c0a8fad0682ec9e0e8e8114507f940deca0658b0 (patch) | |
tree | 949d910aff3303b4a10a39c08e377e6675b9e505 /src/ILCompiler.Compiler | |
parent | d9d4f47e2f2cc1f50ad6e22d532d170a8c7489da (diff) | |
parent | d86875fe2a2d33db094c9828a1af84c78573e075 (diff) |
Merge pull request #332 from MichalStrehovsky/MDArrayRngChk2
Enable range check code in MDArray accessors
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r-- | src/ILCompiler.Compiler/src/IL/HelperExtensions.cs | 38 | ||||
-rw-r--r-- | src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/ILCompiler.Compiler/src/IL/HelperExtensions.cs b/src/ILCompiler.Compiler/src/IL/HelperExtensions.cs new file mode 100644 index 000000000..a16595f0b --- /dev/null +++ b/src/ILCompiler.Compiler/src/IL/HelperExtensions.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; + +using ILCompiler; +using Internal.TypeSystem; + +namespace Internal.IL +{ + static class HelperExtensions + { + public static MetadataType GetHelperType(this TypeSystemContext context, string name) + { + MetadataType helperType = ((CompilerTypeSystemContext)context).SystemModule.GetType("Internal.Runtime.CompilerHelpers", name, false); + if (helperType == null) + { + // TODO: throw the exception that means 'Core Library doesn't have a required thing in it' + throw new NotImplementedException(); + } + + return helperType; + } + + public static MethodDesc GetHelperEntryPoint(this TypeSystemContext context, string typeName, string methodName) + { + MetadataType helperType = context.GetHelperType(typeName); + MethodDesc helperMethod = helperType.GetMethod(methodName, null); + if (helperMethod == null) + { + // TODO: throw the exception that means 'Core Library doesn't have a required thing in it' + throw new NotImplementedException(); + } + + return helperMethod; + } + } +}
\ No newline at end of file diff --git a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj index 7213aa62e..01a1404fe 100644 --- a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj +++ b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj @@ -81,6 +81,7 @@ <Compile Include="Compiler\RvaFieldData.cs" /> <Compile Include="Compiler\IntrinsicMethods.cs" /> <Compile Include="CppCodeGen\CppWriter.cs" /> + <Compile Include="IL\HelperExtensions.cs" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Common\src\System\Collections\Generic\ArrayBuilder.cs"> |