You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -4,7 +4,6 @@
|
||||
"System.Runtime": "4.4.0-beta-24906-01",
|
||||
"System.Reflection.Primitives":"4.4.0-beta-24906-01",
|
||||
"System.Runtime.Extensions": "4.4.0-beta-24906-01",
|
||||
"System.Diagnostics.Tracing": "4.4.0-beta-24906-01",
|
||||
"System.Collections": "4.4.0-beta-24906-01",
|
||||
"System.Resources.ResourceManager": "4.4.0-beta-24906-01",
|
||||
"System.Console": "4.4.0-beta-24906-01",
|
||||
|
@@ -32,6 +32,9 @@
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildOneFrameworkLibrary">
|
||||
<PropertyGroup>
|
||||
<IlcGenerateMetadataLog>true</IlcGenerateMetadataLog>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ManagedBinary Include="$(LibraryToCompile)" />
|
||||
<IlcCompileInput Include="@(ManagedBinary)" />
|
||||
|
@@ -49,10 +49,12 @@ See the LICENSE file in the project root for more information.
|
||||
<LinkerArg Include="@(NativeLibrary)" />
|
||||
<LinkerArg Include="@(AdditionalNativeLibrary)" />
|
||||
<LinkerArg Include="-g" />
|
||||
<LinkerArg Include="-Wl,-rpath,'$ORIGIN'" />
|
||||
<LinkerArg Include="-pthread" />
|
||||
<LinkerArg Include="-lstdc++" />
|
||||
<LinkerArg Include="-ldl" />
|
||||
<LinkerArg Include="-lm" />
|
||||
<LinkerArg Include="-luuid" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-lrt" Condition="'$(TargetOS)' != 'OSX'" />
|
||||
<LinkerArg Include="-licucore" Condition="'$(TargetOS)' == 'OSX'" />
|
||||
</ItemGroup>
|
||||
|
@@ -97,6 +97,7 @@ See the LICENSE file in the project root for more information.
|
||||
<IlcArg Include="@(IlcCompileInput)" />
|
||||
<IlcArg Include="-o:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)" />
|
||||
<IlcArg Include="@(IlcReference->'-r:%(Identity)')" />
|
||||
<IlcArg Condition="$(IlcGenerateMetadataLog) == 'true'" Include="--metadatalog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).metadata.csv" />
|
||||
<IlcArg Condition="$(NativeCodeGen) != ''" Include="--$(NativeCodeGen)" />
|
||||
<IlcArg Condition="$(IlcMultiModule) == 'true'" Include="--multifile" />
|
||||
<IlcArg Condition="$(Optimize) == 'true'" Include="-O" />
|
||||
|
@@ -344,7 +344,14 @@ class SchemaDef
|
||||
members: new MemberDef[] {
|
||||
new MemberDef(name: "Value", typeName: new string[] { "ConstantStringValue", "ConstantReferenceValue" }, flags: MemberDefFlags.RecordRef | MemberDefFlags.List)
|
||||
}
|
||||
)
|
||||
),
|
||||
new RecordDef(
|
||||
name: "ConstantEnumArray",
|
||||
members: new MemberDef[] {
|
||||
new MemberDef("ElementType", TypeDefOrRefOrSpec, MemberDefFlags.RecordRef),
|
||||
new MemberDef("Value", ConstantEnumArrayValue, MemberDefFlags.RecordRef)
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
.ToArray();
|
||||
@@ -370,6 +377,18 @@ class SchemaDef
|
||||
"ConstantUInt64Value",
|
||||
};
|
||||
|
||||
private static readonly string[] ConstantEnumArrayValue = new string[]
|
||||
{
|
||||
"ConstantByteArray",
|
||||
"ConstantSByteArray",
|
||||
"ConstantInt16Array",
|
||||
"ConstantUInt16Array",
|
||||
"ConstantInt32Array",
|
||||
"ConstantUInt32Array",
|
||||
"ConstantInt64Array",
|
||||
"ConstantUInt64Array",
|
||||
};
|
||||
|
||||
private static readonly string[] TypeDefOrRef = new string[]
|
||||
{
|
||||
"TypeDefinition",
|
||||
@@ -475,6 +494,9 @@ class SchemaDef
|
||||
new MemberDef("EntryPoint", "QualifiedMethod", MemberDefFlags.RecordRef),
|
||||
new MemberDef("GlobalModuleType", "TypeDefinition", MemberDefFlags.RecordRef),
|
||||
new MemberDef("CustomAttributes", "CustomAttribute", MemberDefFlags.List | MemberDefFlags.RecordRef | MemberDefFlags.Child),
|
||||
new MemberDef("ModuleName", "ConstantStringValue", MemberDefFlags.RecordRef | MemberDefFlags.Child | MemberDefFlags.Compare),
|
||||
new MemberDef("Mvid", "Byte", MemberDefFlags.Array | MemberDefFlags.Compare),
|
||||
new MemberDef("ModuleCustomAttributes", "CustomAttribute", MemberDefFlags.List | MemberDefFlags.RecordRef | MemberDefFlags.Child),
|
||||
}
|
||||
),
|
||||
new RecordDef(
|
||||
|
@@ -364,6 +364,15 @@ namespace Internal.Metadata.NativeFormat
|
||||
return offset;
|
||||
} // Read
|
||||
|
||||
public static uint Read(this NativeReader reader, uint offset, out ConstantEnumArrayHandle handle)
|
||||
{
|
||||
uint value;
|
||||
offset = reader.DecodeUnsigned(offset, out value);
|
||||
handle = new ConstantEnumArrayHandle((int)value);
|
||||
handle._Validate();
|
||||
return offset;
|
||||
} // Read
|
||||
|
||||
public static uint Read(this NativeReader reader, uint offset, out ConstantHandleArrayHandle handle)
|
||||
{
|
||||
uint value;
|
||||
|
@@ -78,58 +78,59 @@ namespace Internal.Metadata.NativeFormat
|
||||
ConstantCharValue = 0x9,
|
||||
ConstantDoubleArray = 0xa,
|
||||
ConstantDoubleValue = 0xb,
|
||||
ConstantHandleArray = 0xc,
|
||||
ConstantInt16Array = 0xd,
|
||||
ConstantInt16Value = 0xe,
|
||||
ConstantInt32Array = 0xf,
|
||||
ConstantInt32Value = 0x10,
|
||||
ConstantInt64Array = 0x11,
|
||||
ConstantInt64Value = 0x12,
|
||||
ConstantReferenceValue = 0x13,
|
||||
ConstantSByteArray = 0x14,
|
||||
ConstantSByteValue = 0x15,
|
||||
ConstantSingleArray = 0x16,
|
||||
ConstantSingleValue = 0x17,
|
||||
ConstantStringArray = 0x18,
|
||||
ConstantStringValue = 0x19,
|
||||
ConstantUInt16Array = 0x1a,
|
||||
ConstantUInt16Value = 0x1b,
|
||||
ConstantUInt32Array = 0x1c,
|
||||
ConstantUInt32Value = 0x1d,
|
||||
ConstantUInt64Array = 0x1e,
|
||||
ConstantUInt64Value = 0x1f,
|
||||
CustomAttribute = 0x20,
|
||||
Event = 0x21,
|
||||
Field = 0x22,
|
||||
FieldSignature = 0x23,
|
||||
FixedArgument = 0x24,
|
||||
FunctionPointerSignature = 0x25,
|
||||
GenericParameter = 0x26,
|
||||
MemberReference = 0x27,
|
||||
Method = 0x28,
|
||||
MethodImpl = 0x29,
|
||||
MethodInstantiation = 0x2a,
|
||||
MethodSemantics = 0x2b,
|
||||
MethodSignature = 0x2c,
|
||||
MethodTypeVariableSignature = 0x2d,
|
||||
ModifiedType = 0x2e,
|
||||
NamedArgument = 0x2f,
|
||||
NamespaceDefinition = 0x30,
|
||||
NamespaceReference = 0x31,
|
||||
Parameter = 0x32,
|
||||
PointerSignature = 0x33,
|
||||
Property = 0x34,
|
||||
PropertySignature = 0x35,
|
||||
QualifiedField = 0x36,
|
||||
QualifiedMethod = 0x37,
|
||||
SZArraySignature = 0x38,
|
||||
ScopeDefinition = 0x39,
|
||||
ScopeReference = 0x3a,
|
||||
TypeDefinition = 0x3b,
|
||||
TypeForwarder = 0x3c,
|
||||
TypeInstantiationSignature = 0x3d,
|
||||
TypeReference = 0x3e,
|
||||
TypeSpecification = 0x3f,
|
||||
TypeVariableSignature = 0x40,
|
||||
ConstantEnumArray = 0xc,
|
||||
ConstantHandleArray = 0xd,
|
||||
ConstantInt16Array = 0xe,
|
||||
ConstantInt16Value = 0xf,
|
||||
ConstantInt32Array = 0x10,
|
||||
ConstantInt32Value = 0x11,
|
||||
ConstantInt64Array = 0x12,
|
||||
ConstantInt64Value = 0x13,
|
||||
ConstantReferenceValue = 0x14,
|
||||
ConstantSByteArray = 0x15,
|
||||
ConstantSByteValue = 0x16,
|
||||
ConstantSingleArray = 0x17,
|
||||
ConstantSingleValue = 0x18,
|
||||
ConstantStringArray = 0x19,
|
||||
ConstantStringValue = 0x1a,
|
||||
ConstantUInt16Array = 0x1b,
|
||||
ConstantUInt16Value = 0x1c,
|
||||
ConstantUInt32Array = 0x1d,
|
||||
ConstantUInt32Value = 0x1e,
|
||||
ConstantUInt64Array = 0x1f,
|
||||
ConstantUInt64Value = 0x20,
|
||||
CustomAttribute = 0x21,
|
||||
Event = 0x22,
|
||||
Field = 0x23,
|
||||
FieldSignature = 0x24,
|
||||
FixedArgument = 0x25,
|
||||
FunctionPointerSignature = 0x26,
|
||||
GenericParameter = 0x27,
|
||||
MemberReference = 0x28,
|
||||
Method = 0x29,
|
||||
MethodImpl = 0x2a,
|
||||
MethodInstantiation = 0x2b,
|
||||
MethodSemantics = 0x2c,
|
||||
MethodSignature = 0x2d,
|
||||
MethodTypeVariableSignature = 0x2e,
|
||||
ModifiedType = 0x2f,
|
||||
NamedArgument = 0x30,
|
||||
NamespaceDefinition = 0x31,
|
||||
NamespaceReference = 0x32,
|
||||
Parameter = 0x33,
|
||||
PointerSignature = 0x34,
|
||||
Property = 0x35,
|
||||
PropertySignature = 0x36,
|
||||
QualifiedField = 0x37,
|
||||
QualifiedMethod = 0x38,
|
||||
SZArraySignature = 0x39,
|
||||
ScopeDefinition = 0x3a,
|
||||
ScopeReference = 0x3b,
|
||||
TypeDefinition = 0x3c,
|
||||
TypeForwarder = 0x3d,
|
||||
TypeInstantiationSignature = 0x3e,
|
||||
TypeReference = 0x3f,
|
||||
TypeSpecification = 0x40,
|
||||
TypeVariableSignature = 0x41,
|
||||
} // HandleType
|
||||
} // Internal.Metadata.NativeFormat
|
||||
|
@@ -1 +1 @@
|
||||
f428223f966844c92e4f2308c31994590b74a6df
|
||||
edbe004dc24c8e36fd4c4e3d8a77a35239b98821
|
@@ -58,6 +58,7 @@ namespace Internal.NativeFormat
|
||||
BaseTypeSize = 0x4f,
|
||||
GenericVarianceInfo = 0x50,
|
||||
DelegateInvokeSignature = 0x51,
|
||||
GcStaticEEType = 0x52,
|
||||
|
||||
// Add new custom bag elements that don't match to something you'd find in the ECMA metadata here.
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Debug = Internal.Runtime.CompilerHelpers.StartupDebug;
|
||||
@@ -25,10 +24,10 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
|
||||
[NativeCallable(EntryPoint = "InitializeModules", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static void InitializeModules(IntPtr osModule, IntPtr moduleHeaders, int count)
|
||||
internal static unsafe void InitializeModules(IntPtr osModule, IntPtr* pModuleHeaders, int count, IntPtr* pClasslibFunctions, int nClasslibFunctions)
|
||||
{
|
||||
RuntimeImports.RhpRegisterOsModule(osModule);
|
||||
TypeManagerHandle[] modules = CreateTypeManagers(osModule, moduleHeaders, count);
|
||||
TypeManagerHandle[] modules = CreateTypeManagers(osModule, pModuleHeaders, count, pClasslibFunctions, nClasslibFunctions);
|
||||
|
||||
for (int i = 0; i < modules.Length; i++)
|
||||
{
|
||||
@@ -48,7 +47,7 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
}
|
||||
|
||||
private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, IntPtr moduleHeaders, int count)
|
||||
private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, IntPtr* pModuleHeaders, int count, IntPtr* pClasslibFunctions, int nClasslibFunctions)
|
||||
{
|
||||
// Count the number of modules so we can allocate an array to hold the TypeManager objects.
|
||||
// At this stage of startup, complex collection classes will not work.
|
||||
@@ -58,7 +57,7 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
// The null pointers are sentinel values and padding inserted as side-effect of
|
||||
// the section merging. (The global static constructors section used by C++ has
|
||||
// them too.)
|
||||
if (((IntPtr*)moduleHeaders)[i] != IntPtr.Zero)
|
||||
if (pModuleHeaders[i] != IntPtr.Zero)
|
||||
moduleCount++;
|
||||
}
|
||||
|
||||
@@ -66,8 +65,8 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
int moduleIndex = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (((IntPtr*)moduleHeaders)[i] != IntPtr.Zero)
|
||||
modules[moduleIndex++] = RuntimeImports.RhpCreateTypeManager(osModule, ((IntPtr*)moduleHeaders)[i]);
|
||||
if (pModuleHeaders[i] != IntPtr.Zero)
|
||||
modules[moduleIndex++] = RuntimeImports.RhpCreateTypeManager(osModule, pModuleHeaders[i], pClasslibFunctions, nClasslibFunctions);
|
||||
}
|
||||
|
||||
return modules;
|
||||
@@ -142,9 +141,11 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
}
|
||||
}
|
||||
|
||||
#if CORERT
|
||||
private static unsafe void InitializeStatics(IntPtr gcStaticRegionStart, int length)
|
||||
{
|
||||
IntPtr gcStaticRegionEnd = (IntPtr)((byte*)gcStaticRegionStart + length);
|
||||
|
||||
for (IntPtr* block = (IntPtr*)gcStaticRegionStart; block < (IntPtr*)gcStaticRegionEnd; block++)
|
||||
{
|
||||
// Gc Static regions can be shared by modules linked together during compilation. To ensure each
|
||||
@@ -152,21 +153,26 @@ namespace Internal.Runtime.CompilerHelpers
|
||||
// The first time we initialize the static region its pointer is replaced with an object reference
|
||||
// whose lowest bit is no longer set.
|
||||
IntPtr* pBlock = (IntPtr*)*block;
|
||||
if (((*pBlock).ToInt64() & 0x1L) == 1)
|
||||
long blockAddr = (*pBlock).ToInt64();
|
||||
if ((blockAddr & GCStaticRegionConstants.Uninitialized) == GCStaticRegionConstants.Uninitialized)
|
||||
{
|
||||
object obj = RuntimeImports.RhNewObject(new EETypePtr(new IntPtr((*pBlock).ToInt64() & ~0x1L)));
|
||||
object obj = RuntimeImports.RhNewObject(new EETypePtr(new IntPtr(blockAddr & ~GCStaticRegionConstants.Mask)));
|
||||
|
||||
if ((blockAddr & GCStaticRegionConstants.HasPreInitializedData) == GCStaticRegionConstants.HasPreInitializedData)
|
||||
{
|
||||
// The next pointer is preinitialized data blob that contains preinitialized static GC fields,
|
||||
// which are pointer relocs to GC objects in frozen segment.
|
||||
// It actually has all GC fields including non-preinitialized fields and we simply copy over the
|
||||
// entire blob to this object, overwriting everything.
|
||||
IntPtr pPreInitDataAddr = *(pBlock + 1);
|
||||
RuntimeImports.RhBulkMoveWithWriteBarrier(ref obj.GetRawData(), ref *(byte *)pPreInitDataAddr, obj.GetRawDataSize());
|
||||
}
|
||||
|
||||
*pBlock = RuntimeImports.RhHandleAlloc(obj, GCHandleType.Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int CStrLen(byte* str)
|
||||
{
|
||||
int len = 0;
|
||||
for (; str[len] != 0; len++) { }
|
||||
return len;
|
||||
}
|
||||
#endif // CORERT
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@@ -208,6 +208,9 @@ namespace Internal.Runtime
|
||||
ETF_DynamicModule,
|
||||
ETF_GenericDefinition,
|
||||
ETF_GenericComposition,
|
||||
ETF_DynamicGcStatics,
|
||||
ETF_DynamicNonGcStatics,
|
||||
ETF_DynamicThreadStaticOffset,
|
||||
}
|
||||
|
||||
internal enum CorElementType
|
||||
@@ -298,4 +301,9 @@ namespace Internal.Runtime
|
||||
public const int Pointer = 0;
|
||||
public const int ByRef = 1;
|
||||
}
|
||||
|
||||
internal static class StringComponentSize
|
||||
{
|
||||
public const int Value = sizeof(char);
|
||||
}
|
||||
}
|
||||
|
@@ -36,12 +36,12 @@ namespace Internal.Runtime
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((unchecked((uint)_interfaceType._pInterfaceEEType) & 1u) != 0)
|
||||
if ((unchecked((uint)_interfaceType._pInterfaceEEType) & IndirectionConstants.IndirectionCellPointer) != 0)
|
||||
{
|
||||
#if BIT64
|
||||
EEType** ppInterfaceEETypeViaIAT = (EEType**)(((ulong)_interfaceType._ppInterfaceEETypeViaIAT) & ~1ul);
|
||||
EEType** ppInterfaceEETypeViaIAT = (EEType**)(((ulong)_interfaceType._ppInterfaceEETypeViaIAT) - IndirectionConstants.IndirectionCellPointer);
|
||||
#else
|
||||
EEType** ppInterfaceEETypeViaIAT = (EEType**)(((uint)_interfaceType._ppInterfaceEETypeViaIAT) & ~1u);
|
||||
EEType** ppInterfaceEETypeViaIAT = (EEType**)(((uint)_interfaceType._ppInterfaceEETypeViaIAT) - IndirectionConstants.IndirectionCellPointer);
|
||||
#endif
|
||||
return *ppInterfaceEETypeViaIAT;
|
||||
}
|
||||
@@ -352,6 +352,15 @@ namespace Internal.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsString
|
||||
{
|
||||
get
|
||||
{
|
||||
// String is currently the only non-array type with a non-zero component size.
|
||||
return ComponentSize == StringComponentSize.Value && !IsArray && !IsGenericTypeDefinition;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsArray
|
||||
{
|
||||
get
|
||||
@@ -1084,6 +1093,54 @@ namespace Internal.Runtime
|
||||
#endif
|
||||
}
|
||||
|
||||
internal IntPtr DynamicGcStaticsData
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0);
|
||||
UInt32 cbOffset = GetFieldOffset(EETypeField.ETF_DynamicGcStatics);
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
return (IntPtr)((byte*)pThis + cbOffset);
|
||||
}
|
||||
}
|
||||
#if TYPE_LOADER_IMPLEMENTATION
|
||||
set
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0);
|
||||
UInt32 cbOffset = GetFieldOffset(EETypeField.ETF_DynamicGcStatics);
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
*(IntPtr*)((byte*)pThis + cbOffset) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
internal IntPtr DynamicNonGcStaticsData
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0);
|
||||
UInt32 cbOffset = GetFieldOffset(EETypeField.ETF_DynamicNonGcStatics);
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
return (IntPtr)((byte*)pThis + cbOffset);
|
||||
}
|
||||
}
|
||||
#if TYPE_LOADER_IMPLEMENTATION
|
||||
set
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0);
|
||||
UInt32 cbOffset = GetFieldOffset(EETypeField.ETF_DynamicNonGcStatics);
|
||||
fixed (EEType* pThis = &this)
|
||||
{
|
||||
*(IntPtr*)((byte*)pThis + cbOffset) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
internal DynamicModule* DynamicModule
|
||||
{
|
||||
get
|
||||
@@ -1302,8 +1359,32 @@ namespace Internal.Runtime
|
||||
Debug.Assert(IsDynamicType);
|
||||
return cbOffset;
|
||||
}
|
||||
if (IsDynamicType)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
// after this we have statics information for dynamic types
|
||||
if (eField == EETypeField.ETF_DynamicGcStatics)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithGcStatics) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicNonGcStatics)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithNonGcStatics) != 0)
|
||||
cbOffset += (UInt32)IntPtr.Size;
|
||||
|
||||
if (eField == EETypeField.ETF_DynamicThreadStaticOffset)
|
||||
{
|
||||
Debug.Assert((RareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0);
|
||||
return cbOffset;
|
||||
}
|
||||
if ((RareFlags & EETypeRareFlags.IsDynamicTypeWithThreadStatics) != 0)
|
||||
cbOffset += 4;
|
||||
|
||||
Debug.Assert(false, "Unknown EEType field type");
|
||||
return 0;
|
||||
@@ -1357,9 +1438,9 @@ namespace Internal.Runtime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (((int)_value & 1) == 0)
|
||||
if (((int)_value & IndirectionConstants.IndirectionCellPointer) == 0)
|
||||
return (EEType*)_value;
|
||||
return *(EEType**)(_value - 1);
|
||||
return *(EEType**)(_value - IndirectionConstants.IndirectionCellPointer);
|
||||
}
|
||||
#if TYPE_LOADER_IMPLEMENTATION
|
||||
set
|
||||
|
@@ -57,7 +57,6 @@ namespace Internal.Runtime
|
||||
ThreadStaticOffsetRegion = 208,
|
||||
ThreadStaticGCDescRegion = 209,
|
||||
ThreadStaticIndex = 210,
|
||||
ThreadStaticStartOffset = 211,
|
||||
|
||||
// Sections 300 - 399 are reserved for RhFindBlob backwards compatibility
|
||||
ReadonlyBlobRegionStart = 300,
|
||||
|
@@ -12,4 +12,37 @@ namespace Internal.Runtime
|
||||
/// </summary>
|
||||
public const int Offset = 2;
|
||||
}
|
||||
|
||||
internal static class IndirectionConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag set on pointers to indirection cells to distinguish them
|
||||
/// from pointers to the object directly
|
||||
/// </summary>
|
||||
public const int IndirectionCellPointer = 0x1;
|
||||
|
||||
/// <summary>
|
||||
/// Flag set on RVAs to indirection cells to distinguish them
|
||||
/// from RVAs to the object directly
|
||||
/// </summary>
|
||||
public const uint RVAPointsToIndirection = 0x80000000u;
|
||||
}
|
||||
|
||||
internal static class GCStaticRegionConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag set if the corresponding GCStatic entry has not yet been initialized and
|
||||
/// the corresponding EEType pointer has been changed into a instance pointer of
|
||||
/// that EEType.
|
||||
/// </summary>
|
||||
public const int Uninitialized = 0x1;
|
||||
|
||||
/// <summary>
|
||||
/// Flag set if the next pointer loc points to GCStaticsPreInitDataNode.
|
||||
/// Otherise it is the next GCStatic entry.
|
||||
/// </summary>
|
||||
public const int HasPreInitializedData = 0x2;
|
||||
|
||||
public const int Mask = Uninitialized | HasPreInitializedData;
|
||||
}
|
||||
}
|
||||
|
16
external/corert/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.CreateGuid.cs
vendored
Normal file
16
external/corert/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.CreateGuid.cs
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal unsafe partial class Sys
|
||||
{
|
||||
[DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_CreateGuid")]
|
||||
internal static extern void CreateGuid(out Guid guid);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
// 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;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal unsafe partial class Sys
|
||||
{
|
||||
[DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetExecutableAbsolutePath", SetLastError = true)]
|
||||
internal static extern unsafe int GetExecutableAbsolutePath([Out] char[] buffer, int bufferSize);
|
||||
}
|
||||
}
|
@@ -30,7 +30,7 @@ internal static partial class Interop
|
||||
[DllImport(Libraries.CoreLibNative, EntryPoint = "CoreLibNative_LowLevelMonitor_Signal_Release")]
|
||||
internal static extern void LowLevelMonitor_Signal_Release(IntPtr monitor);
|
||||
|
||||
internal delegate uint ThreadProc(IntPtr parameter);
|
||||
internal delegate IntPtr ThreadProc(IntPtr parameter);
|
||||
|
||||
[DllImport(Libraries.CoreLibNative, EntryPoint = "CoreLibNative_RuntimeThread_CreateThread")]
|
||||
internal static extern bool RuntimeThread_CreateThread(IntPtr stackSize, IntPtr startAddress, IntPtr parameter);
|
||||
|
18
external/corert/src/Common/src/Interop/Windows/kernel32/Interop.GetModuleFileName.cs
vendored
Normal file
18
external/corert/src/Common/src/Interop/Windows/kernel32/Interop.GetModuleFileName.cs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal static unsafe partial class mincore
|
||||
{
|
||||
public const uint ERROR_INSUFFICIENT_BUFFER = 0x7a;
|
||||
[DllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", CharSet = CharSet.Unicode)]
|
||||
public extern static int GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
|
||||
}
|
||||
}
|
81
external/corert/src/Common/src/Interop/Windows/kernel32/Interop.Memory.cs
vendored
Normal file
81
external/corert/src/Common/src/Interop/Windows/kernel32/Interop.Memory.cs
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal partial class Interop
|
||||
{
|
||||
internal partial class Kernel32
|
||||
{
|
||||
[DllImport(Libraries.Kernel32)]
|
||||
unsafe internal static extern void* VirtualAlloc(void* address, UIntPtr numBytes, int commitOrReserve, int pageProtectionMode);
|
||||
|
||||
[DllImport(Libraries.Kernel32)]
|
||||
unsafe internal static extern bool VirtualFree(void* address, UIntPtr numBytes, int pageFreeMode);
|
||||
|
||||
unsafe internal static bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer)
|
||||
{
|
||||
buffer.length = sizeof(MEMORYSTATUSEX);
|
||||
return GlobalMemoryStatusExNative(ref buffer);
|
||||
}
|
||||
|
||||
[DllImport(Libraries.Kernel32, SetLastError = true, EntryPoint = "GlobalMemoryStatusEx")]
|
||||
private static extern bool GlobalMemoryStatusExNative(ref MEMORYSTATUSEX buffer);
|
||||
|
||||
[DllImport(Libraries.Kernel32, SetLastError = true)]
|
||||
unsafe internal static extern UIntPtr VirtualQuery(void* address, ref MEMORY_BASIC_INFORMATION buffer, UIntPtr sizeOfBuffer);
|
||||
|
||||
[DllImport(Libraries.Kernel32, SetLastError = true)]
|
||||
unsafe internal static extern UIntPtr GetSystemInfo(ref SYSTEM_INFO info);
|
||||
|
||||
internal const int MEM_COMMIT = 0x1000;
|
||||
internal const int MEM_RESERVE = 0x2000;
|
||||
internal const int MEM_RELEASE = 0x8000;
|
||||
internal const int MEM_FREE = 0x10000;
|
||||
internal const int PAGE_READWRITE = 0x04;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct SYSTEM_INFO
|
||||
{
|
||||
internal int dwOemId;
|
||||
internal int dwPageSize;
|
||||
internal UIntPtr lpMinimumApplicationAddress;
|
||||
internal UIntPtr lpMaximumApplicationAddress;
|
||||
internal UIntPtr dwActiveProcessorMask;
|
||||
internal int dwNumberOfProcessors;
|
||||
internal int dwProcessorType;
|
||||
internal int dwAllocationGranularity;
|
||||
internal short wProcessorLevel;
|
||||
internal short wProcessorRevision;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct MEMORYSTATUSEX
|
||||
{
|
||||
// The length field must be set to the size of this data structure.
|
||||
internal int length;
|
||||
internal int memoryLoad;
|
||||
internal ulong totalPhys;
|
||||
internal ulong availPhys;
|
||||
internal ulong totalPageFile;
|
||||
internal ulong availPageFile;
|
||||
internal ulong totalVirtual;
|
||||
internal ulong availVirtual;
|
||||
internal ulong availExtendedVirtual;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct MEMORY_BASIC_INFORMATION
|
||||
{
|
||||
internal void* BaseAddress;
|
||||
internal void* AllocationBase;
|
||||
internal uint AllocationProtect;
|
||||
internal UIntPtr RegionSize;
|
||||
internal uint State;
|
||||
internal uint Protect;
|
||||
internal uint Type;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user