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:
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/Compilation.cs23
-rw-r--r--src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs101
-rw-r--r--src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs3
-rw-r--r--src/Native/Bootstrap/main.cpp108
-rw-r--r--src/Native/Runtime/EHHelpers.cpp2
-rw-r--r--src/Native/Runtime/portable.cpp101
-rw-r--r--src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs2
-rw-r--r--src/Runtime.Base/src/System/Runtime/GCStress.cs2
-rw-r--r--src/Runtime.Base/src/System/Runtime/RuntimeExports.cs2
-rw-r--r--src/Runtime.Base/src/System/Runtime/TypeCast.cs2
-rw-r--r--src/Runtime.Base/src/System/Runtime/__Finalizer.cs2
-rw-r--r--src/System.Private.CoreLib/src/System.Private.CoreLib.csproj28
-rw-r--r--src/System.Private.CoreLib/src/System/EETypePtr.cs7
-rw-r--r--src/System.Private.CoreLib/src/System/Object.cs20
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/CommandLine.Win32.cs (renamed from src/System.Private.CoreLib/src/System/Runtime/commandline.cs)0
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/String.cs4
17 files changed, 210 insertions, 199 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
index 0147987dc..a858aa207 100644
--- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
@@ -200,20 +200,27 @@ namespace ILCompiler
foreach (var inputFile in _typeSystemContext.InputFilePaths)
{
var module = _typeSystemContext.GetModuleFromPath(inputFile.Value);
- foreach (var type in module.GetAllTypes())
+ AddCompilationRootsForRuntimeExports(module);
+ }
+
+ AddCompilationRootsForRuntimeExports((EcmaModule)_typeSystemContext.SystemModule);
+ }
+
+ private void AddCompilationRootsForRuntimeExports(EcmaModule module)
+ {
+ foreach (var type in module.GetAllTypes())
+ {
+ foreach (var method in type.GetMethods())
{
- foreach (var method in type.GetMethods())
+ if (method.HasCustomAttribute("System.Runtime", "RuntimeExportAttribute"))
{
- if (method.HasCustomAttribute("System.Runtime", "RuntimeExportAttribute"))
- {
- string exportName = ((EcmaMethod)method).GetAttributeStringValue("System.Runtime", "RuntimeExportAttribute");
- AddCompilationRoot(method, "Runtime export", exportName);
- }
+ string exportName = ((EcmaMethod)method).GetAttributeStringValue("System.Runtime", "RuntimeExportAttribute");
+ AddCompilationRoot(method, "Runtime export", exportName);
}
}
}
}
-
+
private void AddCompilationRoot(MethodDesc method, string reason, string exportName = null)
{
var methodEntryPoint = _nodeFactory.MethodEntrypoint(method);
diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs
index 7c8ba7350..83757638c 100644
--- a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs
+++ b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs
@@ -47,6 +47,8 @@ namespace ILCompiler.CppCodeGen
SetWellKnownTypeSignatureName(WellKnownType.UIntPtr, "uintptr_t");
SetWellKnownTypeSignatureName(WellKnownType.Single, "float");
SetWellKnownTypeSignatureName(WellKnownType.Double, "double");
+
+ BuildExternCSignatureMap();
}
private Dictionary<TypeDesc, string> _cppSignatureNames = new Dictionary<TypeDesc, string>();
@@ -71,36 +73,51 @@ namespace ILCompiler.CppCodeGen
return mangledName;
}
- public string GetCppMethodDeclaration(MethodDesc method, bool implementation, string externalMethodName = null)
+ // extern "C" methods are sometimes referenced via different signatures.
+ // _externCSignatureMap contains the canonical signature of the extern "C" import. References
+ // via other signatures are required to use casts.
+ private Dictionary<string, MethodSignature> _externCSignatureMap = new Dictionary<string, MethodSignature>();
+
+ private void BuildExternCSignatureMap()
+ {
+ foreach (var nodeAlias in _compilation.NodeFactory.NodeAliases)
+ {
+ var methodNode = (CppMethodCodeNode)nodeAlias.Key;
+ _externCSignatureMap.Add(nodeAlias.Value, methodNode.Method.Signature);
+ }
+ }
+
+ public string GetCppMethodDeclaration(MethodDesc method, bool implementation, string externalMethodName = null, MethodSignature methodSignature = null)
{
StringBuilder sb = new StringBuilder();
- var methodSignature = method.Signature;
+ if (methodSignature == null)
+ methodSignature = method.Signature;
- if (!implementation)
+ if (externalMethodName != null)
{
- if (externalMethodName != null)
- {
- sb.Append("extern \"C\" ");
- }
- else
+ sb.Append("extern \"C\" ");
+ }
+ else
+ {
+ if (!implementation)
{
sb.Append("static ");
}
}
sb.Append(GetCppSignatureTypeName(methodSignature.ReturnType));
sb.Append(" ");
- if (implementation)
- {
- sb.Append(GetCppTypeName(method.OwningType));
- sb.Append("::");
- }
if (externalMethodName != null)
{
sb.Append(externalMethodName);
}
else
{
+ if (implementation)
+ {
+ sb.Append(GetCppTypeName(method.OwningType));
+ sb.Append("::");
+ }
sb.Append(GetCppMethodName(method));
}
sb.Append("(");
@@ -265,30 +282,53 @@ namespace ILCompiler.CppCodeGen
if (importName == null)
importName = method.Name;
+ MethodSignature methodSignature = method.Signature;
+ bool slotCastRequired = false;
+
+ MethodSignature externCSignature;
+ if (_externCSignatureMap.TryGetValue(importName, out externCSignature))
+ {
+ slotCastRequired = !externCSignature.Equals(method.Signature);
+ }
+ else
+ {
+ externCSignature = methodSignature;
+ }
+
// TODO: hacky special-case
if (importName != "memmove" && importName != "malloc") // some methods are already declared by the CRT headers
{
- builder.AppendLine(GetCppMethodDeclaration(method, false, importName));
+ builder.AppendLine(GetCppMethodDeclaration(method, false, importName, externCSignature));
}
builder.AppendLine(GetCppMethodDeclaration(method, true));
builder.AppendLine("{");
- builder.Append(" ");
- if (GetCppSignatureTypeName(method.Signature.ReturnType) != "void")
+
+ if (slotCastRequired)
+ {
+ AppendSlotTypeDef(builder, method);
+ }
+
+ if (!method.Signature.ReturnType.IsVoid)
{
builder.Append("return ");
}
- builder.AppendLine("::" + importName + "(" + GetCppMethodCallParamList(method) + ");");
+ if (slotCastRequired)
+ builder.Append("((__slot__" + GetCppMethodName(method) + ")");
+ builder.Append("::");
+ builder.Append(importName);
+ if (slotCastRequired)
+ builder.Append(")");
+
+ builder.Append("(");
+ builder.Append(GetCppMethodCallParamList(method));
+ builder.AppendLine(");");
builder.AppendLine("}");
return builder.ToString();
}
default:
- // TODO: hacky special-case
- if (method.Name == "BlockCopy")
- return null;
-
return GetCppMethodDeclaration(method, true) + " { throw 0xC000C000; }" + Environment.NewLine;
}
}
@@ -894,6 +934,25 @@ namespace ILCompiler.CppCodeGen
{
var methodCodeNode = (CppMethodCodeNode)_compilation.NodeFactory.MethodEntrypoint(m);
Out.WriteLine(methodCodeNode.CppCode);
+
+ var alternateName = _compilation.NodeFactory.GetSymbolAlternateName(methodCodeNode);
+ if (alternateName != null)
+ {
+ Out.WriteLine(GetCppMethodDeclaration(m, true, alternateName));
+ Out.WriteLine("{");
+ Out.Write(" ");
+ if (!m.Signature.ReturnType.IsVoid)
+ {
+ Out.Write("return ");
+ }
+ Out.Write(GetCppTypeName(m.OwningType));
+ Out.Write("::");
+ Out.Write(GetCppMethodName(m));
+ Out.Write("(");
+ Out.Write(GetCppMethodCallParamList(m));
+ Out.WriteLine(");");
+ Out.WriteLine("}");
+ }
}
}
}
diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs
index f3b5ccdf6..5a2f940d9 100644
--- a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs
+++ b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs
@@ -2064,6 +2064,9 @@ namespace Internal.IL
{
var type = ResolveTypeToken(token);
+ // TODO: Remove
+ _writer.GetCppSignatureTypeName(type);
+
Push(StackValueKind.Int32, new Value("sizeof(" + _writer.GetCppTypeName(type) + ")"));
}
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp
index 29afcc217..ffa123cac 100644
--- a/src/Native/Bootstrap/main.cpp
+++ b/src/Native/Bootstrap/main.cpp
@@ -279,86 +279,39 @@ extern "C" void Buffer_BlockCopy(class System::Array * src, int srcOfs, class Sy
memmove((uint8_t*)dst + 2 * sizeof(void*) + dstOfs, (uint8_t*)src + 2 * sizeof(void*) + srcOfs, count);
}
-extern "C" Object* RhMemberwiseClone(Object*)
-{
- throw "RhMemberwiseClone";
-}
-
-extern "C" uint8_t RhGetCorElementType(MethodTable*)
-{
- throw "RhGetCorElementType";
-}
-
-extern "C" MethodTable* RhGetRelatedParameterType(MethodTable*)
-{
- throw "RhGetRelatedParameterType";
-}
-
-extern "C" uint16_t RhGetComponentSize(MethodTable*)
-{
- throw "RhGetComponentSize";
-}
-
-extern "C" uint8_t RhHasReferenceFields(MethodTable*)
-{
- throw "RhHasReferenceFields";
-}
-
-extern "C" uint8_t RhIsValueType(MethodTable*)
-{
- throw "RhIsValueType";
-}
-
-extern "C" uint8_t RhIsArray(MethodTable*)
-{
- throw "RhIsArray";
-}
-
-extern "C" int32_t RhGetEETypeHash(MethodTable*)
-{
- throw "RhGetEETypeHash";
-}
-
-extern "C" uint8_t RhTypeCast_AreTypesEquivalent(MethodTable*, MethodTable*)
+extern "C" void RhGetCurrentThreadStackTrace()
{
- throw "RhTypeCast_AreTypesEquivalent";
+ throw "RhGetCurrentThreadStackTrace";
}
-extern "C" uint8_t RhTypeCast_AreTypesAssignable(MethodTable*, MethodTable*)
+extern "C" void RhpGetDispatchCellInfo()
{
- throw "RhTypeCast_AreTypesAssignable";
+ throw "RhpGetDispatchCellInfo";
}
-
-extern "C" void RhGetCurrentThreadStackTrace()
+extern "C" void RhpUpdateDispatchCellCache()
{
- throw "RhGetCurrentThreadStackTrace";
+ throw "RhpUpdateDispatchCellCache";
}
-
-extern "C" intptr_t RhHandleAlloc(Object * pObject, int type)
+extern "C" void RhpSearchDispatchCellCache()
{
- return (intptr_t)CreateTypedHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pObject, type);
+ throw "RhpSearchDispatchCellCache";
}
-
-extern "C" intptr_t RhHandleAllocDependent(Object* pPrimary, Object* pSecondary)
+extern "C" void RhCollect()
{
- return (intptr_t)CreateDependentHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pPrimary, pSecondary);
+ throw "RhCollect";
}
-
-extern "C" void RhGetNonArrayBaseType()
+extern "C" void RhpCallCatchFunclet()
{
- throw "RhGetNonArrayBaseType";
+ throw "RhpCallCatchFunclet";
}
-
-extern "C" void RhGetEETypeClassification()
+extern "C" void RhpCallFilterFunclet()
{
- throw "RhGetEETypeClassification";
+ throw "RhpCallFilterFunclet";
}
-
-extern "C" void RhCollect()
+extern "C" void RhpCallFinallyFunclet()
{
- throw "RhCollect";
+ throw "RhpCallFinallyFunclet";
}
-
extern "C" void RhpUniversalTransition()
{
throw "RhpUniversalTransition";
@@ -367,38 +320,13 @@ extern "C" void RhpFailFastForPInvokeExceptionPreemp()
{
throw "RhpFailFastForPInvokeExceptionPreemp";
}
-extern "C" void RhpFailFastForPInvokeExceptionCoop()
-{
- throw "RhpFailFastForPInvokeExceptionCoop";
-}
extern "C" void RhpThrowHwEx()
{
throw "RhpThrowHwEx";
}
-
-extern "C" void RhExceptionHandling_FailedAllocation()
-{
- throw "RhExceptionHandling_FailedAllocation";
-}
-extern "C" void RhIsNullable()
-{
- throw "RhIsNullable";
-}
-extern "C" void RhpCalculateStackTraceWorker()
-{
- throw "RhpCalculateStackTraceWorker";
-}
-extern "C" void RhThrowHwEx()
-{
- throw "RhThrowHwEx";
-}
-extern "C" void RhThrowEx()
-{
- throw "RhThrowEx";
-}
-extern "C" void RhRethrow()
+extern "C" void RhpEtwExceptionThrown()
{
- throw "RhRethrow";
+ throw "RhpEtwExceptionThrown";
}
#ifndef CPPCODEGEN
diff --git a/src/Native/Runtime/EHHelpers.cpp b/src/Native/Runtime/EHHelpers.cpp
index 22ce0051a..9d260b683 100644
--- a/src/Native/Runtime/EHHelpers.cpp
+++ b/src/Native/Runtime/EHHelpers.cpp
@@ -239,7 +239,7 @@ struct DISPATCHER_CONTEXT
};
EXTERN_C void __cdecl RhpFailFastForPInvokeExceptionPreemp(IntNative PInvokeCallsiteReturnAddr,
- void* pExceptionRecord, void* pContextRecord);
+ void* pExceptionRecord, void* pContextRecord);
EXTERN_C void REDHAWK_CALLCONV RhpFailFastForPInvokeExceptionCoop(IntNative PInvokeCallsiteReturnAddr,
void* pExceptionRecord, void* pContextRecord);
Int32 __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs);
diff --git a/src/Native/Runtime/portable.cpp b/src/Native/Runtime/portable.cpp
index 86135e0c6..6e1656d20 100644
--- a/src/Native/Runtime/portable.cpp
+++ b/src/Native/Runtime/portable.cpp
@@ -71,10 +71,10 @@ COOP_PINVOKE_HELPER(void, RhpReversePInvokeReturn, (ReversePInvokeFrame* pFrame)
//
// Allocations
//
-// runtimeexports.cs -- @TODO: use C# implementation
-COOP_PINVOKE_HELPER(Object *, RhNewObject, (EEType* pEEType))
+COOP_PINVOKE_HELPER(Object *, RhpNewFast, (EEType* pEEType))
{
- ASSERT_MSG(!pEEType->RequiresAlign8(), "NYI");
+ ASSERT(!pEEType->RequiresAlign8());
+ ASSERT(!pEEType->HasFinalizer());
Thread * pCurThread = ThreadStore::GetCurrentThread();
alloc_context * acontext = pCurThread->GetAllocContext();
@@ -104,8 +104,33 @@ COOP_PINVOKE_HELPER(Object *, RhNewObject, (EEType* pEEType))
return pObject;
}
-// runtimeexports.cs -- @TODO: use C# implementation
-COOP_PINVOKE_HELPER(Array *, RhNewArray, (EEType * pArrayEEType, int numElements))
+
+#define GC_ALLOC_FINALIZE 0x1 // TODO: Defined in gc.h
+
+COOP_PINVOKE_HELPER(Object *, RhpNewFinalizable, (EEType* pEEType))
+{
+ ASSERT(!pEEType->RequiresAlign8());
+ ASSERT(pEEType->HasFinalizer());
+
+ Thread * pCurThread = ThreadStore::GetCurrentThread();
+ Object * pObject;
+
+ size_t size = pEEType->get_BaseSize();
+
+ pObject = (Object *)RedhawkGCInterface::Alloc(pCurThread, size, GC_ALLOC_FINALIZE, pEEType);
+ if (pObject == nullptr)
+ {
+ ASSERT_UNCONDITIONALLY("NYI"); // TODO: Throw OOM
+ }
+ pObject->set_EEType(pEEType);
+
+ if (size >= RH_LARGE_OBJECT_SIZE)
+ RhpPublishObject(pObject, size);
+
+ return pObject;
+}
+
+COOP_PINVOKE_HELPER(Array *, RhpNewArray, (EEType * pArrayEEType, int numElements))
{
ASSERT_MSG(!pArrayEEType->RequiresAlign8(), "NYI");
@@ -200,50 +225,17 @@ COOP_PINVOKE_HELPER(MDArray *, RhNewMDArray, (EEType * pArrayEEType, UInt32 rank
return pObject;
}
-COOP_PINVOKE_HELPER(void, RhBox, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
-COOP_PINVOKE_HELPER(void, RhpNewFast, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
-COOP_PINVOKE_HELPER(void, RhpNewFinalizable, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
-COOP_PINVOKE_HELPER(void, RhpNewArray, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
COOP_PINVOKE_HELPER(void, RhpInitialDynamicInterfaceDispatch, ())
{
ASSERT_UNCONDITIONALLY("NYI");
}
-
-// finalizer.cs
-COOP_PINVOKE_HELPER(void, RhpSetHaveNewClasslibs, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
// finalizer.cs
COOP_PINVOKE_HELPER(void, ProcessFinalizers, ())
{
ASSERT_UNCONDITIONALLY("NYI");
}
-// runtimeexports.cs
-COOP_PINVOKE_HELPER(void, RhpReversePInvokeBadTransition, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
//
// Return address hijacking
//
@@ -323,36 +315,3 @@ COOP_PINVOKE_HELPER(void, RhpCheckedAssignRef, (Object ** dst, Object * ref))
}
#endif
-
-//
-// type cast stuff from TypeCast.cs
-//
-COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfClass, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastClass, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfArray, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastArray, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfInterface, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastInterface, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-COOP_PINVOKE_HELPER(void, RhTypeCast_CheckVectorElemAddr, ())
-{
- ASSERT_UNCONDITIONALLY("NYI");
-}
-
diff --git a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
index baedb017c..cbfe6af9f 100644
--- a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
+++ b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
@@ -85,7 +85,7 @@ namespace System.Runtime
}
}
- public unsafe static class EH
+ internal unsafe static class EH
{
internal static UIntPtr MaxSP
{
diff --git a/src/Runtime.Base/src/System/Runtime/GCStress.cs b/src/Runtime.Base/src/System/Runtime/GCStress.cs
index 9753801c6..93abda4e4 100644
--- a/src/Runtime.Base/src/System/Runtime/GCStress.cs
+++ b/src/Runtime.Base/src/System/Runtime/GCStress.cs
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
namespace System.Runtime
{
- public class GCStress
+ internal class GCStress
{
[RuntimeExport("RhGcStress_Initialize")]
public static void Initialize()
diff --git a/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs b/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs
index 7a6eb104f..4b0e9fc1f 100644
--- a/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs
+++ b/src/Runtime.Base/src/System/Runtime/RuntimeExports.cs
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
namespace System.Runtime
{
- public static class RuntimeExports
+ internal static class RuntimeExports
{
//
// internalcalls for System.Runtime.InteropServices.GCHandle.
diff --git a/src/Runtime.Base/src/System/Runtime/TypeCast.cs b/src/Runtime.Base/src/System/Runtime/TypeCast.cs
index 0b90c6998..bcbd58b7d 100644
--- a/src/Runtime.Base/src/System/Runtime/TypeCast.cs
+++ b/src/Runtime.Base/src/System/Runtime/TypeCast.cs
@@ -17,7 +17,7 @@ namespace System.Runtime
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
- public static class TypeCast
+ internal static class TypeCast
{
[RuntimeExport("RhTypeCast_IsInstanceOfClass")]
static public unsafe object IsInstanceOfClass(object obj, void* pvTargetType)
diff --git a/src/Runtime.Base/src/System/Runtime/__Finalizer.cs b/src/Runtime.Base/src/System/Runtime/__Finalizer.cs
index 1625cab3c..174384be4 100644
--- a/src/Runtime.Base/src/System/Runtime/__Finalizer.cs
+++ b/src/Runtime.Base/src/System/Runtime/__Finalizer.cs
@@ -14,7 +14,7 @@ using System.Runtime.CompilerServices;
namespace System.Runtime
{
// We choose this name to avoid clashing with any future public class with the name Finalizer.
- public static class __Finalizer
+ internal static class __Finalizer
{
private static bool s_fHaveNewClasslibs /* = false */;
diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index 33b8265e0..a1d93a4e8 100644
--- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -310,7 +310,6 @@
<Compile Include="System\Reflection\Missing.cs" />
<Compile Include="System\Reflection\MissingMetadataException.cs" />
<Compile Include="System\Reflection\ProcessorArchitecture.cs" />
- <Compile Include="System\Runtime\commandline.cs" />
<Compile Include="System\Runtime\CompilerServices\AccessedThroughPropertyAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\AsyncStateMachineAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\CallerFilePathAttribute.cs" />
@@ -485,6 +484,8 @@
<Compile Include="System\Globalization\TextInfo.Win32.cs" />
<Compile Include="System\Globalization\CalendarData.Win32.cs" />
+ <Compile Include="System\Runtime\CommandLine.Win32.cs" />
+
<Compile Condition="'$(IsProjectNLibrary)' == 'true'" Include="System\Environment.EnvironmentVariables.UWP.cs" />
<Compile Condition="'$(IsProjectNLibrary)' != 'true'" Include="System\Environment.EnvironmentVariables.Win32.cs" />
<Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.Environment.cs" />
@@ -527,6 +528,31 @@
<Compile Include="CoverageSupport.cs" />
</ItemGroup>
+ <!-- For now, link Runtime.Base into System.Private.CoreLib until there is proper multifile build -->
+ <PropertyGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <DefineConstants>INPLACE_RUNTIME;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\CachedInterfaceDispatch.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\DispatchResolve.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\GCStress.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\BinderIntrinsics.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\__Finalizer.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\CalliIntrinsics.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\EEType.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\ExceptionHandling.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\InternalCalls.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\RuntimeExports.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\StackFrameIterator.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\TypeCast.cs" />
+ <Compile Include="..\..\Runtime.Base\src\System\Runtime\CompilerServices\ManuallyManagedAttribute.cs" />
+ <Compile Include="..\..\Runtime.Base\src\RhBaseName.cs" />
+ <Compile Include="..\..\Common\src\Internal\Runtime\EEType.Constants.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <Compile Include="$(BaseIntermediateOutputPath)\Native\$(BinDirOSGroup).$(BinDirPlatform).$(BinDirConfiguration)\Runtime\Full\AsmOffsets.cs" />
+ </ItemGroup>
+
<ItemGroup>
<EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" >
<LogicalName>Resources.$(AssemblyName).rd.xml</LogicalName>
diff --git a/src/System.Private.CoreLib/src/System/EETypePtr.cs b/src/System.Private.CoreLib/src/System/EETypePtr.cs
index 87a1701d8..cbd2ec72b 100644
--- a/src/System.Private.CoreLib/src/System/EETypePtr.cs
+++ b/src/System.Private.CoreLib/src/System/EETypePtr.cs
@@ -30,6 +30,13 @@ namespace System
_value = value;
}
+#if INPLACE_RUNTIME
+ internal unsafe System.Runtime.EEType* ToPointer()
+ {
+ return (System.Runtime.EEType*)(void*)_value;
+ }
+#endif
+
public override bool Equals(Object obj)
{
if (obj is EETypePtr)
diff --git a/src/System.Private.CoreLib/src/System/Object.cs b/src/System.Private.CoreLib/src/System/Object.cs
index 12be0efbc..2bc655ec3 100644
--- a/src/System.Private.CoreLib/src/System/Object.cs
+++ b/src/System.Private.CoreLib/src/System/Object.cs
@@ -11,6 +11,7 @@
**
===========================================================*/
+using System.Diagnostics;
using System.Runtime;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
@@ -54,6 +55,25 @@ namespace System
{
}
+#if INPLACE_RUNTIME
+ internal unsafe EEType* EEType
+ {
+ get
+ {
+ return (EEType *)m_pEEType;
+ }
+ }
+
+ internal unsafe int GetArrayLength()
+ {
+ Debug.Assert(EEType->IsArray, "this is only supported on arrays");
+
+ // m_numComponents is an int field that is directly after _pEEType
+ fixed (IntPtr * ptr = &m_pEEType)
+ return *(int*)(ptr + 1);
+ }
+#endif
+
public Type GetType()
{
return ReflectionCoreNonPortable.GetRuntimeTypeForEEType(EETypePtr);
diff --git a/src/System.Private.CoreLib/src/System/Runtime/commandline.cs b/src/System.Private.CoreLib/src/System/Runtime/CommandLine.Win32.cs
index d854778e0..d854778e0 100644
--- a/src/System.Private.CoreLib/src/System/Runtime/commandline.cs
+++ b/src/System.Private.CoreLib/src/System/Runtime/CommandLine.Win32.cs
diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
index 011c86247..332cf4e82 100644
--- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
+++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
@@ -29,7 +29,9 @@ namespace System.Runtime.CompilerServices
//
// No attempt is made to detect or break deadlocks due to other synchronization mechanisms.
//==============================================================================================================
+#if !CORERT // CORERT-TODO: Use full cctor helper
[RuntimeExport("CheckStaticClassConstruction")]
+#endif
public static unsafe void* EnsureClassConstructorRun(void* returnValue, StaticClassConstructionContext* pContext)
{
IntPtr pfnCctor = pContext->cctorMethodAddress;
diff --git a/src/System.Private.CoreLib/src/System/String.cs b/src/System.Private.CoreLib/src/System/String.cs
index b11c0cf17..bb7f9bf2f 100644
--- a/src/System.Private.CoreLib/src/System/String.cs
+++ b/src/System.Private.CoreLib/src/System/String.cs
@@ -1588,9 +1588,9 @@ namespace System
{
// We allocate one extra char as an interop convenience so that our strings are null-
// terminated, however, we don't pass the extra +1 to the array allocation because the base
- // size of this object includes the m_firstChar field.
+ // size of this object includes the _firstChar field.
string newStr = RuntimeImports.RhNewArrayAsString(String.Empty.EETypePtr, length);
- newStr._stringLength = length;
+ Debug.Assert(newStr._stringLength == length);
return newStr;
}
catch (OverflowException)