Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-09-04 17:27:19 +0300
committerGitHub <noreply@github.com>2018-09-04 17:27:19 +0300
commit473e0dba00cfd48390aea31d39b2d8072d487b9e (patch)
tree5a31fb3c391712168a5f3a510ebedbbf0c4b8d46
parent1d14948ca581d45004da0cdcf85fb40241a94c29 (diff)
parent1bffabd1e376a0ea9ded9f3c6bf7cb375895756f (diff)
Merge pull request #6289 from dotnet/master
Merge master to nmirror
-rw-r--r--dependencies.props8
-rw-r--r--samples/MonoGame/NeonShooter.csproj4
-rw-r--r--samples/MonoGame/Platformer2D.csproj4
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs17
-rw-r--r--src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs65
-rw-r--r--src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs24
-rw-r--r--src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs12
-rw-r--r--src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems8
-rw-r--r--src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs25
-rw-r--r--src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs35
-rw-r--r--src/System.Private.CoreLib/shared/System/String.Searching.cs2
-rw-r--r--src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.Windows.cs24
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs21
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs26
-rw-r--r--tests/src/Simple/HelloWasm/Program.cs16
15 files changed, 197 insertions, 94 deletions
diff --git a/dependencies.props b/dependencies.props
index b88fe60e8..b78843d3a 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -1,10 +1,10 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
- <RyuJITVersion>3.0.0-preview1-26802-02</RyuJITVersion>
+ <RyuJITVersion>3.0.0-preview1-26831-01</RyuJITVersion>
<ObjectWriterVersion>1.0.0-alpha-26412-0</ObjectWriterVersion>
- <CoreFxVersion>4.6.0-preview1-26625-01</CoreFxVersion>
- <CoreFxUapVersion>4.7.0-preview1-26625-01</CoreFxUapVersion>
- <MicrosoftNETCoreNativeVersion>3.0.0-preview1-26702-01</MicrosoftNETCoreNativeVersion>
+ <CoreFxVersion>4.6.0-preview1-26831-01</CoreFxVersion>
+ <CoreFxUapVersion>4.7.0-preview1-26831-01</CoreFxUapVersion>
+ <MicrosoftNETCoreNativeVersion>3.0.0-preview1-26831-01</MicrosoftNETCoreNativeVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.0</MicrosoftNETCoreAppPackageVersion>
<XunitNetcoreExtensionsVersion>1.0.1-prerelease-02104-02</XunitNetcoreExtensionsVersion>
</PropertyGroup>
diff --git a/samples/MonoGame/NeonShooter.csproj b/samples/MonoGame/NeonShooter.csproj
index 44f0ef31b..b50cad3b0 100644
--- a/samples/MonoGame/NeonShooter.csproj
+++ b/samples/MonoGame/NeonShooter.csproj
@@ -85,8 +85,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
- <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.1" />
- <PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.3" />
+ <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
+ <PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
</ItemGroup>
</Project>
diff --git a/samples/MonoGame/Platformer2D.csproj b/samples/MonoGame/Platformer2D.csproj
index 767f2ad86..3dfec0cbf 100644
--- a/samples/MonoGame/Platformer2D.csproj
+++ b/samples/MonoGame/Platformer2D.csproj
@@ -64,8 +64,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
- <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.1" />
- <PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.3" />
+ <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
+ <PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
</ItemGroup>
</Project>
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
index 5dd76b0fe..2701adb4b 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
@@ -1562,6 +1562,23 @@ namespace Internal.IL
return true;
}
break;
+ case ".ctor":
+ if (metadataType.IsByReferenceOfT)
+ {
+ StackEntry byRefValueParamHolder = _stack.Pop();
+
+ // Allocate a slot on the shadow stack for the ByReference type
+ int spillIndex = _spilledExpressions.Count;
+ SpilledExpressionEntry spillEntry = new SpilledExpressionEntry(StackValueKind.ByRef, "byref" + _currentOffset, metadataType, spillIndex, this);
+ _spilledExpressions.Add(spillEntry);
+ LLVMValueRef addrOfValueType = LoadVarAddress(spillIndex, LocalVarKind.Temp, out TypeDesc unused);
+ var typedAddress = CastIfNecessary(_builder, addrOfValueType, LLVM.PointerType(LLVM.Int32Type(), 0));
+ LLVM.BuildStore(_builder, byRefValueParamHolder.ValueForStackKind(StackValueKind.ByRef, _builder, false), typedAddress);
+
+ _stack.Push(spillEntry);
+ return true;
+ }
+ break;
}
return false;
diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs
new file mode 100644
index 000000000..bdb89702f
--- /dev/null
+++ b/src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs
@@ -0,0 +1,65 @@
+// 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.
+
+internal partial class Interop
+{
+ internal partial class Advapi32
+ {
+ internal static class RegistryOptions
+ {
+ internal const int REG_OPTION_NON_VOLATILE = 0x0000; // (default) keys are persisted beyond reboot/unload
+ internal const int REG_OPTION_VOLATILE = 0x0001; // All keys created by the function are volatile
+ internal const int REG_OPTION_CREATE_LINK = 0x0002; // They key is a symbolic link
+ internal const int REG_OPTION_BACKUP_RESTORE = 0x0004; // Use SE_BACKUP_NAME process special privileges
+ }
+
+ internal static class RegistryView
+ {
+ internal const int KEY_WOW64_64KEY = 0x0100;
+ internal const int KEY_WOW64_32KEY = 0x0200;
+ }
+
+ internal static class RegistryOperations
+ {
+ internal const int KEY_QUERY_VALUE = 0x0001;
+ internal const int KEY_SET_VALUE = 0x0002;
+ internal const int KEY_CREATE_SUB_KEY = 0x0004;
+ internal const int KEY_ENUMERATE_SUB_KEYS = 0x0008;
+ internal const int KEY_NOTIFY = 0x0010;
+ internal const int KEY_CREATE_LINK = 0x0020;
+ internal const int KEY_READ = ((STANDARD_RIGHTS_READ |
+ KEY_QUERY_VALUE |
+ KEY_ENUMERATE_SUB_KEYS |
+ KEY_NOTIFY)
+ &
+ (~SYNCHRONIZE));
+
+ internal const int KEY_WRITE = ((STANDARD_RIGHTS_WRITE |
+ KEY_SET_VALUE |
+ KEY_CREATE_SUB_KEY)
+ &
+ (~SYNCHRONIZE));
+
+ internal const int SYNCHRONIZE = 0x00100000;
+ internal const int READ_CONTROL = 0x00020000;
+ internal const int STANDARD_RIGHTS_READ = READ_CONTROL;
+ internal const int STANDARD_RIGHTS_WRITE = READ_CONTROL;
+ }
+
+ internal static class RegistryValues
+ {
+ internal const int REG_NONE = 0; // No value type
+ internal const int REG_SZ = 1; // Unicode nul terminated string
+ internal const int REG_EXPAND_SZ = 2; // Unicode nul terminated string
+ // (with environment variable references)
+ internal const int REG_BINARY = 3; // Free form binary
+ internal const int REG_DWORD = 4; // 32-bit number
+ internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
+ internal const int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
+ internal const int REG_LINK = 6; // Symbolic Link (Unicode)
+ internal const int REG_MULTI_SZ = 7; // Multiple Unicode strings
+ internal const int REG_QWORD = 11; // 64-bit number
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs
deleted file mode 100644
index 3c02c4976..000000000
--- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.RegistryValues.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal partial class RegistryValues
- {
- internal const int REG_NONE = 0; // No value type
- internal const int REG_SZ = 1; // Unicode nul terminated string
- internal const int REG_EXPAND_SZ = 2; // Unicode nul terminated string
- // (with environment variable references)
- internal const int REG_BINARY = 3; // Free form binary
- internal const int REG_DWORD = 4; // 32-bit number
- internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
- internal const int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
- internal const int REG_LINK = 6; // Symbolic Link (Unicode)
- internal const int REG_MULTI_SZ = 7; // Multiple Unicode strings
- internal const int REG_QWORD = 11; // 64-bit number
- }
- }
-}
diff --git a/src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs b/src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs
index 5395abe06..bc6efcc06 100644
--- a/src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs
+++ b/src/System.Private.CoreLib/shared/Microsoft/Win32/RegistryValueKind.cs
@@ -11,12 +11,12 @@ namespace Microsoft.Win32
#endif
enum RegistryValueKind
{
- String = Interop.Kernel32.RegistryValues.REG_SZ,
- ExpandString = Interop.Kernel32.RegistryValues.REG_EXPAND_SZ,
- Binary = Interop.Kernel32.RegistryValues.REG_BINARY,
- DWord = Interop.Kernel32.RegistryValues.REG_DWORD,
- MultiString = Interop.Kernel32.RegistryValues.REG_MULTI_SZ,
- QWord = Interop.Kernel32.RegistryValues.REG_QWORD,
+ String = Interop.Advapi32.RegistryValues.REG_SZ,
+ ExpandString = Interop.Advapi32.RegistryValues.REG_EXPAND_SZ,
+ Binary = Interop.Advapi32.RegistryValues.REG_BINARY,
+ DWord = Interop.Advapi32.RegistryValues.REG_DWORD,
+ MultiString = Interop.Advapi32.RegistryValues.REG_MULTI_SZ,
+ QWord = Interop.Advapi32.RegistryValues.REG_QWORD,
Unknown = 0, // REG_NONE is defined as zero but BCL
None = unchecked((int)0xFFFFFFFF), // mistakenly overrode this value.
} // Now instead of using Interop.Kernel32.RegistryValues.REG_NONE we use "-1".
diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
index ef48dc6c9..b2db71d75 100644
--- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
+++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
@@ -761,8 +761,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.OutputDebugString.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryValues.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SecurityOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SetEndOfFile.cs" />
@@ -782,8 +780,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Internal\IO\File.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFindHandle.Windows.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryValueKind.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
@@ -806,10 +802,14 @@
</ItemGroup>
<ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\NtQueryInformationFile.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Advapi32\Interop.RegistryConstants.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.RegistryView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\Registry.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryHive.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryValueKind.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\RegistryView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeRegistryHandle.Windows.cs" />
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs
index 21c2ea0ab..36b363fa3 100644
--- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs
+++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs
@@ -883,25 +883,18 @@ namespace System.Diagnostics.Tracing
{
if (data is System.Enum)
{
- Type underlyingType = Enum.GetUnderlyingType(data.GetType());
- if (underlyingType == typeof(int))
+ try
{
-#if !ES_BUILD_PCL
- data = ((IConvertible)data).ToInt32(null);
-#else
- data = (int)data;
-#endif
- goto Again;
- }
- else if (underlyingType == typeof(long))
- {
-#if !ES_BUILD_PCL
- data = ((IConvertible)data).ToInt64(null);
-#else
- data = (long)data;
-#endif
+ Type underlyingType = Enum.GetUnderlyingType(data.GetType());
+ if (underlyingType == typeof(ulong))
+ data = (ulong)data;
+ else if (underlyingType == typeof(long))
+ data = (long)data;
+ else
+ data = (int)Convert.ToInt64(data); // This handles all int/uint or below (we treat them like 32 bit ints)
goto Again;
}
+ catch { } // On wierd cases (e.g. enums of type double), give up and for compat simply tostring.
}
// To our eyes, everything else is a just a string
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
index 9784a34d9..1f8c0b06a 100644
--- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
+++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
@@ -1785,10 +1785,16 @@ namespace System.Diagnostics.Tracing
if (dataType.IsEnum())
{
dataType = Enum.GetUnderlyingType(dataType);
+#if ES_BUILD_PN
+ int dataTypeSize = (int)dataType.TypeHandle.ToEETypePtr().ValueTypeSize;
+#else
+ int dataTypeSize = System.Runtime.InteropServices.Marshal.SizeOf(dataType);
+#endif
+ if (dataTypeSize < sizeof(int))
+ dataType = typeof(int);
goto Again;
}
-
// Everything else is marshaled as a string.
// ETW strings are NULL-terminated, so marshal everything up to the first
// null in the string.
@@ -1799,7 +1805,6 @@ namespace System.Diagnostics.Tracing
}
return new string((char *)dataPointer);
-
}
finally
{
@@ -5569,29 +5574,38 @@ namespace System.Diagnostics.Tracing
// write out each enum value
FieldInfo[] staticFields = enumType.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static);
+ bool anyValuesWritten = false;
foreach (FieldInfo staticField in staticFields)
{
object constantValObj = staticField.GetRawConstantValue();
+
if (constantValObj != null)
{
- long hexValue;
- if (constantValObj is int)
- hexValue = ((int)constantValObj);
- else if (constantValObj is long)
- hexValue = ((long)constantValObj);
- else
- continue;
+ ulong hexValue;
+ if (constantValObj is ulong)
+ hexValue = (ulong)constantValObj; // This is the only integer type that can't be represented by a long.
+ else
+ hexValue = (ulong) Convert.ToInt64(constantValObj); // Handles all integer types except ulong.
// ETW requires all bitmap values to be powers of 2. Skip the ones that are not.
// TODO: Warn people about the dropping of values.
if (isbitmap && ((hexValue & (hexValue - 1)) != 0 || hexValue == 0))
continue;
-
sb.Append(" <map value=\"0x").Append(hexValue.ToString("x", CultureInfo.InvariantCulture)).Append("\"");
WriteMessageAttrib(sb, "map", enumType.Name + "." + staticField.Name, staticField.Name);
sb.Append("/>").AppendLine();
+ anyValuesWritten = true;
}
}
+
+ // the OS requires that bitmaps and valuemaps have at least one value or it reject the whole manifest.
+ // To avoid that put a 'None' entry if there are no other values.
+ if (!anyValuesWritten)
+ {
+ sb.Append(" <map value=\"0x0\"");
+ WriteMessageAttrib(sb, "map", enumType.Name + "." + "None", "None");
+ sb.Append("/>").AppendLine();
+ }
sb.Append(" </").Append(mapKind).Append(">").AppendLine();
}
sb.Append(" </maps>").AppendLine();
@@ -6061,4 +6075,3 @@ namespace System.Diagnostics.Tracing
#endregion
}
-
diff --git a/src/System.Private.CoreLib/shared/System/String.Searching.cs b/src/System.Private.CoreLib/shared/System/String.Searching.cs
index 56549d8f1..857d64eec 100644
--- a/src/System.Private.CoreLib/shared/System/String.Searching.cs
+++ b/src/System.Private.CoreLib/shared/System/String.Searching.cs
@@ -55,7 +55,7 @@ namespace System
return CompareInfo.Invariant.IndexOf(this, value, GetCaseCompareOfComparisonCulture(comparisonType));
case StringComparison.Ordinal:
- return CompareInfo.Invariant.IndexOf(this, value, CompareOptions.Ordinal);
+ return IndexOf(value);
case StringComparison.OrdinalIgnoreCase:
return CompareInfo.Invariant.IndexOf(this, value, CompareOptions.OrdinalIgnoreCase);
diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.Windows.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.Windows.cs
index afafd24e9..492247757 100644
--- a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.Windows.cs
+++ b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.Windows.cs
@@ -441,21 +441,21 @@ namespace Microsoft.Win32
switch (type)
{
- case Interop.Kernel32.RegistryValues.REG_NONE:
- case Interop.Kernel32.RegistryValues.REG_DWORD_BIG_ENDIAN:
- case Interop.Kernel32.RegistryValues.REG_BINARY:
+ case Interop.Advapi32.RegistryValues.REG_NONE:
+ case Interop.Advapi32.RegistryValues.REG_DWORD_BIG_ENDIAN:
+ case Interop.Advapi32.RegistryValues.REG_BINARY:
{
byte[] blob = new byte[datasize];
ret = Interop.mincore.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
data = blob;
}
break;
- case Interop.Kernel32.RegistryValues.REG_QWORD:
+ case Interop.Advapi32.RegistryValues.REG_QWORD:
{ // also REG_QWORD_LITTLE_ENDIAN
if (datasize > 8)
{
// prevent an AV in the edge case that datasize is larger than sizeof(long)
- goto case Interop.Kernel32.RegistryValues.REG_BINARY;
+ goto case Interop.Advapi32.RegistryValues.REG_BINARY;
}
long blob = 0;
Debug.Assert(datasize == 8, "datasize==8");
@@ -465,12 +465,12 @@ namespace Microsoft.Win32
data = blob;
}
break;
- case Interop.Kernel32.RegistryValues.REG_DWORD:
+ case Interop.Advapi32.RegistryValues.REG_DWORD:
{ // also REG_DWORD_LITTLE_ENDIAN
if (datasize > 4)
{
// prevent an AV in the edge case that datasize is larger than sizeof(int)
- goto case Interop.Kernel32.RegistryValues.REG_QWORD;
+ goto case Interop.Advapi32.RegistryValues.REG_QWORD;
}
int blob = 0;
Debug.Assert(datasize == 4, "datasize==4");
@@ -481,7 +481,7 @@ namespace Microsoft.Win32
}
break;
- case Interop.Kernel32.RegistryValues.REG_SZ:
+ case Interop.Advapi32.RegistryValues.REG_SZ:
{
if (datasize % 2 == 1)
{
@@ -511,7 +511,7 @@ namespace Microsoft.Win32
}
break;
- case Interop.Kernel32.RegistryValues.REG_EXPAND_SZ:
+ case Interop.Advapi32.RegistryValues.REG_EXPAND_SZ:
{
if (datasize % 2 == 1)
{
@@ -546,7 +546,7 @@ namespace Microsoft.Win32
}
}
break;
- case Interop.Kernel32.RegistryValues.REG_MULTI_SZ:
+ case Interop.Advapi32.RegistryValues.REG_MULTI_SZ:
{
if (datasize % 2 == 1)
{
@@ -622,7 +622,7 @@ namespace Microsoft.Win32
data = strings;
}
break;
- case Interop.Kernel32.RegistryValues.REG_LINK:
+ case Interop.Advapi32.RegistryValues.REG_LINK:
default:
break;
}
@@ -641,7 +641,7 @@ namespace Microsoft.Win32
}
return
- type == Interop.Kernel32.RegistryValues.REG_NONE ? RegistryValueKind.None :
+ type == Interop.Advapi32.RegistryValues.REG_NONE ? RegistryValueKind.None :
!Enum.IsDefined(typeof(RegistryValueKind), type) ? RegistryValueKind.Unknown :
(RegistryValueKind)type;
}
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
index a86ef2d67..8aac7110c 100644
--- a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
@@ -143,7 +143,7 @@ namespace Internal.IL
private void ImportLoadNull()
{
- throw new NotImplementedException();
+ _interpreter.EvaluationStack.Push(new ObjectRefStackItem(null));
}
private void ImportReturn()
@@ -163,8 +163,15 @@ namespace Internal.IL
case StackValueKind.Unknown:
case StackValueKind.NativeInt:
case StackValueKind.Float:
+ if (stackItem.Type == WellKnownType.Single)
+ _interpreter.SetReturnValue(((FloatStackItem)stackItem).Value);
+ else if (stackItem.Type == WellKnownType.Double)
+ _interpreter.SetReturnValue(((DoubleStackItem)stackItem).Value);
+ break;
case StackValueKind.ByRef:
case StackValueKind.ObjRef:
+ _interpreter.SetReturnValue(((ObjectRefStackItem)stackItem).Value);
+ break;
case StackValueKind.ValueType:
default:
break;
@@ -179,9 +186,14 @@ namespace Internal.IL
_interpreter.EvaluationStack.Push(new Int64StackItem(value));
}
+ private void ImportLoadFloat(float value)
+ {
+ _interpreter.EvaluationStack.Push(new FloatStackItem(value));
+ }
+
private void ImportLoadFloat(double value)
{
- throw new NotImplementedException();
+ _interpreter.EvaluationStack.Push(new DoubleStackItem(value));
}
private void ImportShiftOperation(ILOpcode opcode)
@@ -374,9 +386,10 @@ namespace Internal.IL
throw new NotImplementedException();
}
- private void ImportLoadString(int v)
+ private void ImportLoadString(int token)
{
- throw new NotImplementedException();
+ string str = (string)_methodIL.GetObject(token);
+ _interpreter.EvaluationStack.Push(new ObjectRefStackItem(str));
}
private void ImportBinaryOperation(ILOpcode opCode)
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
index b35b8bb05..612bd350d 100644
--- a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
@@ -4,56 +4,66 @@
using System;
using Internal.IL;
+using Internal.TypeSystem;
namespace Internal.Runtime.Interpreter
{
internal abstract class StackItem
{
- public StackValueKind Kind { get; set; }
+ public StackValueKind Kind { get; protected set; }
+ public WellKnownType Type { get; protected set; }
}
internal class StackItem<T> : StackItem
{
public T Value { get; }
- public StackItem(T value, StackValueKind kind)
+ public StackItem(T value, StackValueKind kind, WellKnownType type)
{
Value = value;
Kind = kind;
+ Type = type;
}
}
internal class Int32StackItem : StackItem<int>
{
- public Int32StackItem(int value) : base(value, StackValueKind.Int32)
+ public Int32StackItem(int value) : base(value, StackValueKind.Int32, WellKnownType.Int32)
{
}
}
internal class Int64StackItem : StackItem<long>
{
- public Int64StackItem(long value) : base(value, StackValueKind.Int64)
+ public Int64StackItem(long value) : base(value, StackValueKind.Int64, WellKnownType.Int64)
{
}
}
- internal class FloatStackItem : StackItem<double>
+ internal class FloatStackItem : StackItem<float>
{
- public FloatStackItem(double value) : base(value, StackValueKind.Float)
+ public FloatStackItem(float value) : base(value, StackValueKind.Float, WellKnownType.Single)
+ {
+ }
+ }
+
+ internal class DoubleStackItem : StackItem<double>
+ {
+ public DoubleStackItem(double value) : base(value, StackValueKind.Float, WellKnownType.Double)
{
}
}
internal class ValueTypeStackItem : StackItem<ValueType>
{
- public ValueTypeStackItem(ValueType value) : base(value, StackValueKind.ValueType)
+ public ValueTypeStackItem(ValueType value) : base(value, StackValueKind.ValueType, WellKnownType.ValueType)
{
}
}
internal class ObjectRefStackItem : StackItem<Object>
{
- public ObjectRefStackItem(Object value) : base(value, StackValueKind.ObjRef)
+ public ObjectRefStackItem(Object value) : base(value, StackValueKind.ObjRef, WellKnownType.Object)
{
}
}
diff --git a/tests/src/Simple/HelloWasm/Program.cs b/tests/src/Simple/HelloWasm/Program.cs
index 8b722882c..95563912a 100644
--- a/tests/src/Simple/HelloWasm/Program.cs
+++ b/tests/src/Simple/HelloWasm/Program.cs
@@ -294,6 +294,22 @@ internal static class Program
PrintLine("float comparison: Ok.");
}
+ // Create a ByReference<char> through the ReadOnlySpan ctor and call the ByReference.Value via the indexer.
+ var span = "123".AsSpan();
+ if (span[0] != '1'
+ || span[1] != '2'
+ || span[2] != '3')
+ {
+ PrintLine("ByReference intrinsics exercise via ReadOnlySpan failed");
+ PrintLine(span[0].ToString());
+ PrintLine(span[1].ToString());
+ PrintLine(span[2].ToString());
+ }
+ else
+ {
+ PrintLine("ByReference intrinsics exercise via ReadOnlySpan OK.");
+ }
+
// This test should remain last to get other results before stopping the debugger
PrintLine("Debugger.Break() test: Ok if debugger is open and breaks.");
System.Diagnostics.Debugger.Break();