Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 0972f5d

Browse files
committed
Made System.Linq.Expressions and System.Dynamic.Runtime conditionally buildable in Interpreter mode
To build in interpreting mode, compile with /p:IsInterpreting=true In particular building System.Linq.Expressions.Tests with /p:IsInterpreting /t:BuildAndTest will build the library in interpreting mode and will run tests on it. Currently all System.Linq.Expressions.Tests tests are passing. System.Dynamic.Runtime needs some fixing though.
1 parent 568b7d7 commit 0972f5d

File tree

5 files changed

+141
-53
lines changed

5 files changed

+141
-53
lines changed

src/Common/src/System/Dynamic/Utils/DelegateHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using System.Runtime.CompilerServices;
1111
using System.Reflection;
1212

13-
#if FEATURE_REFEMIT
13+
#if !FEATURE_DYNAMIC_DELEGATE
1414
using System.Reflection.Emit;
1515
#endif
1616

@@ -29,15 +29,15 @@ internal static partial class DelegateHelpers
2929

3030
internal static Delegate CreateObjectArrayDelegate(Type delegateType, System.Func<object[], object> handler)
3131
{
32-
#if FEATURE_REFEMIT
32+
#if !FEATURE_DYNAMIC_DELEGATE
3333
return CreateObjectArrayDelegateRefEmit(delegateType, handler);
3434
#else
3535
return Internal.Runtime.Augments.DynamicDelegateAugments.CreateObjectArrayDelegate(delegateType, handler);
3636
#endif
3737
}
3838

3939

40-
#if FEATURE_REFEMIT
40+
#if !FEATURE_DYNAMIC_DELEGATE
4141

4242
// We will generate the following code:
4343
//
@@ -157,7 +157,7 @@ private static Type ConvertToBoxableType(Type t)
157157
return (t.IsPointer) ? typeof(IntPtr) : t;
158158
}
159159

160-
#endif // FEATURE_REFEMIT
160+
#endif
161161

162162
}
163163
}

src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<ProjectGuid>{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AssemblyName>System.Dynamic.Runtime</AssemblyName>
10-
<AssemblyVersion>4.0.10.0</AssemblyVersion>
11-
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
1210
<RootNamespace>System.Dynamic.Runtime</RootNamespace>
11+
<AssemblyVersion>4.0.10.0</AssemblyVersion>
12+
<DefineConstants Condition=" '$(IsInterpreting)' != 'true' " >$(DefineConstants);FEATURE_CORECLR</DefineConstants>
1313
</PropertyGroup>
1414
<!-- Default configurations to help VS understand the configurations -->
1515
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -71,12 +71,6 @@
7171
<Compile Include="$(CommonPath)\System\Runtime\CompilerServices\TrueReadOnlyCollection.cs">
7272
<Link>Common\System\Runtime\CompilerServices\TrueReadOnlyCollection.cs</Link>
7373
</Compile>
74-
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CollectionExtensions.Map.cs">
75-
<Link>Common\System\Dynamic\Utils\CollectionExtensions.Map.cs</Link>
76-
</Compile>
77-
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\AssemblyGen.cs">
78-
<Link>Common\System\Linq\Expressions\Compiler\AssemblyGen.cs</Link>
79-
</Compile>
8074
</ItemGroup>
8175
<ItemGroup>
8276
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -119,8 +113,22 @@
119113
<Compile Include="System\Runtime\CompilerServices\RuleCache.cs" />
120114
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.cs" />
121115
</ItemGroup>
122-
<ItemGroup>
116+
<ItemGroup Condition=" '$(IsInterpreting)' != 'true' ">
117+
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CollectionExtensions.Map.cs">
118+
<Link>Common\System\Dynamic\Utils\CollectionExtensions.Map.cs</Link>
119+
</Compile>
120+
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\AssemblyGen.cs">
121+
<Link>Common\System\Linq\Expressions\Compiler\AssemblyGen.cs</Link>
122+
</Compile>
123+
123124
<None Include="project.json" />
124125
</ItemGroup>
126+
<ItemGroup Condition=" '$(IsInterpreting)' == 'true' ">
127+
<Compile Include="$(CommonPath)\System\Dynamic\Utils\DelegateHelpers.cs">
128+
<Link>Common\System\Dynamic\Utils\DelegateHelpers.cs</Link>
129+
</Compile>
130+
131+
<None Include="projectInterpreting.json" />
132+
</ItemGroup>
125133
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
126134
</Project>

src/System.Dynamic.Runtime/src/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"System.Reflection": "4.0.10-beta-*",
1313
"System.Reflection.Emit": "4.0.0-beta-*",
1414
"System.Reflection.Emit.ILGeneration": "4.0.0-beta-*",
15+
"System.Reflection.Emit.Lightweight": "4.0.0-beta-*",
1516
"System.Reflection.Primitives": "4.0.0-beta-*",
1617
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
1718
"System.Resources.ResourceManager": "4.0.0-beta-*",

src/System.Dynamic.Runtime/src/project.lock.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@
172172
"lib/DNXCore50/System.Reflection.Emit.ILGeneration.dll"
173173
]
174174
},
175+
"System.Reflection.Emit.Lightweight/4.0.0-beta-23008": {
176+
"dependencies": {
177+
"System.Reflection": "4.0.0-beta-23008",
178+
"System.Reflection.Primitives": "4.0.0-beta-23008",
179+
"System.Runtime": "4.0.0-beta-23008",
180+
"System.Reflection.Emit.ILGeneration": "4.0.0-beta-23008"
181+
},
182+
"compile": [
183+
"ref/any/System.Reflection.Emit.Lightweight.dll"
184+
],
185+
"runtime": [
186+
"lib/DNXCore50/System.Reflection.Emit.Lightweight.dll"
187+
]
188+
},
175189
"System.Reflection.Extensions/4.0.0-beta-23008": {
176190
"dependencies": {
177191
"System.Runtime": "4.0.0-beta-23008",
@@ -461,6 +475,19 @@
461475
"ref/net45/_._"
462476
]
463477
},
478+
"System.Reflection.Emit.Lightweight/4.0.0-beta-23008": {
479+
"sha512": "A+ftyIU9ZtHd9FC74eZNuT7UJynSR50noEmVAhuDKn0a0CFlEznEO9u34qPD4egQFZ2FMfCqhGzQ/gvO/V18xg==",
480+
"files": [
481+
"System.Reflection.Emit.Lightweight.4.0.0-beta-23008.nupkg",
482+
"System.Reflection.Emit.Lightweight.4.0.0-beta-23008.nupkg.sha512",
483+
"System.Reflection.Emit.Lightweight.nuspec",
484+
"lib/DNXCore50/System.Reflection.Emit.Lightweight.dll",
485+
"lib/net45/_._",
486+
"lib/netcore50/System.Reflection.Emit.Lightweight.dll",
487+
"ref/any/System.Reflection.Emit.Lightweight.dll",
488+
"ref/net45/_._"
489+
]
490+
},
464491
"System.Reflection.Extensions/4.0.0-beta-23008": {
465492
"sha512": "btrHhR/58LNjwl0OTjWKj4+gYffoNcl/E5V+x1piHFNIvnf7EzLwTkhJ74QnqlycICHz3ZqHmdUT3OsfmcPRSA==",
466493
"files": [
@@ -608,6 +635,7 @@
608635
"System.Reflection >= 4.0.10-beta-*",
609636
"System.Reflection.Emit >= 4.0.0-beta-*",
610637
"System.Reflection.Emit.ILGeneration >= 4.0.0-beta-*",
638+
"System.Reflection.Emit.Lightweight >= 4.0.0-beta-*",
611639
"System.Reflection.Primitives >= 4.0.0-beta-*",
612640
"System.Reflection.TypeExtensions >= 4.0.0-beta-*",
613641
"System.Resources.ResourceManager >= 4.0.0-beta-*",

src/System.Linq.Expressions/src/System.Linq.Expressions.csproj

Lines changed: 91 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AssemblyName>System.Linq.Expressions</AssemblyName>
1010
<RootNamespace>System.Linq.Expressions</RootNamespace>
1111
<AssemblyVersion>4.0.10.0</AssemblyVersion>
12-
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
12+
<DefineConstants Condition=" '$(IsInterpreting)' != 'true' ">$(DefineConstants);FEATURE_CORECLR</DefineConstants>
1313
</PropertyGroup>
1414
<!-- Default configurations to help VS understand the configurations -->
1515
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -20,9 +20,6 @@
2020
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CacheDict.cs">
2121
<Link>Common\System\Dynamic\Utils\CacheDict.cs</Link>
2222
</Compile>
23-
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CollectionExtensions.AddFirst.cs">
24-
<Link>Common\System\Dynamic\Utils\CollectionExtensions.AddFirst.cs</Link>
25-
</Compile>
2623
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CollectionExtensions.cs">
2724
<Link>Common\System\Dynamic\Utils\CollectionExtensions.cs</Link>
2825
</Compile>
@@ -32,9 +29,6 @@
3229
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.cs">
3330
<Link>Common\System\Dynamic\Utils\ContractUtils.cs</Link>
3431
</Compile>
35-
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs">
36-
<Link>Common\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs</Link>
37-
</Compile>
3832
<Compile Include="$(CommonPath)\System\Dynamic\Utils\EmptyReadOnlyCollection.cs">
3933
<Link>Common\System\Dynamic\Utils\EmptyReadOnlyCollection.cs</Link>
4034
</Compile>
@@ -59,9 +53,6 @@
5953
<Compile Include="$(CommonPath)\System\Dynamic\Utils\TypeUtils.cs">
6054
<Link>Common\System\Dynamic\Utils\TypeUtils.cs</Link>
6155
</Compile>
62-
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\AssemblyGen.cs">
63-
<Link>Common\System\Linq\Expressions\Compiler\AssemblyGen.cs</Link>
64-
</Compile>
6556
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\DelegateHelpers.cs">
6657
<Link>Common\System\Linq\Expressions\Compiler\DelegateHelpers.cs</Link>
6758
</Compile>
@@ -78,38 +69,14 @@
7869
<Link>Common\System\Runtime\CompilerServices\TrueReadOnlyCollection.cs</Link>
7970
</Compile>
8071
<Compile Include="System\Dynamic\Utils\CollectionExtensions.cs" />
81-
<Compile Include="System\Dynamic\Utils\Helpers.cs" />
82-
<Compile Include="System\Dynamic\Utils\ReferenceEqualityComparer.cs" />
72+
8373
<Compile Include="System\Dynamic\Utils\TypeExtensions.cs" />
8474
<Compile Include="System\Dynamic\Utils\TypeUtils.cs" />
75+
8576
<Compile Include="System\Linq\Expressions\BinaryExpression.cs" />
8677
<Compile Include="System\Linq\Expressions\BlockExpression.cs" />
8778
<Compile Include="System\Linq\Expressions\CatchBlock.cs" />
88-
<Compile Include="System\Linq\Expressions\Compiler\AnalyzedTree.cs" />
89-
<Compile Include="System\Linq\Expressions\Compiler\BoundConstants.cs" />
90-
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.cs" />
91-
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.Storage.cs" />
92-
<Compile Include="System\Linq\Expressions\Compiler\ConstantCheck.cs" />
93-
<Compile Include="System\Linq\Expressions\Compiler\DelegateHelpers.Generated.cs" />
94-
<Compile Include="System\Linq\Expressions\Compiler\HoistedLocals.cs" />
95-
<Compile Include="System\Linq\Expressions\Compiler\ILGen.cs" />
96-
<Compile Include="System\Linq\Expressions\Compiler\KeyedQueue.cs" />
97-
<Compile Include="System\Linq\Expressions\Compiler\LabelInfo.cs" />
98-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs" />
99-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs" />
100-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.ControlFlow.cs" />
101-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.cs" />
102-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Expressions.cs" />
103-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Generated.cs" />
104-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Lambda.cs" />
105-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Logical.cs" />
106-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Statements.cs" />
107-
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Unary.cs" />
108-
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Bindings.cs" />
109-
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.cs" />
110-
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Generated.cs" />
111-
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Temps.cs" />
112-
<Compile Include="System\Linq\Expressions\Compiler\VariableBinder.cs" />
79+
11380
<Compile Include="System\Linq\Expressions\ConditionalExpression.cs" />
11481
<Compile Include="System\Linq\Expressions\ConstantExpression.cs" />
11582
<Compile Include="System\Linq\Expressions\DebugInfoExpression.cs" />
@@ -152,13 +119,97 @@
152119
<Compile Include="System\Linq\Expressions\TypeBinaryExpression.cs" />
153120
<Compile Include="System\Linq\Expressions\UnaryExpression.cs" />
154121
<Compile Include="System\Linq\IQueryable.cs" />
155-
<Compile Include="System\Runtime\CompilerServices\Closure.cs" />
122+
156123
<Compile Include="System\Runtime\CompilerServices\IRuntimeVariables.cs" />
124+
<None Include="project.json"/>
125+
</ItemGroup>
126+
127+
<ItemGroup Condition=" '$(IsInterpreting)' != 'true' ">
128+
<Compile Include="$(CommonPath)\System\Dynamic\Utils\CollectionExtensions.AddFirst.cs">
129+
<Link>Common\System\Dynamic\Utils\CollectionExtensions.AddFirst.cs</Link>
130+
</Compile>
131+
<Compile Include="$(CommonPath)\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs">
132+
<Link>Common\System\Dynamic\Utils\ContractUtils.RequiresArrayRange.cs</Link>
133+
</Compile>
134+
<Compile Include="$(CommonPath)\System\Linq\Expressions\Compiler\AssemblyGen.cs">
135+
<Link>Common\System\Linq\Expressions\Compiler\AssemblyGen.cs</Link>
136+
</Compile>
137+
138+
<Compile Include="System\Dynamic\Utils\Helpers.cs" />
139+
<Compile Include="System\Dynamic\Utils\ReferenceEqualityComparer.cs" />
140+
141+
<Compile Include="System\Linq\Expressions\Compiler\AnalyzedTree.cs" />
142+
<Compile Include="System\Linq\Expressions\Compiler\BoundConstants.cs" />
143+
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.cs" />
144+
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.Storage.cs" />
145+
<Compile Include="System\Linq\Expressions\Compiler\ConstantCheck.cs" />
146+
<Compile Include="System\Linq\Expressions\Compiler\DelegateHelpers.Generated.cs" />
147+
<Compile Include="System\Linq\Expressions\Compiler\HoistedLocals.cs" />
148+
<Compile Include="System\Linq\Expressions\Compiler\ILGen.cs" />
149+
<Compile Include="System\Linq\Expressions\Compiler\KeyedQueue.cs" />
150+
<Compile Include="System\Linq\Expressions\Compiler\LabelInfo.cs" />
151+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs" />
152+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs" />
153+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.ControlFlow.cs" />
154+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.cs" />
155+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Expressions.cs" />
156+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Generated.cs" />
157+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Lambda.cs" />
158+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Logical.cs" />
159+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Statements.cs" />
160+
<Compile Include="System\Linq\Expressions\Compiler\LambdaCompiler.Unary.cs" />
161+
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Bindings.cs" />
162+
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.cs" />
163+
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Generated.cs" />
164+
<Compile Include="System\Linq\Expressions\Compiler\StackSpiller.Temps.cs" />
165+
<Compile Include="System\Linq\Expressions\Compiler\VariableBinder.cs" />
166+
167+
<Compile Include="System\Runtime\CompilerServices\Closure.cs" />
168+
157169
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.ExpressionQuoter.cs" />
158170
<Compile Include="System\Runtime\CompilerServices\RuntimeOps.RuntimeVariableList.cs" />
159171
</ItemGroup>
160-
<ItemGroup>
161-
<None Include="project.json" />
172+
173+
<ItemGroup Condition=" '$(IsInterpreting)' == 'true' ">
174+
<Compile Include="$(CommonPath)\System\Dynamic\Utils\DelegateHelpers.cs">
175+
<Link>Common\System\Dynamic\Utils\DelegateHelpers.cs</Link>
176+
</Compile>
177+
178+
<Compile Include="System\Linq\Expressions\Compiler\DelegateHelpers.Generated.cs" />
179+
180+
<Compile Include="System\Linq\Expressions\Interpreter\AddInstruction.cs" />
181+
<Compile Include="System\Linq\Expressions\Interpreter\ArrayOperations.cs" />
182+
<Compile Include="System\Linq\Expressions\Interpreter\BranchLabel.cs" />
183+
<Compile Include="System\Linq\Expressions\Interpreter\CallInstruction.cs" />
184+
<Compile Include="System\Linq\Expressions\Interpreter\CallInstruction.Generated.cs" />
185+
<Compile Include="System\Linq\Expressions\Interpreter\ConstantCheck.cs" />
186+
<Compile Include="System\Linq\Expressions\Interpreter\ControlFlowInstructions.cs" />
187+
<Compile Include="System\Linq\Expressions\Interpreter\DivInstruction.cs" />
188+
<Compile Include="System\Linq\Expressions\Interpreter\EqualInstruction.cs" />
189+
<Compile Include="System\Linq\Expressions\Interpreter\FieldOperations.cs" />
190+
<Compile Include="System\Linq\Expressions\Interpreter\GreaterThanInstruction.cs" />
191+
<Compile Include="System\Linq\Expressions\Interpreter\ILightCallSiteBinder.cs" />
192+
<Compile Include="System\Linq\Expressions\Interpreter\Instruction.cs" />
193+
<Compile Include="System\Linq\Expressions\Interpreter\InstructionList.cs" />
194+
<Compile Include="System\Linq\Expressions\Interpreter\InterpretedFrame.cs" />
195+
<Compile Include="System\Linq\Expressions\Interpreter\Interpreter.cs" />
196+
<Compile Include="System\Linq\Expressions\Interpreter\LabelInfo.cs" />
197+
<Compile Include="System\Linq\Expressions\Interpreter\LessThanInstruction.cs" />
198+
<Compile Include="System\Linq\Expressions\Interpreter\LightCompiler.cs" />
199+
<Compile Include="System\Linq\Expressions\Interpreter\LightDelegateCreator.cs" />
200+
<Compile Include="System\Linq\Expressions\Interpreter\LightLambda.cs" />
201+
<Compile Include="System\Linq\Expressions\Interpreter\LightLambda.Generated.cs" />
202+
<Compile Include="System\Linq\Expressions\Interpreter\LocalAccess.cs" />
203+
<Compile Include="System\Linq\Expressions\Interpreter\LocalVariables.cs" />
204+
<Compile Include="System\Linq\Expressions\Interpreter\MulInstruction.cs" />
205+
<Compile Include="System\Linq\Expressions\Interpreter\NotEqualInstruction.cs" />
206+
<Compile Include="System\Linq\Expressions\Interpreter\NumericConvertInstruction.cs" />
207+
<Compile Include="System\Linq\Expressions\Interpreter\RuntimeVariables.cs" />
208+
<Compile Include="System\Linq\Expressions\Interpreter\StackOperations.cs" />
209+
<Compile Include="System\Linq\Expressions\Interpreter\SubInstruction.cs" />
210+
<Compile Include="System\Linq\Expressions\Interpreter\TypeOperations.cs" />
211+
<Compile Include="System\Linq\Expressions\Interpreter\Utilities.cs" />
162212
</ItemGroup>
213+
163214
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
164215
</Project>

0 commit comments

Comments
 (0)