Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5821 from dotnet/master
Browse files Browse the repository at this point in the history
Merge master to nmirror
  • Loading branch information
MichalStrehovsky authored May 18, 2018
2 parents 3a0d80e + 09437ab commit f563c36
Show file tree
Hide file tree
Showing 36 changed files with 1,069 additions and 585 deletions.
6 changes: 3 additions & 3 deletions dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<PropertyGroup>
<RyuJITVersion>2.2.0-preview1-26428-01</RyuJITVersion>
<ObjectWriterVersion>1.0.0-alpha-26412-0</ObjectWriterVersion>
<CoreFxVersion>4.5.0-preview3-26428-01</CoreFxVersion>
<CoreFxUapVersion>4.6.0-preview3-26428-01</CoreFxUapVersion>
<MicrosoftNETCoreNativeVersion>2.2.0-preview1-26428-01</MicrosoftNETCoreNativeVersion>
<CoreFxVersion>4.6.0-preview1-26517-01</CoreFxVersion>
<CoreFxUapVersion>4.7.0-preview1-26517-01</CoreFxUapVersion>
<MicrosoftNETCoreNativeVersion>2.2.0-preview1-26517-01</MicrosoftNETCoreNativeVersion>
<MicrosoftNETCoreAppPackageVersion>2.0.0</MicrosoftNETCoreAppPackageVersion>
<XunitNetcoreExtensionsVersion>1.0.1-prerelease-02104-02</XunitNetcoreExtensionsVersion>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/BuildIntegration/Microsoft.NETCore.Native.Unix.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ See the LICENSE file in the project root for more information.

<ItemGroup>
<NativeLibrary Include="$(IlcPath)/sdk/libSystem.Private.CoreLib.Native$(NativeLibraryExtension)" />
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)/sdk/libSystem.Private.TypeLoader.Native$(NativeLibraryExtension)" />
<NativeLibrary Include="$(IlcPath)/framework/System.Native$(NativeLibraryExtension)" />
<NativeLibrary Include="$(IlcPath)/framework/System.Globalization.Native$(NativeLibraryExtension)" />
<NativeLibrary Include="$(IlcPath)/framework/System.IO.Compression.Native$(NativeLibraryExtension)" />
Expand All @@ -73,7 +74,7 @@ See the LICENSE file in the project root for more information.
<ItemGroup Condition="'$(TargetOS)' == 'OSX'">
<NativeFramework Include="CoreFoundation" />
<NativeFramework Include="Security" />
<NativeFramework Include="gss" />
<NativeFramework Include="GSS" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ See the LICENSE file in the project root for more information.
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) == ''" Include="$(IlcPath)\sdk\bootstrapper.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)\sdk\bootstrapperdll.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\$(FullRuntimeName).lib" />
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\System.Private.TypeLoader.Native.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
Expand Down
1 change: 1 addition & 0 deletions src/BuildIntegration/Microsoft.NETCore.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ See the LICENSE file in the project root for more information.
<IlcArg Condition="$(ExportsFile) != ''" Include="--exportsfile:$(ExportsFile)" />
<ILcArg Condition="'$(Platform)' == 'wasm'" Include="--wasm" />
<IlcArg Include="@(AutoInitializedAssemblies->'--initassembly:%(Identity)')" />
<IlcArg Include="@(AppContextSwitchOverrides->'--appcontextswitch:%(Identity)')" />
</ItemGroup>

<MakeDir Directories="$(NativeIntermediateOutputPath)" />
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/Framework.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<PropertyGroup>
<NuGetTargetMoniker>.NETCoreApp,Version=v2.1</NuGetTargetMoniker>
<TargetFramework>netcoreapp2.1</TargetFramework>
<NuGetTargetMoniker>.NETCoreApp,Version=v2.2</NuGetTargetMoniker>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifiers>$(NuPkgRid)</RuntimeIdentifiers>
<RidSpecificAssets>true</RidSpecificAssets>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Internal.TypeSystem;

using Debug = System.Diagnostics.Debug;

namespace Internal.IL.Stubs.StartupCode
{
partial class AppContextInitializerMethod
{
protected override int ClassCode => 15749517;

protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
// Should be a singleton
Debug.Assert(this == other);
return 0;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;

using Internal.TypeSystem;

namespace Internal.IL.Stubs.StartupCode
{
public sealed partial class AppContextInitializerMethod : ILStubMethod
{
private TypeDesc _owningType;
private MethodSignature _signature;
private IReadOnlyCollection<string> _switches;

public AppContextInitializerMethod(TypeDesc owningType, IEnumerable<string> switches)
{
_owningType = owningType;
_switches = new List<string>(switches);
}

public override TypeSystemContext Context
{
get
{
return _owningType.Context;
}
}

public override TypeDesc OwningType
{
get
{
return _owningType;
}
}

public override string Name
{
get
{
return "SetAppContextSwitches";
}
}

public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
ILCodeStream codeStream = emitter.NewCodeStream();

MetadataType appContextType = Context.SystemModule.GetKnownType("System", "AppContext");
MethodDesc setSwitchMethod = appContextType.GetKnownMethod("SetSwitch", null);
ILToken setSwitchToken = emitter.NewToken(setSwitchMethod);

foreach (string switchName in _switches)
{
codeStream.Emit(ILOpcode.ldstr, emitter.NewToken(switchName));
codeStream.EmitLdc(1);
codeStream.Emit(ILOpcode.call, setSwitchToken);
}

codeStream.Emit(ILOpcode.ret);

return emitter.Link(this);
}

public override MethodSignature Signature
{
get
{
if (_signature == null)
{
_signature = new MethodSignature(MethodSignatureFlags.Static, 0,
Context.GetWellKnownType(WellKnownType.Void),
TypeDesc.EmptyTypes);
}

return _signature;
}
}
}
}
2 changes: 2 additions & 0 deletions src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@
<Compile Include="Compiler\WindowsNodeMangler.cs" />
<Compile Include="IL\ILImporter.Scanner.cs" />
<Compile Include="IL\Stubs\PInvokeILProvider.cs" />
<Compile Include="IL\Stubs\StartupCode\AppContextInitializerMethod.cs" />
<Compile Include="IL\Stubs\StartupCode\AppContextInitializerMethod.Sorting.cs" />
<Compile Include="IL\Stubs\StartupCode\StartupCodeMainMethod.cs" />
<Compile Include="IL\Stubs\StartupCode\StartupCodeMainMethod.Sorting.cs" />
<Compile Include="IL\Stubs\StartupCode\NativeLibraryStartupMethod.cs" />
Expand Down
18 changes: 13 additions & 5 deletions src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public LLVMValueRef ValueForStackKind(StackValueKind kind, LLVMBuilderRef builde
else if (kind == StackValueKind.Int64)
return ValueAsInt64(builder, signExtend);
else if (kind == StackValueKind.Float)
return ValueAsType(LLVM.FloatType(), builder);
return ValueAsType(LLVM.DoubleType(), builder);
else if (kind == StackValueKind.NativeInt || kind == StackValueKind.ByRef || kind == StackValueKind.ObjRef)
return ValueAsInt32(builder, false);
else
Expand Down Expand Up @@ -433,7 +433,7 @@ public override StackEntry Duplicate(LLVMBuilderRef builder)
protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend)
{
//TODO: deal with sign extension here
return ILImporter.CastIfNecessary(builder, RawLLVMValue, type);
return ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name);
}
}

Expand All @@ -456,7 +456,7 @@ public override StackEntry Duplicate(LLVMBuilderRef builder)

protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend)
{
return ILImporter.LoadValue(builder, RawLLVMValue, Type, type, signExtend);
return ILImporter.LoadValue(builder, RawLLVMValue, Type, type, signExtend, $"Load{Name}");
}
}

Expand All @@ -479,7 +479,7 @@ public override StackEntry Duplicate(LLVMBuilderRef builder)

protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend)
{
return ILImporter.CastIfNecessary(builder, RawLLVMValue, type);
return ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name);
}
}

Expand Down Expand Up @@ -529,7 +529,7 @@ protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilde
if (RawLLVMValue.Pointer == IntPtr.Zero)
throw new NullReferenceException();

return ILImporter.CastIfNecessary(builder, RawLLVMValue, type);
return ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name);
}
}

Expand Down Expand Up @@ -581,4 +581,12 @@ public override StackEntry Duplicate(LLVMBuilderRef builder)
return new SpilledExpressionEntry(Kind, Name, Type, LocalIndex, _importer);
}
}

internal static class StackEntryExtensions
{
public static string Name(this StackEntry entry)
{
return (entry as ExpressionEntry)?.Name;
}
}
}
Loading

0 comments on commit f563c36

Please sign in to comment.