├── .gitattributes ├── .gitignore ├── ILCompiler ├── Common │ ├── CommandLine │ │ ├── CommandLineException.cs │ │ └── CommandLineHelpers.cs │ ├── Internal │ │ ├── LowLevelLinq │ │ │ ├── LowLevelEnumerable.ToArray.cs │ │ │ ├── LowLevelEnumerable.ToList.cs │ │ │ └── LowLevelEnumerable.cs │ │ ├── Metadata │ │ │ └── NativeFormat │ │ │ │ ├── Generator │ │ │ │ ├── CsWriter.cs │ │ │ │ ├── MdBinaryReaderGen.cs │ │ │ │ ├── MdBinaryWriterGen.cs │ │ │ │ ├── NativeFormatGen.csproj │ │ │ │ ├── Program.cs │ │ │ │ ├── PublicGen.cs │ │ │ │ ├── ReaderGen.cs │ │ │ │ ├── SchemaDef.cs │ │ │ │ └── WriterGen.cs │ │ │ │ ├── MdBinaryReader.cs │ │ │ │ ├── MdBinaryReaderGen.cs │ │ │ │ ├── MetadataTypeHashingAlgorithms.cs │ │ │ │ ├── NativeFormatReaderCommonGen.cs │ │ │ │ ├── NativeFormatReaderGen.cs │ │ │ │ ├── NativeMetadataReader.cs │ │ │ │ └── UpdateNativeFormatSources.cmd │ │ ├── NativeFormat │ │ │ ├── NativeFormat.cs │ │ │ ├── NativeFormatReader.Metadata.cs │ │ │ ├── NativeFormatReader.Primitives.cs │ │ │ ├── NativeFormatReader.String.cs │ │ │ ├── NativeFormatReader.cs │ │ │ ├── NativeFormatWriter.Primitives.cs │ │ │ ├── NativeFormatWriter.cs │ │ │ ├── NativeFormatWriterExtensions.cs │ │ │ └── TypeHashingAlgorithms.cs │ │ ├── Runtime │ │ │ ├── CanonTypeKind.cs │ │ │ ├── CompilerHelpers │ │ │ │ ├── StartupCodeHelpers.cs │ │ │ │ └── StartupDebug.cs │ │ │ ├── EEType.Constants.cs │ │ │ ├── EEType.cs │ │ │ ├── EETypeBuilderHelpers.cs │ │ │ ├── EETypeOptionalFieldsBuilder.cs │ │ │ ├── GCDescEncoder.cs │ │ │ ├── ITargetBinaryWriter.cs │ │ │ ├── InterfaceDispatchCellCachePointerFlags.cs │ │ │ ├── InteropConstants.cs │ │ │ ├── LowLevelStringConverter.cs │ │ │ ├── MappingTableFlags.cs │ │ │ ├── MetadataBlob.cs │ │ │ ├── ModuleHeaders.cs │ │ │ ├── RuntimeConstants.cs │ │ │ ├── TransitionBlock.cs │ │ │ ├── TypeManagerHandle.RVA.cs │ │ │ ├── TypeManagerHandle.cs │ │ │ └── UniversalGenericParameterLayout.cs │ │ └── Text │ │ │ ├── Utf8String.cs │ │ │ └── Utf8StringBuilder.cs │ ├── Interop │ │ ├── Unix │ │ │ ├── Interop.Libraries.cs │ │ │ └── System.Private.CoreLib.Native │ │ │ │ ├── Interop.Abort.cs │ │ │ │ ├── Interop.DynamicLoad.cs │ │ │ │ ├── Interop.ErrNo.cs │ │ │ │ ├── Interop.Exit.cs │ │ │ │ ├── Interop.GetEnv.cs │ │ │ │ ├── Interop.GetEnviron.cs │ │ │ │ ├── Interop.GetExecutableAbsolutePath.cs │ │ │ │ ├── Interop.GetTickCount64.cs │ │ │ │ ├── Interop.MemAllocFree.cs │ │ │ │ ├── Interop.MemAllocWithZeroInitializeNoThrow.cs │ │ │ │ ├── Interop.MemReAlloc.cs │ │ │ │ ├── Interop.SchedGetCpu.cs │ │ │ │ └── Interop.Threading.cs │ │ └── Windows │ │ │ ├── Interop.Libraries.cs │ │ │ ├── Kernel32 │ │ │ ├── Interop.CompletionPort.cs │ │ │ ├── Interop.ConditionVariable.cs │ │ │ ├── Interop.CriticalSection.cs │ │ │ ├── Interop.ExitProcess.cs │ │ │ ├── Interop.GetModuleFileName.cs │ │ │ ├── Interop.GetSystemTimes.cs │ │ │ ├── Interop.MultiByteToWideChar.cs │ │ │ └── Interop.Threading.cs │ │ │ ├── Mincore │ │ │ ├── Interop.CLSIDFromProgID.cs │ │ │ ├── Interop.CommandLine.cs │ │ │ ├── Interop.DynamicLoad.cs │ │ │ ├── Interop.Environment.cs │ │ │ ├── Interop.GetCurrentProcessorNumber.cs │ │ │ ├── Interop.GetLastError.cs │ │ │ ├── Interop.GetSystemDirectory.cs │ │ │ ├── Interop.GetTickCount64.cs │ │ │ ├── Interop.IsDebuggerPresent.cs │ │ │ ├── Interop.MemAllocFree.cs │ │ │ ├── Interop.MemAllocWithZeroInitializeNoThrow.cs │ │ │ ├── Interop.MemReAlloc.cs │ │ │ ├── Interop.RaiseFailFastException.cs │ │ │ ├── Interop.SetLastError.cs │ │ │ ├── Interop.ThreadPool.cs │ │ │ ├── Interop.ThreadPoolIO.cs │ │ │ ├── Interop.TimeZone.cs │ │ │ └── Interop.Timer.cs │ │ │ └── Ole32 │ │ │ ├── Interop.CoGetApartmentType.cs │ │ │ ├── Interop.CoInitializeEx.cs │ │ │ ├── Interop.CoTaskMemAllocFree.cs │ │ │ └── Interop.CoUninitialize.cs │ ├── JitInterface │ │ ├── CorInfoTypes.VarInfo.cs │ │ └── MemoryHelper.cs │ ├── System │ │ ├── Collections │ │ │ ├── Concurrent │ │ │ │ ├── ConcurrentUnifier.cs │ │ │ │ ├── ConcurrentUnifierW.cs │ │ │ │ ├── ConcurrentUnifierWKeyed.cs │ │ │ │ └── IKeyedItem.cs │ │ │ ├── Generic │ │ │ │ ├── ArrayBuilder.cs │ │ │ │ ├── Empty.cs │ │ │ │ ├── EnumerableExtensions.cs │ │ │ │ ├── LowLevelDictionary.cs │ │ │ │ ├── LowLevelList.cs │ │ │ │ └── LowLevelStack.cs │ │ │ └── HashHelpers.cs │ │ ├── CommonRuntimeTypes.cs │ │ ├── FormattingHelpers.cs │ │ ├── NotImplemented.cs │ │ ├── Runtime │ │ │ ├── CompilerServices │ │ │ │ ├── DeveloperExperienceModeOnlyAttribute.cs │ │ │ │ ├── DeveloperExperienceState.cs │ │ │ │ ├── __BlockAllReflectionAttribute.cs │ │ │ │ └── __BlockReflectionAttribute.cs │ │ │ └── InteropServices │ │ │ │ ├── McgGeneratedNativeCallCodeAttribute.cs │ │ │ │ └── McgIntrinsicsAttribute.cs │ │ └── SR.cs │ └── TypeSystem │ │ ├── Canon │ │ ├── ArrayType.Canon.cs │ │ ├── ByRefType.Canon.cs │ │ ├── CanonTypes.Interop.cs │ │ ├── CanonTypes.Sorting.cs │ │ ├── CanonTypes.cs │ │ ├── DefType.Canon.cs │ │ ├── FunctionPointerType.Canon.cs │ │ ├── GenericParameterDesc.Canon.cs │ │ ├── InstantiatedMethod.Canon.cs │ │ ├── InstantiatedType.Canon.cs │ │ ├── MetadataType.Canon.cs │ │ ├── MethodDelegator.Canon.cs │ │ ├── MethodDesc.Canon.cs │ │ ├── MethodForInstantiatedType.Canon.cs │ │ ├── ParameterizedType.Canon.cs │ │ ├── PointerType.Canon.cs │ │ ├── SignatureVariable.Canon.cs │ │ ├── StandardCanonicalizationAlgorithm.cs │ │ ├── TypeDesc.Canon.cs │ │ └── TypeSystemContext.Canon.cs │ │ ├── CodeGen │ │ ├── FieldDesc.CodeGen.cs │ │ ├── INonEmittableType.cs │ │ ├── MethodDelegator.CodeGen.cs │ │ ├── MethodDesc.CodeGen.cs │ │ ├── NativeStructType.CodeGen.cs │ │ ├── TargetDetails.CodeGen.cs │ │ └── TypeDesc.CodeGen.cs │ │ ├── Common │ │ ├── AlignmentHelper.cs │ │ ├── ArrayOfTRuntimeInterfacesAlgorithm.cs │ │ ├── ArrayType.cs │ │ ├── BaseTypeRuntimeInterfacesAlgorithm.cs │ │ ├── ByRefType.cs │ │ ├── CastingHelper.cs │ │ ├── ConstructedTypeRewritingHelpers.cs │ │ ├── DefType.FieldLayout.cs │ │ ├── DefType.cs │ │ ├── ExceptionStringID.cs │ │ ├── FieldDesc.FieldLayout.cs │ │ ├── FieldDesc.ToString.cs │ │ ├── FieldDesc.cs │ │ ├── FieldForInstantiatedType.cs │ │ ├── FieldLayoutAlgorithm.cs │ │ ├── FunctionPointerType.cs │ │ ├── GenericParameterDesc.cs │ │ ├── IAssemblyDesc.cs │ │ ├── InstantiatedMethod.cs │ │ ├── InstantiatedType.FieldLayout.cs │ │ ├── InstantiatedType.Interfaces.cs │ │ ├── InstantiatedType.MethodImpls.cs │ │ ├── InstantiatedType.cs │ │ ├── Instantiation.cs │ │ ├── LayoutInt.cs │ │ ├── LocalVariableDefinition.cs │ │ ├── MetadataFieldLayoutAlgorithm.cs │ │ ├── MetadataRuntimeInterfacesAlgorithm.cs │ │ ├── MetadataType.Interfaces.cs │ │ ├── MetadataType.MethodImpls.cs │ │ ├── MetadataType.cs │ │ ├── MetadataTypeSystemContext.cs │ │ ├── MetadataVirtualMethodAlgorithm.cs │ │ ├── MethodDelegator.cs │ │ ├── MethodDesc.ToString.cs │ │ ├── MethodDesc.cs │ │ ├── MethodForInstantiatedType.cs │ │ ├── ModuleDesc.cs │ │ ├── ParameterizedType.cs │ │ ├── PointerType.cs │ │ ├── PropertySignature.cs │ │ ├── RuntimeInterfacesAlgorithm.cs │ │ ├── SignatureVariable.cs │ │ ├── TargetDetails.ToString.cs │ │ ├── TargetDetails.cs │ │ ├── ThreadSafeFlags.cs │ │ ├── ThrowHelper.Common.cs │ │ ├── ThrowHelper.cs │ │ ├── TypeDesc.Interfaces.cs │ │ ├── TypeDesc.ToString.cs │ │ ├── TypeDesc.cs │ │ ├── TypeFlags.cs │ │ ├── TypeHashingAlgorithms.cs │ │ ├── TypeSystemConstraintsHelpers.cs │ │ ├── TypeSystemContext.cs │ │ ├── TypeSystemEntity.cs │ │ ├── TypeSystemException.cs │ │ ├── TypeSystemHelpers.cs │ │ ├── UniversalCanonLayoutAlgorithm.cs │ │ ├── Utilities │ │ │ ├── CustomAttributeTypeNameFormatter.cs │ │ │ ├── CustomAttributeTypeNameParser.cs │ │ │ ├── DebugNameFormatter.cs │ │ │ ├── ExceptionTypeNameFormatter.Metadata.cs │ │ │ ├── ExceptionTypeNameFormatter.cs │ │ │ ├── GCPointerMap.Algorithm.cs │ │ │ ├── GCPointerMap.cs │ │ │ ├── LockFreeReaderHashtable.cs │ │ │ ├── LockFreeReaderHashtableOfPointers.cs │ │ │ └── TypeNameFormatter.cs │ │ ├── VirtualMethodAlgorithm.cs │ │ └── WellKnownType.cs │ │ ├── Ecma │ │ ├── CachingMetadataStringDecoder.cs │ │ ├── CustomAttributeTypeProvider.cs │ │ ├── EcmaAssembly.Symbols.cs │ │ ├── EcmaAssembly.cs │ │ ├── EcmaField.CodeGen.cs │ │ ├── EcmaField.Serialization.cs │ │ ├── EcmaField.Sorting.cs │ │ ├── EcmaField.cs │ │ ├── EcmaGenericParameter.Sorting.cs │ │ ├── EcmaGenericParameter.cs │ │ ├── EcmaMethod.Sorting.cs │ │ ├── EcmaMethod.cs │ │ ├── EcmaModule.Sorting.cs │ │ ├── EcmaModule.Symbols.cs │ │ ├── EcmaModule.cs │ │ ├── EcmaSignatureEncoder.cs │ │ ├── EcmaSignatureParser.cs │ │ ├── EcmaType.Interfaces.cs │ │ ├── EcmaType.MethodImpls.cs │ │ ├── EcmaType.Serialization.cs │ │ ├── EcmaType.Sorting.cs │ │ ├── EcmaType.cs │ │ ├── IMetadataStringDecoderProvider.cs │ │ ├── MetadataExtensions.cs │ │ ├── PrimitiveTypeProvider.cs │ │ └── SymbolReader │ │ │ ├── PdbSymbolReader.cs │ │ │ ├── PortablePdbSymbolReader.cs │ │ │ └── UnmanagedPdbSymbolReader.cs │ │ ├── IL │ │ ├── CoreRTILProvider.cs │ │ ├── DelegateInfo.cs │ │ ├── EcmaMethodIL.Symbols.cs │ │ ├── EcmaMethodIL.cs │ │ ├── HelperExtensions.cs │ │ ├── ILDisassembler.cs │ │ ├── ILImporter.cs │ │ ├── ILOpcode.cs │ │ ├── ILOpcodeHelper.cs │ │ ├── ILProvider.cs │ │ ├── ILReader.cs │ │ ├── ILStackHelper.cs │ │ ├── InstantiatedMethodIL.cs │ │ ├── MethodIL.Symbols.cs │ │ ├── MethodIL.cs │ │ ├── MethodILDebugView.cs │ │ ├── StackValueKind.cs │ │ ├── Stubs │ │ │ ├── AddrOfIntrinsic.cs │ │ │ ├── ArrayMethodILEmitter.cs │ │ │ ├── AssemblyGetExecutingAssemblyMethodThunk.Sorting.cs │ │ │ ├── AssemblyGetExecutingAssemblyMethodThunk.cs │ │ │ ├── CalliIntrinsic.cs │ │ │ ├── CalliMarshallingMethodThunk.Mangling.cs │ │ │ ├── CalliMarshallingMethodThunk.Sorting.cs │ │ │ ├── CalliMarshallingMethodThunk.cs │ │ │ ├── ComparerIntrinsics.cs │ │ │ ├── DebuggerSteppingHelpers.cs │ │ │ ├── DelegateMarshallingMethodThunk.Mangling.cs │ │ │ ├── DelegateMarshallingMethodThunk.Sorting.cs │ │ │ ├── DelegateMarshallingMethodThunk.cs │ │ │ ├── DelegateMethodILEmitter.cs │ │ │ ├── DelegateThunks.Sorting.cs │ │ │ ├── DelegateThunks.cs │ │ │ ├── DynamicInvokeMethodThunk.Sorting.cs │ │ │ ├── DynamicInvokeMethodThunk.cs │ │ │ ├── EETypePtrOfIntrinsic.cs │ │ │ ├── EnumThunks.Sorting.cs │ │ │ ├── EnumThunks.cs │ │ │ ├── ForwardDelegateCreationThunk.Mangling.cs │ │ │ ├── ForwardDelegateCreationThunk.Sorting.cs │ │ │ ├── ForwardDelegateCreationThunk.cs │ │ │ ├── GetCanonTypeIntrinsic.cs │ │ │ ├── ILEmitter.cs │ │ │ ├── MethodBaseGetCurrentMethodThunk.Mangling.cs │ │ │ ├── MethodBaseGetCurrentMethodThunk.Sorting.cs │ │ │ ├── MethodBaseGetCurrentMethodThunk.cs │ │ │ ├── PInvokeILEmitter.cs │ │ │ ├── PInvokeLazyFixupField.Sorting.cs │ │ │ ├── PInvokeLazyFixupField.cs │ │ │ ├── PInvokeTargetNativeMethod.Mangling.cs │ │ │ ├── PInvokeTargetNativeMethod.Sorting.cs │ │ │ ├── PInvokeTargetNativeMethod.cs │ │ │ ├── StructMarshallingThunk.Mangling.cs │ │ │ ├── StructMarshallingThunk.Sorting.cs │ │ │ ├── StructMarshallingThunk.cs │ │ │ ├── TypeGetTypeMethodThunk.Sorting.cs │ │ │ ├── TypeGetTypeMethodThunk.cs │ │ │ ├── TypeSystemThrowingILEmitter.cs │ │ │ ├── UnsafeIntrinsics.cs │ │ │ ├── ValueTypeGetFieldHelperMethodOverride.Sorting.cs │ │ │ └── ValueTypeGetFieldHelperMethodOverride.cs │ │ ├── TypeSystemContext.DelegateInfo.cs │ │ ├── TypeSystemContext.DynamicInvoke.cs │ │ ├── TypeSystemContext.EnumMethods.cs │ │ ├── TypeSystemContext.GeneratedAssembly.Sorting.cs │ │ ├── TypeSystemContext.GeneratedAssembly.cs │ │ └── TypeSystemContext.ValueTypeMethods.cs │ │ ├── Interop │ │ ├── IL │ │ │ ├── InlineArrayType.Sorting.cs │ │ │ ├── InlineArrayType.cs │ │ │ ├── MarshalHelpers.cs │ │ │ ├── MarshalUtils.cs │ │ │ ├── Marshaller.cs │ │ │ ├── NativeStructType.Mangling.cs │ │ │ ├── NativeStructType.Sorting.cs │ │ │ ├── NativeStructType.cs │ │ │ ├── PInvokeDelegateWrapper.Mangling.cs │ │ │ ├── PInvokeDelegateWrapper.Sorting.cs │ │ │ ├── PInvokeDelegateWrapper.cs │ │ │ ├── PInvokeDelegateWrapperConstructor.Sorting.cs │ │ │ ├── PInvokeDelegateWrapperConstructor.cs │ │ │ └── PInvokeILEmitterConfiguration.cs │ │ ├── InstantiatedType.Interop.cs │ │ ├── InteropStateManager.cs │ │ ├── InteropTypes.cs │ │ ├── MarshalAsDescriptor.cs │ │ ├── MetadataType.Interop.cs │ │ ├── MethodDelegator.Interop.cs │ │ └── MethodDesc.Interop.cs │ │ ├── Mangling │ │ ├── IPrefixMangledMethod.cs │ │ ├── IPrefixMangledSignature.cs │ │ └── IPrefixMangledType.cs │ │ ├── NativeFormat │ │ ├── MetadataExtensions.cs │ │ ├── NativeFormatField.CodeGen.cs │ │ ├── NativeFormatField.cs │ │ ├── NativeFormatGenericParameter.cs │ │ ├── NativeFormatMetadataUnit.cs │ │ ├── NativeFormatMethod.cs │ │ ├── NativeFormatModule.cs │ │ ├── NativeFormatSignatureParser.cs │ │ ├── NativeFormatType.Interfaces.cs │ │ ├── NativeFormatType.MethodImpls.cs │ │ └── NativeFormatType.cs │ │ ├── RuntimeDetermined │ │ ├── ArrayType.RuntimeDetermined.cs │ │ ├── ByRefType.RuntimeDetermined.cs │ │ ├── DefType.RuntimeDetermined.cs │ │ ├── FieldDesc.RuntimeDetermined.cs │ │ ├── FunctionPointerType.RuntimeDetermined.cs │ │ ├── GenericParameterDesc.RuntimeDetermined.cs │ │ ├── MethodDesc.RuntimeDetermined.cs │ │ ├── MethodForRuntimeDeterminedType.Sorting.cs │ │ ├── MethodForRuntimeDeterminedType.cs │ │ ├── ParameterizedType.RuntimeDetermined.cs │ │ ├── PointerType.RuntimeDetermined.cs │ │ ├── RuntimeDeterminedCanonicalizationAlgorithm.cs │ │ ├── RuntimeDeterminedFieldLayoutAlgorithm.cs │ │ ├── RuntimeDeterminedType.Sorting.cs │ │ ├── RuntimeDeterminedType.cs │ │ ├── RuntimeDeterminedTypeUtilities.cs │ │ ├── SignatureVariable.RuntimeDetermined.cs │ │ ├── TypeDesc.RuntimeDetermined.cs │ │ └── TypeSystemContext.RuntimeDetermined.cs │ │ ├── Serialization │ │ ├── FieldDesc.Serialization.cs │ │ └── TypeDesc.Serialization.cs │ │ ├── Sorting │ │ ├── ArrayType.Sorting.cs │ │ ├── ByRefType.Sorting.cs │ │ ├── FieldDesc.Sorting.cs │ │ ├── FieldForInstantiatedType.Sorting.cs │ │ ├── FunctionPointerType.Sorting.cs │ │ ├── InstantiatedMethod.Sorting.cs │ │ ├── InstantiatedType.Sorting.cs │ │ ├── MethodDesc.Sorting.cs │ │ ├── MethodForInstantiatedType.Sorting.cs │ │ ├── MethodSignature.Sorting.cs │ │ ├── PointerType.Sorting.cs │ │ ├── SignatureVariable.Sorting.cs │ │ ├── TypeDesc.Sorting.cs │ │ └── TypeSystemComparer.cs │ │ └── TypesDebugInfoWriter │ │ ├── DebugInfoWriter.cs │ │ ├── PrimitiveTypeDescriptor.cs │ │ └── TypesDebugInfoWriter.cs ├── ILCompiler.Compiler │ ├── Compiler │ │ ├── AnalysisBasedInteropStubManager.cs │ │ ├── AnalysisBasedMetadataManager.cs │ │ ├── BlockedInternalsBlockingPolicy.cs │ │ ├── CodeGenerationFailedException.cs │ │ ├── ComparerCompilationRootProvider.cs │ │ ├── Compilation.cs │ │ ├── CompilationBuilder.cs │ │ ├── CompilationModuleGroup.cs │ │ ├── CompilerGeneratedInteropStubManager.cs │ │ ├── CompilerMetadataFieldLayoutAlgorithm.cs │ │ ├── CompilerTypeSystemContext.BoxedTypes.cs │ │ ├── CompilerTypeSystemContext.Mangling.cs │ │ ├── CompilerTypeSystemContext.Sorting.cs │ │ ├── CompilerTypeSystemContext.TypeInit.cs │ │ ├── CompilerTypeSystemContext.cs │ │ ├── CoreRTNameMangler.cs │ │ ├── DebugInformationProvider.cs │ │ ├── DelegateCreationInfo.cs │ │ ├── DependencyAnalysis │ │ │ ├── ArrayMapNode.cs │ │ │ ├── ArrayOfEmbeddedDataNode.cs │ │ │ ├── ArrayOfEmbeddedPointersNode.cs │ │ │ ├── ArrayOfFrozenObjectsNode.cs │ │ │ ├── AssemblyStubNode.cs │ │ │ ├── BlobNode.cs │ │ │ ├── BlockReflectionTypeMapNode.cs │ │ │ ├── CallingConventionConverterKey.cs │ │ │ ├── CanonicalDefinitionEETypeNode.cs │ │ │ ├── CanonicalEETypeNode.cs │ │ │ ├── ClassConstructorContextMap.cs │ │ │ ├── ClonedConstructedEETypeNode.cs │ │ │ ├── CodeBasedDependencyAlgorithm.cs │ │ │ ├── CompilerComparer.cs │ │ │ ├── ConstructedEETypeNode.cs │ │ │ ├── CustomAttributeBasedDependencyAlgorithm.cs │ │ │ ├── DefaultConstructorMapNode.cs │ │ │ ├── DelegateMarshallingDataNode.cs │ │ │ ├── DelegateMarshallingStubMapNode.cs │ │ │ ├── DictionaryLayoutNode.cs │ │ │ ├── DynamicInvokeTemplateDataNode.cs │ │ │ ├── EETypeNode.cs │ │ │ ├── EETypeOptionalFieldsNode.cs │ │ │ ├── EmbeddedDataContainerNode.cs │ │ │ ├── EmbeddedObjectNode.cs │ │ │ ├── EmbeddedPointerIndirectionNode.cs │ │ │ ├── ExactMethodInstantiationsNode.cs │ │ │ ├── ExternEETypeSymbolNode.cs │ │ │ ├── ExternMethodSymbolNode.cs │ │ │ ├── ExternSymbolNode.cs │ │ │ ├── ExternSymbolsImportedNodeProvider.cs │ │ │ ├── ExternSymbolsWithIndirectionImportedNodeProvider.cs │ │ │ ├── ExternalReferencesTableNode.cs │ │ │ ├── FatFunctionPointerNode.cs │ │ │ ├── FieldMetadataNode.cs │ │ │ ├── FrozenArrayNode.cs │ │ │ ├── FrozenStringNode.cs │ │ │ ├── GCStaticDescNode.cs │ │ │ ├── GCStaticEETypeNode.cs │ │ │ ├── GCStaticsNode.cs │ │ │ ├── GCStaticsPreInitDataNode.cs │ │ │ ├── GVMDependenciesNode.cs │ │ │ ├── GenericCompositionNode.cs │ │ │ ├── GenericDefinitionEETypeNode.cs │ │ │ ├── GenericDictionaryNode.cs │ │ │ ├── GenericLookupResult.cs │ │ │ ├── GenericMethodsHashtableNode.cs │ │ │ ├── GenericMethodsTemplateMap.cs │ │ │ ├── GenericTypesHashtableNode.cs │ │ │ ├── GenericTypesTemplateMap.cs │ │ │ ├── GenericVirtualMethodTableNode.cs │ │ │ ├── HelperEntrypoint.cs │ │ │ ├── IEETypeNode.cs │ │ │ ├── IExportableSymbolNode.cs │ │ │ ├── ILScanNodeFactory.cs │ │ │ ├── IMethodBodyNode.cs │ │ │ ├── IMethodBodyNodeWithFuncletSymbols.cs │ │ │ ├── IMethodNode.cs │ │ │ ├── INodeWithCodeInfo.cs │ │ │ ├── INodeWithDebugInfo.cs │ │ │ ├── INodeWithRuntimeDeterminedDependencies.cs │ │ │ ├── IObjectDumper.cs │ │ │ ├── ISortableNode.cs │ │ │ ├── ISpecialUnboxThunkNode.cs │ │ │ ├── ISymbolNode.cs │ │ │ ├── ISymbolNodeWithDebugInfo.cs │ │ │ ├── ISymbolNodeWithFuncletId.cs │ │ │ ├── ImportedEETypeSymbolNode.cs │ │ │ ├── ImportedGenericDictionaryNode.cs │ │ │ ├── ImportedNodeProvider.cs │ │ │ ├── ImportedStaticsNode.cs │ │ │ ├── ImportedThreadStaticsNode.cs │ │ │ ├── IndirectionExtensions.cs │ │ │ ├── IndirectionNode.cs │ │ │ ├── InterfaceDispatchCellNode.cs │ │ │ ├── InterfaceDispatchCellSectionNode.cs │ │ │ ├── InterfaceDispatchMapNode.cs │ │ │ ├── InterfaceGenericVirtualMethodTableNode.cs │ │ │ ├── JumpStubNode.cs │ │ │ ├── LoopHijackFlagNode.cs │ │ │ ├── MetadataNode.cs │ │ │ ├── MethodAssociatedDataNode.cs │ │ │ ├── MethodMetadataNode.cs │ │ │ ├── ModuleMetadataNode.cs │ │ │ ├── ModulesSectionNode.cs │ │ │ ├── MrtImportImportedNodeProvider.cs │ │ │ ├── MrtImports.cs │ │ │ ├── MrtProcessedExportAddressTableNode.cs │ │ │ ├── MrtProcessedImportAddressTableNode.cs │ │ │ ├── NamedJumpStubNode.cs │ │ │ ├── NativeLayoutInfoNode.cs │ │ │ ├── NativeLayoutSignatureNode.cs │ │ │ ├── NativeLayoutVertexNode.cs │ │ │ ├── NecessaryCanonicalEETypeNode.cs │ │ │ ├── NodeFactory.GenericLookups.cs │ │ │ ├── NodeFactory.NativeLayout.cs │ │ │ ├── NodeFactory.WindowsDebugData.cs │ │ │ ├── NodeFactory.cs │ │ │ ├── NonExternMethodSymbolNode.cs │ │ │ ├── NonGCStaticsNode.cs │ │ │ ├── ObjectAndOffsetSymbolNode.cs │ │ │ ├── ObjectDataBuilder.cs │ │ │ ├── ObjectNode.cs │ │ │ ├── ObjectNodeSection.cs │ │ │ ├── ObjectWriter.cs │ │ │ ├── PInvokeMethodFixupNode.cs │ │ │ ├── PInvokeModuleFixupNode.cs │ │ │ ├── ReadyToRunGenericHelperNode.cs │ │ │ ├── ReadyToRunHeaderNode.cs │ │ │ ├── ReadyToRunHelperNode.cs │ │ │ ├── ReflectableMethodNode.cs │ │ │ ├── ReflectionFieldMapNode.cs │ │ │ ├── ReflectionInvokeMapNode.cs │ │ │ ├── ReflectionMethodBodyScanner.cs │ │ │ ├── ReflectionVirtualInvokeMapNode.cs │ │ │ ├── Relocation.cs │ │ │ ├── ResourceDataNode.cs │ │ │ ├── ResourceIndexNode.cs │ │ │ ├── RuntimeDecodableJumpStub.cs │ │ │ ├── RuntimeDeterminedMethodNode.cs │ │ │ ├── RuntimeFieldHandleNode.cs │ │ │ ├── RuntimeImportMethodNode.cs │ │ │ ├── RuntimeMethodHandleNode.cs │ │ │ ├── ScannedMethodNode.cs │ │ │ ├── SealedVTableNode.cs │ │ │ ├── ShadowConcreteMethodNode.cs │ │ │ ├── ShadowConcreteUnboxingThunkNode.cs │ │ │ ├── SortableDependencyNode.cs │ │ │ ├── StackTraceEmbeddedMetadataNode.cs │ │ │ ├── StackTraceMethodMappingNode.cs │ │ │ ├── StaticsInfoHashtableNode.cs │ │ │ ├── StringAllocatorMethodNode.cs │ │ │ ├── StructMarshallingDataNode.cs │ │ │ ├── StructMarshallingStubMapNode.cs │ │ │ ├── Target_ARM │ │ │ │ ├── ARMDebug.cs │ │ │ │ ├── ARMEmitter.cs │ │ │ │ ├── ARMInitialInterfaceDispatchStubNode.cs │ │ │ │ ├── ARMJumpStubNode.cs │ │ │ │ ├── ARMNodeFactory.cs │ │ │ │ ├── ARMReadyToRunGenericHelperNode.cs │ │ │ │ ├── ARMReadyToRunHelperNode.cs │ │ │ │ ├── ARMUnboxingStubNode.cs │ │ │ │ ├── Register.cs │ │ │ │ └── TargetRegisterMap.cs │ │ │ ├── Target_ARM64 │ │ │ │ ├── ARM64Emitter.cs │ │ │ │ ├── ARM64JumpStubNode.cs │ │ │ │ ├── ARM64ReadyToRunGenericHelperNode.cs │ │ │ │ ├── ARM64ReadyToRunHelperNode.cs │ │ │ │ ├── ARM64UnboxingStubNode.cs │ │ │ │ ├── AddrMode.cs │ │ │ │ ├── Register.cs │ │ │ │ └── TargetRegisterMap.cs │ │ │ ├── Target_X64 │ │ │ │ ├── AddrMode.cs │ │ │ │ ├── Register.cs │ │ │ │ ├── TargetRegisterMap.cs │ │ │ │ ├── X64Emitter.cs │ │ │ │ ├── X64JumpStubNode.cs │ │ │ │ ├── X64ReadyToRunGenericHelperNode.cs │ │ │ │ ├── X64ReadyToRunHelperNode.cs │ │ │ │ └── X64UnboxingStubNode.cs │ │ │ ├── Target_X86 │ │ │ │ ├── AddrMode.cs │ │ │ │ ├── Register.cs │ │ │ │ ├── TargetRegisterMap.cs │ │ │ │ ├── X86Emitter.cs │ │ │ │ ├── X86JumpStubNode.cs │ │ │ │ ├── X86ReadyToRunGenericHelperNode.cs │ │ │ │ ├── X86ReadyToRunHelperNode.cs │ │ │ │ └── X86UnboxingStubNode.cs │ │ │ ├── ThreadStaticsIndexNode.cs │ │ │ ├── ThreadStaticsNode.cs │ │ │ ├── ThreadStaticsOffsetNode.cs │ │ │ ├── TypeGVMEntriesNode.cs │ │ │ ├── TypeManagerIndirectionNode.cs │ │ │ ├── TypeMetadataMapNode.cs │ │ │ ├── TypeMetadataNode.cs │ │ │ ├── TypeThreadStaticIndexNode.cs │ │ │ ├── UnboxingStubNode.cs │ │ │ ├── UtcNodeFactory.cs │ │ │ ├── UtcThreadStaticsNode.cs │ │ │ ├── VTableSliceNode.cs │ │ │ ├── VirtualMethodUseNode.cs │ │ │ ├── WindowsDebugILImagesSection.cs │ │ │ ├── WindowsDebugManagedNativeDictionaryInfoSection.cs │ │ │ ├── WindowsDebugMergedAssemblyRecordsSection.cs │ │ │ ├── WindowsDebugMethodInfoSection.cs │ │ │ ├── WindowsDebugMethodMapSection.cs │ │ │ ├── WindowsDebugNeedTypeIndicesStoreNode.cs │ │ │ ├── WindowsDebugPseudoAssemblySection.cs │ │ │ ├── WindowsDebugTypeRecordsSection.cs │ │ │ └── WindowsDebugTypeSignatureMapSection.cs │ │ ├── DependencyTrackingLevel.cs │ │ ├── DevirtualizationManager.cs │ │ ├── DictionaryLayoutProvider.cs │ │ ├── DirectPInvokePolicy.cs │ │ ├── DynamicInvokeThunkGenerationPolicy.cs │ │ ├── EmptyInteropStubManager.cs │ │ ├── EmptyMetadataManager.cs │ │ ├── ExportedMethodsRootProvider.cs │ │ ├── ExportsFileWriter.cs │ │ ├── ExternSymbolMappedField.cs │ │ ├── FrameworkStringResourceBlockingPolicy.cs │ │ ├── GeneratingMetadataManager.cs │ │ ├── GenericDictionaryLookup.cs │ │ ├── HardwareIntrinsicHelpers.cs │ │ ├── ICompilationRootProvider.cs │ │ ├── ILAssemblyGeneratingMethodDebugInfoProvider.cs │ │ ├── ILScanner.cs │ │ ├── ILScannerBuilder.cs │ │ ├── ILStreamReader.cs │ │ ├── IRootingServiceProvider.cs │ │ ├── InternalCompilerErrorException.cs │ │ ├── InteropStubManager.cs │ │ ├── JitHelper.cs │ │ ├── LazyGenericsPolicy.cs │ │ ├── LibraryInitializers.cs │ │ ├── LibraryRootProvider.cs │ │ ├── MainMethodRootProvider.cs │ │ ├── ManagedBinaryEmitter.cs │ │ ├── ManifestResourceBlockingPolicy.cs │ │ ├── MergedAssemblyRecords.cs │ │ ├── MetadataBlockingPolicy.cs │ │ ├── MetadataManager.cs │ │ ├── MethodExtensions.cs │ │ ├── MultiFileCompilationModuleGroup.cs │ │ ├── NameMangler.cs │ │ ├── NativeLibraryInitializerRootProvider.cs │ │ ├── NoManifestResourceBlockingPolicy.cs │ │ ├── NoMetadataBlockingPolicy.cs │ │ ├── NodeMangler.cs │ │ ├── ObjectDumper.cs │ │ ├── PreInitFieldInfo.cs │ │ ├── PrecomputedMetadataManager.cs │ │ ├── ReadyToRun.cs │ │ ├── RootingHelpers.cs │ │ ├── RootingServiceProvider.cs │ │ ├── RuntimeConfigurationRootProvider.cs │ │ ├── SimdHelper.cs │ │ ├── SingleFileCompilationModuleGroup.cs │ │ ├── SingleMethodCompilationModuleGroup.cs │ │ ├── SingleMethodRootProvider.cs │ │ ├── StackTraceEmissionPolicy.cs │ │ ├── TypeExtensions.cs │ │ ├── UniversalGenericsRootProvider.cs │ │ ├── UnixNodeMangler.cs │ │ ├── UsageBasedInteropStubManager.cs │ │ ├── UsageBasedMetadataManager.cs │ │ ├── UserDefinedTypeDescriptor.cs │ │ ├── UtcNameMangler.cs │ │ ├── UtcNodeMangler.cs │ │ ├── UtcStackTraceEmissionPolicy.cs │ │ ├── VTableSliceProvider.cs │ │ ├── VectorFieldLayoutAlgorithm.cs │ │ ├── VectorOfTFieldLayoutAlgorithm.cs │ │ ├── VirtualMethodCallHelper.cs │ │ └── WindowsNodeMangler.cs │ ├── IL │ │ ├── ILImporter.Scanner.cs │ │ ├── McgInteropSupport.cs │ │ └── Stubs │ │ │ ├── PInvokeILProvider.cs │ │ │ └── StartupCode │ │ │ ├── AppContextInitializerMethod.Sorting.cs │ │ │ ├── AppContextInitializerMethod.cs │ │ │ ├── NativeLibraryStartupMethod.Sorting.cs │ │ │ ├── NativeLibraryStartupMethod.cs │ │ │ ├── StartupCodeMainMethod.Sorting.cs │ │ │ └── StartupCodeMainMethod.cs │ ├── ILCompiler.Compiler.csproj │ └── Logger.cs ├── ILCompiler.DependencyAnalysisFramework │ ├── ComputedStaticDependencyNode.cs │ ├── DependencyAnalyzer.cs │ ├── DependencyAnalyzerBase.cs │ ├── DependencyNode.cs │ ├── DependencyNodeCore.cs │ ├── DgmlWriter.cs │ ├── EventSourceLogStrategy.cs │ ├── FirstMarkLogStrategy.cs │ ├── FullGraphLogStrategy.cs │ ├── IDependencyAnalysisMarkStrategy.cs │ ├── IDependencyAnalyzerLogEdgeVisitor.cs │ ├── IDependencyAnalyzerLogNodeVisitor.cs │ ├── IDependencyNode.cs │ ├── ILCompiler.DependencyAnalysisFramework.csproj │ ├── NoLogStrategy.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── ILCompiler.Host │ ├── ILCompiler.Host.csproj │ ├── ILCompiler.Host.sln │ ├── ILCompiler │ │ ├── ByteArrayEqualityComparer.cs │ │ ├── CtlClassification.cs │ │ ├── DependencyAnalysis │ │ │ ├── ObjectWriterUTC.cs │ │ │ ├── PartiallyPrecomputedDictionaryLayoutNode.cs │ │ │ ├── UtcDictionaryLayoutEngine.cs │ │ │ ├── UtcGenericLookupNode.cs │ │ │ ├── UtcVersionedDictionaryLayoutNode.cs │ │ │ └── WriteablePrecomputedDictionaryLayoutNode.cs │ │ ├── DictionaryQueryResult.cs │ │ ├── FloatingLookupKey.cs │ │ ├── GenericLookupLayoutType.cs │ │ ├── HostedCompilation.cs │ │ ├── HostedCompilationGroup.cs │ │ ├── HostedCompilationType.cs │ │ ├── HostedCoreRTBasedMultifileCompilationGroup.cs │ │ ├── HostedDependencyNodeComparer.cs │ │ ├── HostedMultifleCompilationGroup.cs │ │ ├── IILCompilerHost.cs │ │ ├── ILCompilerHost.cs │ │ ├── ISTSTokenProvider.cs │ │ ├── LinkageNames.cs │ │ ├── LinkageTokenType.cs │ │ ├── MergedAssemblyRecordParser.cs │ │ ├── MethodKey.cs │ │ ├── MultifilePolicy.cs │ │ ├── NetNativeCompilerContext.cs │ │ ├── NetNativeFieldLayoutAlgorithm.cs │ │ ├── RootingServiceProvider.cs │ │ ├── ScannerOutcome.cs │ │ ├── SymbolIdentifier.cs │ │ ├── SystemPrivateCanonModuleDesc.cs │ │ ├── Toc │ │ │ ├── ElementsToExport.cs │ │ │ ├── ImportExportInfo.cs │ │ │ ├── NativeImportExportKind.cs │ │ │ ├── TocData.cs │ │ │ ├── TocEmitter.cs │ │ │ ├── TocOutputFlags.cs │ │ │ └── TocReader.cs │ │ ├── TocModuleKind.cs │ │ └── TypeSystemContextModuleProviderAdapter.cs │ ├── Internal.CommandLine │ │ ├── CommandLineException.cs │ │ └── Helpers.cs │ ├── Internal.TypeSystem.Bridge │ │ ├── ComposerModule.cs │ │ ├── ComposerTemporaryTokenMap_T_.cs │ │ ├── ComposerTokenResolver.cs │ │ ├── ComposerTypeSystemContext.cs │ │ ├── DummyGenericContext.cs │ │ ├── IEcmaModuleProvider.cs │ │ ├── IEcmaTokenResolver.cs │ │ ├── IReverseTypeSystemBridgeProvider.cs │ │ ├── ITypeSystemBridgeProvider.cs │ │ ├── MetadataComposer.cs │ │ ├── SignatureExtensions.cs │ │ ├── SignatureTypeProvider_T_.cs │ │ ├── TempToPermanentMapping.cs │ │ ├── TokenType.cs │ │ └── TypeSystemBridgeProvider.cs │ ├── Microsoft.NetNative │ │ └── ErrorTraceListener.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── System.Collections.Generic │ │ └── ArrayBuilder_T_.cs │ ├── app.config │ └── packages.config ├── ILCompiler.MetadataTransform │ ├── ILCompiler.MetadataTransform.csproj │ └── ILCompiler │ │ └── Metadata │ │ ├── EntityMap.cs │ │ ├── ExplicitScopeAssemblyPolicyMixin.cs │ │ ├── IMetadataPolicy.cs │ │ ├── MetadataTransform.cs │ │ ├── MetadataTransformResult.cs │ │ ├── Transform.Constant.cs │ │ ├── Transform.CustomAttribute.cs │ │ ├── Transform.Event.cs │ │ ├── Transform.Field.cs │ │ ├── Transform.Method.cs │ │ ├── Transform.Namespace.cs │ │ ├── Transform.Parameter.cs │ │ ├── Transform.Property.cs │ │ ├── Transform.Scope.cs │ │ ├── Transform.String.cs │ │ ├── Transform.Type.cs │ │ ├── Transform.TypeForwarders.cs │ │ └── Transform.cs ├── ILCompiler.MetadataWriter │ ├── ILCompiler.MetadataWriter.csproj │ └── Internal │ │ └── Metadata │ │ └── NativeFormat │ │ └── Writer │ │ ├── ConstantValues.cs │ │ ├── MdBinaryWriter.cs │ │ ├── MdBinaryWriterGen.cs │ │ ├── NativeFormatWriterGen.cs │ │ └── NativeMetadataWriter.cs └── ILCompiler.TypeSystem │ ├── ILCompiler.TypeSystem.csproj │ └── Utilities │ └── UniqueTypeNameFormatter.cs ├── LICENSE.txt ├── Libs ├── ARM │ ├── mrt100X_app.exp │ └── mrt100X_app.lib ├── mrt100X_app.def ├── x64 │ ├── mrt100X_app.exp │ └── mrt100X_app.lib └── x86 │ ├── mrt100X_app.exp │ └── mrt100X_app.lib ├── ProjectRT.sln ├── README.md ├── bootstrap ├── bootstrap.cpp ├── bootstrap.vcxproj └── bootstrap.vcxproj.filters ├── bootstrap_dll ├── bootstrap_dll.cpp ├── bootstrap_dll.vcxproj └── bootstrap_dll.vcxproj.filters ├── shimAppDll ├── shimAppDll.cpp ├── shimAppDll.vcxproj └── shimAppDll.vcxproj.filters └── shimExe ├── shimExe.cpp ├── shimExe.vcxproj └── shimExe.vcxproj.filters /ILCompiler/Common/CommandLine/CommandLineException.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.CommandLine 8 | { 9 | internal class CommandLineException : Exception 10 | { 11 | public CommandLineException(string message) 12 | : base(message) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/LowLevelLinq/LowLevelEnumerable.ToArray.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Diagnostics; 7 | using System.Collections.Generic; 8 | 9 | namespace Internal.LowLevelLinq 10 | { 11 | internal static partial class LowLevelEnumerable 12 | { 13 | public static T[] ToArray(this IEnumerable values) 14 | { 15 | Debug.Assert(values != null); 16 | 17 | LowLevelList list = new LowLevelList(); 18 | foreach (T value in values) 19 | { 20 | list.Add(value); 21 | } 22 | return list.ToArray(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/LowLevelLinq/LowLevelEnumerable.ToList.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Diagnostics; 7 | using System.Collections.Generic; 8 | 9 | namespace Internal.LowLevelLinq 10 | { 11 | internal static partial class LowLevelEnumerable 12 | { 13 | public static List ToList(this IEnumerable source) 14 | { 15 | List result; 16 | 17 | var collection = source as ICollection; 18 | if (collection != null) 19 | result = new List(collection.Count); 20 | else 21 | result = new List(); 22 | 23 | foreach (var element in source) 24 | result.Add(element); 25 | 26 | return result; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/Metadata/NativeFormat/UpdateNativeFormatSources.cmd: -------------------------------------------------------------------------------- 1 | csc Generator\*.cs /out:Generator.exe 2 | Generator.exe 3 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/NativeFormat/NativeFormatWriterExtensions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.IO; 6 | 7 | namespace Internal.NativeFormat 8 | { 9 | #if NATIVEFORMAT_PUBLICWRITER 10 | public 11 | #else 12 | internal 13 | #endif 14 | static class NativeFormatWriterExtensions 15 | { 16 | public static byte[] Save(this NativeWriter writer) 17 | { 18 | MemoryStream ms = new MemoryStream(); 19 | writer.Save(ms); 20 | return ms.ToArray(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/Runtime/CanonTypeKind.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.Runtime 6 | { 7 | public enum CanonTypeKind 8 | { 9 | NormalCanon, 10 | UniversalCanon, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/Runtime/CompilerHelpers/StartupDebug.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Diagnostics; 6 | 7 | namespace Internal.Runtime.CompilerHelpers 8 | { 9 | /// 10 | /// replacement for the startup path. 11 | /// It's not safe to use the full-blown Debug class during startup because big chunks 12 | /// of the managed execution environment are not initialized yet. 13 | /// 14 | internal static class StartupDebug 15 | { 16 | [Conditional("DEBUG")] 17 | public static void Assert(bool condition) 18 | { 19 | if (!condition) 20 | unsafe { *(int*)0 = 0; } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/Runtime/InterfaceDispatchCellCachePointerFlags.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.Runtime 8 | { 9 | // 10 | // The low 2 bits of the interface dispatch cell's cache pointer are treated specially so that we can avoid the 11 | // need for extra fields on the type. 12 | // 13 | // Keep these in sync with the native copy in src\Native\Runtime\inc\rhbinder.h 14 | // 15 | public enum InterfaceDispatchCellCachePointerFlags 16 | { 17 | CachePointerPointsAtCache = 0x0, 18 | CachePointerIsInterfacePointerOrMetadataToken = 0x1, 19 | CachePointerIsIndirectedInterfaceRelativePointer = 0x2, 20 | CachePointerIsInterfaceRelativePointer = 0x3, 21 | CachePointerMask = 0x3, 22 | CachePointerMaskShift = 0x2, 23 | MaxVTableOffsetPlusOne = 0x1000 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/Internal/Runtime/InteropConstants.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.Runtime 6 | { 7 | internal static class InteropDataConstants 8 | { 9 | /// 10 | /// Flag set in RuntimeInteropData if the entry is for type with marshallers 11 | /// 12 | public const int HasMarshallers = 0x1; 13 | 14 | /// 15 | /// Flag set in RuntimeInteropData if the entry is for type with invalid interop layout 16 | /// 17 | public const int HasInvalidLayout = 0x2; 18 | 19 | /// 20 | /// Shift used to encode field count 21 | /// 22 | public const int FieldCountShift = 2; 23 | 24 | /// 25 | /// Flag set in ModuleFixupCell if DllImportSearchPath is specified for the DllImport. 26 | /// 27 | public const uint HasDllImportSearchPath = 0x80000000; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/Interop.Libraries.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | internal static partial class Interop 6 | { 7 | internal static partial class Libraries 8 | { 9 | internal const string CoreLibNative = "System.Private.CoreLib.Native"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.Abort.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_Abort")] 13 | internal static extern void Abort(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.DynamicLoad.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_LoadLibrary")] 13 | internal static extern IntPtr LoadLibrary(string filename); 14 | 15 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetProcAddress")] 16 | internal static extern IntPtr GetProcAddress(IntPtr handle, byte* symbol); 17 | 18 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetProcAddress")] 19 | internal static extern IntPtr GetProcAddress(IntPtr handle, string symbol); 20 | 21 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_FreeLibrary")] 22 | internal static extern void FreeLibrary(IntPtr handle); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.ErrNo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetErrNo")] 13 | internal static extern int GetErrNo(); 14 | 15 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_ClearErrNo")] 16 | internal static extern void ClearErrNo(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.Exit.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_Exit")] 13 | internal static extern void Exit(int exitCode); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.GetEnv.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetEnv")] 13 | internal static extern unsafe IntPtr GetEnv(string name); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.GetEnviron.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetEnviron")] 13 | internal static extern unsafe IntPtr GetEnviron(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.GetExecutableAbsolutePath.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetExecutableAbsolutePath", SetLastError = true)] 13 | internal static extern unsafe int GetExecutableAbsolutePath([Out] char[] buffer, int bufferSize); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.GetTickCount64.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_GetTickCount64")] 13 | internal static extern ulong GetTickCount64(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.MemAllocFree.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_MemAlloc")] 13 | internal static extern IntPtr MemAlloc(UIntPtr sizeInBytes); 14 | 15 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_MemFree")] 16 | internal static extern void MemFree(IntPtr ptr); 17 | } 18 | 19 | internal static IntPtr MemAlloc(UIntPtr sizeInBytes) 20 | { 21 | IntPtr allocatedMemory = Interop.Sys.MemAlloc(sizeInBytes); 22 | if (allocatedMemory == IntPtr.Zero) 23 | { 24 | throw new OutOfMemoryException(); 25 | } 26 | return allocatedMemory; 27 | } 28 | 29 | internal static void MemFree(IntPtr allocatedMemory) 30 | { 31 | Interop.Sys.MemFree(allocatedMemory); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.MemReAlloc.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_MemReAlloc")] 13 | internal static extern IntPtr MemReAlloc(IntPtr ptr, UIntPtr newSize); 14 | } 15 | 16 | internal static unsafe IntPtr MemReAlloc(IntPtr ptr, UIntPtr newSize) 17 | { 18 | IntPtr allocatedMemory = Interop.Sys.MemReAlloc(ptr, newSize); 19 | if (allocatedMemory == IntPtr.Zero) 20 | { 21 | throw new OutOfMemoryException(); 22 | } 23 | return allocatedMemory; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Unix/System.Private.CoreLib.Native/Interop.SchedGetCpu.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal unsafe partial class Sys 11 | { 12 | [DllImport(Interop.Libraries.CoreLibNative, EntryPoint = "CoreLibNative_SchedGetCpu")] 13 | internal static extern int SchedGetCpu(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Interop.Libraries.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | internal static partial class Interop 6 | { 7 | internal static partial class Libraries 8 | { 9 | internal const string ErrorHandling = "api-ms-win-core-errorhandling-l1-1-0.dll"; 10 | internal const string Handle = "api-ms-win-core-handle-l1-1-0.dll"; 11 | internal const string IO = "api-ms-win-core-io-l1-1-0.dll"; 12 | internal const string Memory = "api-ms-win-core-memory-l1-1-0.dll"; 13 | internal const string ProcessEnvironment = "api-ms-win-core-processenvironment-l1-1-0.dll"; 14 | internal const string ProcessThreads = "api-ms-win-core-processthreads-l1-1-0.dll"; 15 | internal const string RealTime = "api-ms-win-core-realtime-l1-1-0.dll"; 16 | internal const string SysInfo = "api-ms-win-core-sysinfo-l1-2-0.dll"; 17 | internal const string ThreadPool = "api-ms-win-core-threadpool-l1-2-0.dll"; 18 | internal const string Localization = "api-ms-win-core-localization-l1-2-1.dll"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Kernel32/Interop.ConditionVariable.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal partial class Interop 9 | { 10 | internal partial class Kernel32 11 | { 12 | [StructLayout(LayoutKind.Sequential)] 13 | internal struct CONDITION_VARIABLE 14 | { 15 | private IntPtr Ptr; 16 | } 17 | 18 | [DllImport(Libraries.Kernel32)] 19 | internal static extern void InitializeConditionVariable(out CONDITION_VARIABLE ConditionVariable); 20 | 21 | [DllImport(Libraries.Kernel32, SetLastError = true)] 22 | internal static extern void WakeConditionVariable(ref CONDITION_VARIABLE ConditionVariable); 23 | 24 | [DllImport(Libraries.Kernel32, SetLastError = true)] 25 | [return: MarshalAs(UnmanagedType.Bool)] 26 | internal static extern bool SleepConditionVariableCS(ref CONDITION_VARIABLE ConditionVariable, ref CRITICAL_SECTION CriticalSection, int dwMilliseconds); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Kernel32/Interop.ExitProcess.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class Kernel32 12 | { 13 | [DllImport(Libraries.Kernel32, EntryPoint = "ExitProcess")] 14 | internal static extern void ExitProcess(int exitCode); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Kernel32/Interop.GetModuleFileName.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | using Microsoft.Win32; 9 | 10 | internal static partial class Interop 11 | { 12 | internal static unsafe partial class mincore 13 | { 14 | public const uint ERROR_INSUFFICIENT_BUFFER = 0x7a; 15 | [DllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", CharSet = CharSet.Unicode)] 16 | public extern static int GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal partial class Interop 9 | { 10 | internal partial class Kernel32 11 | { 12 | [DllImport(Libraries.Kernel32, SetLastError = true)] 13 | [return: MarshalAs(UnmanagedType.Bool)] 14 | internal static extern bool GetSystemTimes(out ulong idleTime, out ulong kernelTime, out ulong userTime); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal partial class Interop 9 | { 10 | internal partial class Kernel32 11 | { 12 | [DllImport(Libraries.Kernel32)] 13 | internal static extern unsafe int MultiByteToWideChar( 14 | uint CodePage, uint dwFlags, 15 | byte* lpMultiByteStr, int cbMultiByte, 16 | char* lpWideCharStr, int cchWideChar); 17 | 18 | internal const uint MB_PRECOMPOSED = 0x00000001; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.CLSIDFromProgID.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal static partial class mincore 11 | { 12 | [DllImport("api-ms-win-core-com-l1-1-0.dll", CharSet = CharSet.Unicode)] 13 | internal extern static int CLSIDFromProgID(string lpszProgID, out Guid clsid); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.CommandLine.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal static unsafe partial class mincore 11 | { 12 | [DllImport(Libraries.ProcessEnvironment, EntryPoint = "GetCommandLineW")] 13 | internal static extern unsafe char* GetCommandLine(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.DynamicLoad.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | using Microsoft.Win32.SafeHandles; 9 | 10 | internal static partial class Interop 11 | { 12 | internal static unsafe partial class mincore 13 | { 14 | [DllImport("api-ms-win-core-libraryloader-l1-2-0.dll")] 15 | internal static extern IntPtr GetProcAddress(IntPtr hModule, byte* lpProcName); 16 | 17 | [DllImport("api-ms-win-core-libraryloader-l1-2-0.dll", EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, SetLastError = true)] 18 | internal static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, int dwFlags); 19 | 20 | [DllImport("api-ms-win-core-libraryloader-l1-2-0.dll")] 21 | internal static extern bool FreeLibrary(IntPtr hModule); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.Environment.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class mincore 12 | { 13 | [DllImport(Libraries.ProcessEnvironment, CharSet = CharSet.Unicode, EntryPoint = "GetEnvironmentVariableW")] 14 | internal static extern unsafe int GetEnvironmentVariable(string lpName, [Out] char[] lpValue, int size); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.GetCurrentProcessorNumber.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal static partial class mincore 11 | { 12 | [DllImport("api-ms-win-core-processthreads-l1-1-1.dll")] 13 | internal extern static uint GetCurrentProcessorNumber(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.GetLastError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Runtime.InteropServices; 6 | 7 | internal partial class Interop 8 | { 9 | internal partial class mincore 10 | { 11 | [DllImport("api-ms-win-core-errorhandling-l1-1-0.dll")] 12 | internal extern static int GetLastError(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.GetSystemDirectory.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static partial class mincore 12 | { 13 | [DllImport("api-ms-win-core-sysinfo-l1-2-1", EntryPoint = "GetSystemDirectoryW", CharSet = CharSet.Unicode)] 14 | internal static extern int GetSystemDirectory([Out]StringBuilder sb, int length); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.GetTickCount64.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class mincore 12 | { 13 | [DllImport("api-ms-win-core-sysinfo-l1-1-0.dll")] 14 | internal extern static ulong GetTickCount64(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.IsDebuggerPresent.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal static partial class mincore 11 | { 12 | [DllImport("api-ms-win-core-debug-l1-1-0.dll")] 13 | internal extern static bool IsDebuggerPresent(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.MemAllocWithZeroInitializeNoThrow.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class mincore 12 | { 13 | internal const int HEAP_ZERO_MEMORY = 0x8; // Flag to zero memory 14 | } 15 | 16 | internal static IntPtr MemAllocWithZeroInitializeNoThrow(UIntPtr sizeInBytes) 17 | { 18 | return Interop.mincore.HeapAlloc(Interop.mincore.GetProcessHeap(), Interop.mincore.HEAP_ZERO_MEMORY, sizeInBytes); 19 | } 20 | 21 | internal static IntPtr MemReAllocWithZeroInitializeNoThrow(IntPtr ptr, UIntPtr oldSize, UIntPtr newSize) 22 | { 23 | return Interop.mincore.HeapReAlloc(Interop.mincore.GetProcessHeap(), Interop.mincore.HEAP_ZERO_MEMORY, ptr, newSize); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.MemReAlloc.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class mincore 12 | { 13 | [DllImport("api-ms-win-core-heap-l1-1-0.dll")] 14 | internal static extern unsafe IntPtr HeapReAlloc(IntPtr hHeap, uint dwFlags, IntPtr lpMem, UIntPtr dwBytes); 15 | } 16 | 17 | internal static unsafe IntPtr MemReAlloc(IntPtr ptr, UIntPtr newSize) 18 | { 19 | IntPtr allocatedMemory = Interop.mincore.HeapReAlloc(Interop.mincore.GetProcessHeap(), 0, ptr, newSize); 20 | if (allocatedMemory == IntPtr.Zero) 21 | { 22 | throw new OutOfMemoryException(); 23 | } 24 | return allocatedMemory; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.SetLastError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Runtime.InteropServices; 6 | 7 | internal partial class Interop 8 | { 9 | internal partial class mincore 10 | { 11 | [DllImport("api-ms-win-core-errorhandling-l1-1-0.dll")] 12 | internal extern static void SetLastError(uint dwErrCode); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Mincore/Interop.Timer.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | internal static partial class Interop 9 | { 10 | internal static partial class mincore 11 | { 12 | [DllImport("api-ms-win-core-threadpool-l1-2-0.dll")] 13 | internal extern static IntPtr CreateThreadpoolTimer(IntPtr pfnti, IntPtr pv, IntPtr pcbe); 14 | 15 | [DllImport("api-ms-win-core-threadpool-l1-2-0.dll")] 16 | internal extern static unsafe IntPtr SetThreadpoolTimer(IntPtr pti, long* pftDueTime, uint msPeriod, uint msWindowLength); 17 | 18 | internal delegate void TimerCallback(IntPtr Instance, IntPtr Context, IntPtr Timer); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Ole32/Interop.CoInitializeEx.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static partial class Ole32 12 | { 13 | internal const uint COINIT_APARTMENTTHREADED = 2; 14 | internal const uint COINIT_MULTITHREADED = 0; 15 | 16 | [DllImport(Interop.Libraries.Ole32, ExactSpelling = true)] 17 | internal extern static int CoInitializeEx(IntPtr reserved, uint dwCoInit); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Ole32/Interop.CoTaskMemAllocFree.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static unsafe partial class mincore 12 | { 13 | [McgGeneratedNativeCallCodeAttribute] 14 | [DllImport("ole32.dll")] 15 | internal static extern IntPtr CoTaskMemAlloc(UIntPtr bytes); 16 | 17 | [McgGeneratedNativeCallCodeAttribute] 18 | [DllImport("ole32.dll")] 19 | internal static extern void CoTaskMemFree(IntPtr allocatedMemory); 20 | 21 | [McgGeneratedNativeCallCodeAttribute] 22 | [DllImport("ole32.dll")] 23 | internal static extern IntPtr CoTaskMemRealloc(IntPtr pv, IntPtr cb); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/Interop/Windows/Ole32/Interop.CoUninitialize.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | internal static partial class Interop 10 | { 11 | internal static partial class Ole32 12 | { 13 | [DllImport(Interop.Libraries.Ole32, ExactSpelling = true)] 14 | internal extern static int CoUninitialize(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/Common/JitInterface/MemoryHelper.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.JitInterface 8 | { 9 | internal static unsafe class MemoryHelper 10 | { 11 | public static void FillMemory(byte* dest, byte fill, int count) 12 | { 13 | for (; count > 0; count--) 14 | { 15 | *dest = fill; 16 | dest++; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Collections/Generic/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Diagnostics; 7 | using System.Collections.Generic; 8 | 9 | namespace System.Collections.Generic 10 | { 11 | internal static class EnumerableExtensions 12 | { 13 | // Used to prevent returning values out of IEnumerable<>-typed properties 14 | // that an untrusted caller could cast back to array or List. 15 | public static IEnumerable AsNothingButIEnumerable(this IEnumerable en) 16 | { 17 | foreach (T t in en) 18 | yield return t; 19 | } 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/FormattingHelpers.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Globalization; 6 | 7 | namespace System 8 | { 9 | internal static class FormattingHelpers 10 | { 11 | public static string ToStringInvariant(this T value) where T : IConvertible 12 | { 13 | return value.ToString(CultureInfo.InvariantCulture); 14 | } 15 | 16 | public static string ToStringInvariant(this T value, string format) where T : IFormattable 17 | { 18 | return value.ToString(format, CultureInfo.InvariantCulture); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Runtime/CompilerServices/DeveloperExperienceState.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace System.Runtime.CompilerServices 8 | { 9 | [DeveloperExperienceModeOnly] 10 | internal static class DeveloperExperienceState 11 | { 12 | public static bool DeveloperExperienceModeEnabled 13 | { 14 | get 15 | { 16 | return true; // ILC will rewrite to this "return false" if run with "/buildType:ret" 17 | } 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Runtime/CompilerServices/__BlockAllReflectionAttribute.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | /* 6 | Providing a definition for __BlockAllReflectionAttribute in an assembly is a signal to the .NET Native toolchain 7 | to remove the metadata for all APIs. This both reduces size and disables all reflection on those 8 | APIs in libraries that include this. 9 | */ 10 | 11 | using System; 12 | 13 | namespace System.Runtime.CompilerServices 14 | { 15 | [AttributeUsage(AttributeTargets.All)] 16 | internal class __BlockAllReflectionAttribute : Attribute { } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Runtime/CompilerServices/__BlockReflectionAttribute.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | /* 6 | Providing a definition for __BlockReflectionAttribute in an assembly is a signal to the .NET Native toolchain 7 | to remove the metadata for all non-public APIs. This both reduces size and disables private reflection on those 8 | APIs in libraries that include this. 9 | */ 10 | 11 | using System; 12 | 13 | namespace System.Runtime.CompilerServices 14 | { 15 | [AttributeUsage(AttributeTargets.All)] 16 | internal class __BlockReflectionAttribute : Attribute { } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Runtime/InteropServices/McgGeneratedNativeCallCodeAttribute.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Runtime.CompilerServices; 7 | using System.Runtime.InteropServices; 8 | 9 | namespace System.Runtime.InteropServices 10 | { 11 | /// 12 | /// This is used to mark our Interop APIs as generated by MCG so that MCG can skip them 13 | /// Ideally we should be able to ignore them when they are blittable but we still would emit the structs & 14 | /// enums today and I'd like to avoid that. 15 | /// 16 | [System.AttributeUsageAttribute(System.AttributeTargets.Method)] 17 | public class McgGeneratedNativeCallCodeAttribute : System.Attribute 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/System/Runtime/InteropServices/McgIntrinsicsAttribute.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace System.Runtime.InteropServices 8 | { 9 | [AttributeUsage((System.AttributeTargets.Method | System.AttributeTargets.Class))] 10 | internal class McgIntrinsicsAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/ByRefType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Implements canonicalizing ByRefs 8 | partial class ByRefType 9 | { 10 | protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind) 11 | { 12 | TypeDesc paramTypeConverted = Context.ConvertToCanon(ParameterType, kind); 13 | if (paramTypeConverted != ParameterType) 14 | return Context.GetByRefType(paramTypeConverted); 15 | 16 | return this; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/CanonTypes.Interop.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class CanonBaseType 8 | { 9 | public override PInvokeStringFormat PInvokeStringFormat => default(PInvokeStringFormat); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/CanonTypes.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | // Functionality related to determinstic ordering of types 10 | partial class CanonBaseType 11 | { 12 | protected internal sealed override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | // These should be singletons 15 | Debug.Assert(this == other); 16 | return 0; 17 | } 18 | } 19 | 20 | partial class CanonType 21 | { 22 | protected internal override int ClassCode => 46114331; 23 | } 24 | 25 | partial class UniversalCanonType 26 | { 27 | protected internal override int ClassCode => 1687626054; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/DefType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Implements canonicalization handling for TypeDefs 8 | partial class DefType 9 | { 10 | protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind) 11 | { 12 | return this; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/GenericParameterDesc.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | // Implements canonicalization of generic parameters 10 | public partial class GenericParameterDesc 11 | { 12 | public sealed override bool IsCanonicalSubtype(CanonicalFormKind policy) 13 | { 14 | Debug.Fail("IsCanonicalSubtype of an indefinite type"); 15 | return false; 16 | } 17 | 18 | protected sealed override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind) 19 | { 20 | Debug.Fail("ConvertToCanonFormImpl for an indefinite type"); 21 | return this; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/MetadataType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Holds code for canonicalization of metadata types 8 | partial class MetadataType 9 | { 10 | public override bool IsCanonicalSubtype(CanonicalFormKind policy) 11 | { 12 | return false; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/MethodDelegator.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class MethodDelegator 8 | { 9 | public override bool IsCanonicalMethod(CanonicalFormKind policy) 10 | { 11 | return _wrappedMethod.IsCanonicalMethod(policy); 12 | } 13 | 14 | // For this method, delegating to the wrapped MethodDesc would likely be the wrong thing. 15 | public abstract override MethodDesc GetCanonMethodTarget(CanonicalFormKind kind); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/MethodDesc.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Implements method canonicalization 8 | partial class MethodDesc 9 | { 10 | public virtual bool IsCanonicalMethod(CanonicalFormKind policy) 11 | { 12 | return false; 13 | } 14 | 15 | /// 16 | /// Returns the result of canonicalizing this method over the given kind of Canon 17 | /// 18 | public virtual MethodDesc GetCanonMethodTarget(CanonicalFormKind kind) 19 | { 20 | return this; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/MethodForInstantiatedType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Implements canonicalization for methods on instantiated types 8 | partial class MethodForInstantiatedType 9 | { 10 | public override bool IsCanonicalMethod(CanonicalFormKind policy) 11 | { 12 | return OwningType.IsCanonicalSubtype(policy); 13 | } 14 | 15 | public override MethodDesc GetCanonMethodTarget(CanonicalFormKind kind) 16 | { 17 | TypeDesc canonicalizedTypeOfTargetMethod = OwningType.ConvertToCanonForm(kind); 18 | if (canonicalizedTypeOfTargetMethod == OwningType) 19 | return this; 20 | 21 | return Context.GetMethodForInstantiatedType(GetTypicalMethodDefinition(), (InstantiatedType)canonicalizedTypeOfTargetMethod); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/ParameterizedType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Holds code for canonicalizing a parameterized type 8 | partial class ParameterizedType 9 | { 10 | public sealed override bool IsCanonicalSubtype(CanonicalFormKind policy) 11 | { 12 | return ParameterType.IsCanonicalSubtype(policy); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Canon/PointerType.Canon.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Holds code for canonicalizing pointers 8 | partial class PointerType 9 | { 10 | protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind) 11 | { 12 | TypeDesc paramTypeConverted = Context.ConvertToCanon(ParameterType, kind); 13 | if (paramTypeConverted != ParameterType) 14 | return Context.GetPointerType(paramTypeConverted); 15 | 16 | return this; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/CodeGen/FieldDesc.CodeGen.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Additional members of FieldDesc related to code generation. 8 | partial class FieldDesc 9 | { 10 | /// 11 | /// Gets a value indicating whether this is a field that needs to be treated 12 | /// specially. 13 | /// 14 | public virtual bool IsIntrinsic 15 | { 16 | get 17 | { 18 | return false; 19 | } 20 | } 21 | } 22 | 23 | partial class FieldForInstantiatedType 24 | { 25 | public override bool IsIntrinsic 26 | { 27 | get 28 | { 29 | return _fieldDef.IsIntrinsic; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/CodeGen/INonEmittableType.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// Used to mark TypeDesc types that are not part of the core type system 9 | /// that should never be turned into an EEType. 10 | /// 11 | public interface INonEmittableType 12 | { } 13 | } 14 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/CodeGen/NativeStructType.CodeGen.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | // Implements INonEmittableType 8 | partial class NativeStructType : INonEmittableType 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/CodeGen/TypeDesc.CodeGen.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class TypeDesc 8 | { 9 | /// 10 | /// Gets a value indicating whether this is a type that needs to be treated 11 | /// specially. 12 | /// 13 | public bool IsIntrinsic 14 | { 15 | get 16 | { 17 | return (GetTypeFlags(TypeFlags.IsIntrinsic | TypeFlags.AttributeCacheComputed) & TypeFlags.IsIntrinsic) != 0; 18 | } 19 | } 20 | } 21 | 22 | partial class InstantiatedType 23 | { 24 | partial void AddComputedIntrinsicFlag(ref TypeFlags flags) 25 | { 26 | if (_typeDef.IsIntrinsic) 27 | flags |= TypeFlags.IsIntrinsic; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/AlignmentHelper.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | public static class AlignmentHelper 10 | { 11 | public static int AlignUp(this int val, int alignment) 12 | { 13 | Debug.Assert(val >= 0 && alignment >= 0); 14 | 15 | // alignment must be a power of 2 for this implementation to work (need modulo otherwise) 16 | Debug.Assert(0 == (alignment & (alignment - 1))); 17 | int result = (val + (alignment - 1)) & ~(alignment - 1); 18 | Debug.Assert(result >= val); // check for overflow 19 | 20 | return result; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/BaseTypeRuntimeInterfacesAlgorithm.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Debug = System.Diagnostics.Debug; 7 | 8 | namespace Internal.TypeSystem 9 | { 10 | /// 11 | /// RuntimeInterfaces algorithm for types known to have no explicitly defined interfaces 12 | /// but which do have a base type. (For instance multidimensional arrays) 13 | /// 14 | public sealed class BaseTypeRuntimeInterfacesAlgorithm : RuntimeInterfacesAlgorithm 15 | { 16 | private static RuntimeInterfacesAlgorithm _singleton = new BaseTypeRuntimeInterfacesAlgorithm(); 17 | 18 | private BaseTypeRuntimeInterfacesAlgorithm() { } 19 | 20 | public static RuntimeInterfacesAlgorithm Instance 21 | { 22 | get 23 | { 24 | return _singleton; 25 | } 26 | } 27 | 28 | public override DefType[] ComputeRuntimeInterfaces(TypeDesc _type) 29 | { 30 | return _type.BaseType.RuntimeInterfaces; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/DefType.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// Type that is logically equivalent to a type which is defined by a TypeDef 9 | /// record in an ECMA 335 metadata stream - a class, an interface, or a value type. 10 | /// 11 | public abstract partial class DefType : TypeDesc 12 | { 13 | /// 14 | /// Gets the namespace of the type. 15 | /// 16 | public virtual string Namespace => null; 17 | 18 | /// 19 | /// Gets the name of the type as represented in the metadata. 20 | /// 21 | public virtual string Name => null; 22 | 23 | /// 24 | /// Gets the containing type of this type or null if the type is not nested. 25 | /// 26 | public virtual DefType ContainingType => null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/ExceptionStringID.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// Represents an ID of a localized exception string. 9 | /// 10 | public enum ExceptionStringID 11 | { 12 | // TypeLoadException 13 | ClassLoadGeneral, 14 | ClassLoadExplicitGeneric, 15 | ClassLoadBadFormat, 16 | ClassLoadExplicitLayout, 17 | ClassLoadValueClassTooLarge, 18 | ClassLoadRankTooLarge, 19 | 20 | // MissingMethodException 21 | MissingMethod, 22 | 23 | // MissingFieldException 24 | MissingField, 25 | 26 | // FileNotFoundException 27 | FileLoadErrorGeneric, 28 | 29 | // InvalidProgramException 30 | InvalidProgramDefault, 31 | InvalidProgramSpecific, 32 | InvalidProgramVararg, 33 | InvalidProgramCallVirtFinalize, 34 | InvalidProgramNativeCallable, 35 | 36 | // BadImageFormatException 37 | BadImageFormatGeneric, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/FieldDesc.ToString.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class FieldDesc 8 | { 9 | public override string ToString() 10 | { 11 | return $"{OwningType}.{Name}"; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/IAssemblyDesc.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | /// 10 | /// Optional interface a should implement if it represents an assembly. 11 | /// 12 | public interface IAssemblyDesc 13 | { 14 | /// 15 | /// Gets the assembly name. 16 | /// 17 | AssemblyName GetName(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/InstantiatedType.FieldLayout.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | public partial class InstantiatedType 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/LocalVariableDefinition.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | public struct LocalVariableDefinition 8 | { 9 | /// 10 | /// Gets a value indicating whether the stored target should be pinned in the runtime 11 | /// heap and shouldn't be moved by the actions of the garbage collector. 12 | /// 13 | public readonly bool IsPinned; 14 | 15 | /// 16 | /// Gets the type of the local variable. 17 | /// 18 | public readonly TypeDesc Type; 19 | 20 | public LocalVariableDefinition(TypeDesc type, bool isPinned) 21 | { 22 | IsPinned = isPinned; 23 | Type = type; 24 | } 25 | 26 | public override string ToString() 27 | { 28 | return IsPinned ? "pinned " + Type.ToString() : Type.ToString(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/MetadataType.Interfaces.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Debug = System.Diagnostics.Debug; 7 | 8 | namespace Internal.TypeSystem 9 | { 10 | // Api surface definition for interfaces that all MetadataTypes must implement 11 | 12 | public abstract partial class MetadataType : DefType 13 | { 14 | /// 15 | /// The interfaces explicitly declared as implemented by this MetadataType in the type's metadata. 16 | /// These correspond to the InterfaceImpls of a type in metadata 17 | /// 18 | public abstract DefType[] ExplicitlyImplementedInterfaces 19 | { 20 | get; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/ParameterizedType.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | public abstract partial class ParameterizedType : TypeDesc 10 | { 11 | private TypeDesc _parameterType; 12 | 13 | internal ParameterizedType(TypeDesc parameterType) 14 | { 15 | _parameterType = parameterType; 16 | } 17 | 18 | public TypeDesc ParameterType 19 | { 20 | get 21 | { 22 | return _parameterType; 23 | } 24 | } 25 | 26 | public override TypeSystemContext Context 27 | { 28 | get 29 | { 30 | return _parameterType.Context; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/PropertySignature.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | public struct PropertySignature 8 | { 9 | private TypeDesc[] _parameters; 10 | 11 | public readonly bool IsStatic; 12 | 13 | public readonly TypeDesc ReturnType; 14 | 15 | [System.Runtime.CompilerServices.IndexerName("Parameter")] 16 | public TypeDesc this[int index] 17 | { 18 | get 19 | { 20 | return _parameters[index]; 21 | } 22 | } 23 | 24 | public int Length 25 | { 26 | get 27 | { 28 | return _parameters.Length; 29 | } 30 | } 31 | 32 | public PropertySignature(bool isStatic, TypeDesc[] parameters, TypeDesc returnType) 33 | { 34 | IsStatic = isStatic; 35 | _parameters = parameters; 36 | ReturnType = returnType; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/TargetDetails.ToString.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Debug = System.Diagnostics.Debug; 7 | 8 | namespace Internal.TypeSystem 9 | { 10 | partial class TargetDetails 11 | { 12 | public override string ToString() 13 | { 14 | return $"{Architecture}-{OperatingSystem}-{Abi}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/TypeDesc.ToString.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class TypeDesc 8 | { 9 | public override string ToString() 10 | { 11 | return DebugNameFormatter.Instance.FormatName(this, DebugNameFormatter.FormatOptions.Default); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/TypeSystemEntity.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | public abstract class TypeSystemEntity 8 | { 9 | /// 10 | /// Gets the type system context this entity belongs to. 11 | /// 12 | public abstract TypeSystemContext Context { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Common/Utilities/ExceptionTypeNameFormatter.Metadata.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Type name formatting functionality that relies on metadata. 8 | partial class ExceptionTypeNameFormatter 9 | { 10 | private string GetTypeName(DefType type) 11 | { 12 | return type.Name; 13 | } 14 | 15 | private string GetTypeNamespace(DefType type) 16 | { 17 | return type.Namespace; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaAssembly.Symbols.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection.Metadata; 6 | using System.Reflection.PortableExecutable; 7 | 8 | namespace Internal.TypeSystem.Ecma 9 | { 10 | // Pluggable file that adds PDB handling functionality to EcmaAssembly 11 | partial class EcmaAssembly 12 | { 13 | internal EcmaAssembly(TypeSystemContext context, PEReader peReader, MetadataReader metadataReader, PdbSymbolReader pdbReader) 14 | : base(context, peReader, metadataReader, containingAssembly: null, pdbReader) 15 | { 16 | _assemblyDefinition = metadataReader.GetAssemblyDefinition(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaField.CodeGen.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Ecma 6 | { 7 | partial class EcmaField 8 | { 9 | public override bool IsIntrinsic 10 | { 11 | get 12 | { 13 | return (GetFieldFlags(FieldFlags.AttributeMetadataCache | FieldFlags.Intrinsic) & FieldFlags.Intrinsic) != 0; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaField.Serialization.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Ecma 6 | { 7 | partial class EcmaField 8 | { 9 | public override bool IsNotSerialized 10 | { 11 | get 12 | { 13 | return (GetFieldFlags(FieldFlags.BasicMetadataCache | FieldFlags.NotSerialized) & FieldFlags.NotSerialized) != 0; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaField.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection.Metadata.Ecma335; 6 | 7 | namespace Internal.TypeSystem.Ecma 8 | { 9 | // Functionality related to deterministic ordering of types and members 10 | partial class EcmaField 11 | { 12 | protected internal override int ClassCode => 44626835; 13 | 14 | protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherField = (EcmaField)other; 17 | 18 | EcmaModule module = _type.EcmaModule; 19 | EcmaModule otherModule = otherField._type.EcmaModule; 20 | 21 | int result = module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherField._handle); 22 | if (result != 0) 23 | return result; 24 | 25 | return module.CompareTo(otherModule); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaGenericParameter.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection.Metadata.Ecma335; 6 | 7 | namespace Internal.TypeSystem.Ecma 8 | { 9 | // Functionality related to determinstic ordering of types 10 | partial class EcmaGenericParameter 11 | { 12 | protected internal override int ClassCode => -1548417824; 13 | 14 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherType = (EcmaGenericParameter)other; 17 | int result = _module.MetadataReader.GetToken(_handle) - otherType._module.MetadataReader.GetToken(otherType._handle); 18 | if (result != 0) 19 | return result; 20 | 21 | return _module.CompareTo(otherType._module); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaMethod.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection.Metadata.Ecma335; 6 | 7 | namespace Internal.TypeSystem.Ecma 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class EcmaMethod 11 | { 12 | protected internal override int ClassCode => 1419431046; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (EcmaMethod)other; 17 | 18 | EcmaModule module = _type.EcmaModule; 19 | EcmaModule otherModule = otherMethod._type.EcmaModule; 20 | 21 | int result = module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherMethod._handle); 22 | if (result != 0) 23 | return result; 24 | 25 | return module.CompareTo(otherModule); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaModule.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | using Debug = System.Diagnostics.Debug; 8 | 9 | namespace Internal.TypeSystem.Ecma 10 | { 11 | partial class EcmaModule 12 | { 13 | internal int CompareTo(EcmaModule other) 14 | { 15 | if (this == other) 16 | return 0; 17 | 18 | Guid thisMvid = _metadataReader.GetGuid(_metadataReader.GetModuleDefinition().Mvid); 19 | Guid otherMvid = other._metadataReader.GetGuid(other.MetadataReader.GetModuleDefinition().Mvid); 20 | 21 | Debug.Assert(thisMvid.CompareTo(otherMvid) != 0, "Different instance of EcmaModule but same MVID?"); 22 | return thisMvid.CompareTo(otherMvid); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaType.Serialization.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection; 6 | 7 | namespace Internal.TypeSystem.Ecma 8 | { 9 | partial class EcmaType 10 | { 11 | public override bool IsSerializable 12 | { 13 | get 14 | { 15 | return (_typeDefinition.Attributes & TypeAttributes.Serializable) != 0; 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/EcmaType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Reflection.Metadata.Ecma335; 6 | 7 | namespace Internal.TypeSystem.Ecma 8 | { 9 | // Functionality related to determinstic ordering of types 10 | partial class EcmaType 11 | { 12 | protected internal override int ClassCode => 1340416537; 13 | 14 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherType = (EcmaType)other; 17 | int result = _module.MetadataReader.GetToken(_handle) - otherType._module.MetadataReader.GetToken(otherType._handle); 18 | if (result != 0) 19 | return result; 20 | 21 | return _module.CompareTo(otherType._module); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/IMetadataStringDecoderProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Reflection.Metadata; 7 | 8 | namespace Internal.TypeSystem.Ecma 9 | { 10 | /// 11 | /// Interface implemented by TypeSystemContext to provide MetadataStringDecoder 12 | /// instance for MetadataReaders created by the type system. 13 | /// 14 | public interface IMetadataStringDecoderProvider 15 | { 16 | MetadataStringDecoder GetMetadataStringDecoder(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Ecma/SymbolReader/PdbSymbolReader.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | using Internal.IL; 9 | 10 | namespace Internal.TypeSystem.Ecma 11 | { 12 | /// 13 | /// Abstraction for reading Pdb files 14 | /// 15 | public abstract class PdbSymbolReader : IDisposable 16 | { 17 | public abstract IEnumerable GetSequencePointsForMethod(int methodToken); 18 | public abstract IEnumerable GetLocalVariableNamesForMethod(int methodToken); 19 | public abstract void Dispose(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/ILProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL 8 | { 9 | /// 10 | /// Provides IL for method bodies either by reading 11 | /// the IL bytes from the source ECMA-335 assemblies, or through other means. 12 | /// 13 | public abstract class ILProvider 14 | { 15 | public abstract MethodIL GetMethodIL(MethodDesc method); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/StackValueKind.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.IL 6 | { 7 | // 8 | // Corresponds to "I.12.3.2.1 The evaluation stack" in ECMA spec 9 | // 10 | internal enum StackValueKind 11 | { 12 | /// An unknow type. 13 | Unknown, 14 | /// Any signed or unsigned integer values that can be represented as a 32-bit entity. 15 | Int32, 16 | /// Any signed or unsigned integer values that can be represented as a 64-bit entity. 17 | Int64, 18 | /// Underlying platform pointer type represented as an integer of the appropriate size. 19 | NativeInt, 20 | /// Any float value. 21 | Float, 22 | /// A managed pointer. 23 | ByRef, 24 | /// An object reference. 25 | ObjRef, 26 | /// A value type which is not any of the primitive one. 27 | ValueType 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Internal.TypeSystem; 7 | 8 | namespace Internal.IL.Stubs 9 | { 10 | // Functionality related to deterministic ordering of types 11 | partial class AssemblyGetExecutingAssemblyMethodThunk 12 | { 13 | protected override int ClassCode => 1459986716; 14 | 15 | protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 16 | { 17 | var otherMethod = (AssemblyGetExecutingAssemblyMethodThunk)other; 18 | return StringComparer.Ordinal.Compare(ExecutingAssembly.GetName().Name, otherMethod.ExecutingAssembly.GetName().Name); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Internal.TypeSystem; 7 | 8 | namespace Internal.IL.Stubs 9 | { 10 | public partial class CalliMarshallingMethodThunk : IPrefixMangledSignature 11 | { 12 | MethodSignature IPrefixMangledSignature.BaseSignature 13 | { 14 | get 15 | { 16 | return _targetSignature; 17 | } 18 | } 19 | 20 | string IPrefixMangledSignature.Prefix 21 | { 22 | get 23 | { 24 | return "Calli"; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of methods 10 | partial class CalliMarshallingMethodThunk 11 | { 12 | protected internal override int ClassCode => 1594107963; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (CalliMarshallingMethodThunk)other; 17 | return comparer.Compare(_targetSignature, otherMethod._targetSignature); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/DebuggerSteppingHelpers.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.IL.Stubs 6 | { 7 | public static class DebuggerSteppingHelpers 8 | { 9 | public static void MarkDebuggerStepThroughPoint(this ILCodeStream codeStream) 10 | { 11 | codeStream.DefineSequencePoint("", 0xF00F00); 12 | } 13 | 14 | public static void MarkDebuggerStepInPoint(this ILCodeStream codeStream) 15 | { 16 | codeStream.DefineSequencePoint("", 0xFEEFEE); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using Internal.TypeSystem; 7 | 8 | namespace Internal.IL.Stubs 9 | { 10 | public partial class DelegateMarshallingMethodThunk : IPrefixMangledType 11 | { 12 | TypeDesc IPrefixMangledType.BaseType 13 | { 14 | get 15 | { 16 | return _delegateType; 17 | } 18 | } 19 | 20 | string IPrefixMangledType.Prefix 21 | { 22 | get 23 | { 24 | return NamePrefix; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of methods 10 | partial class DelegateMarshallingMethodThunk 11 | { 12 | protected internal override int ClassCode => 1018037605; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (DelegateMarshallingMethodThunk)other; 17 | int result = (int)Kind - (int)otherMethod.Kind; 18 | if (result != 0) 19 | return result; 20 | 21 | return comparer.Compare(_delegateType, otherMethod._delegateType); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class EnumGetHashCodeThunk 11 | { 12 | protected internal override int ClassCode => 261739662; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (EnumGetHashCodeThunk)other; 17 | return comparer.Compare(_owningType, otherMethod._owningType); 18 | } 19 | } 20 | 21 | partial class EnumEqualsThunk 22 | { 23 | protected internal override int ClassCode => -1774524780; 24 | 25 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 26 | { 27 | var otherMethod = (EnumEqualsThunk)other; 28 | return comparer.Compare(_owningType, otherMethod._owningType); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | /// 10 | /// contains functionality related to name mangling 11 | /// 12 | public partial class ForwardDelegateCreationThunk : IPrefixMangledType 13 | { 14 | TypeDesc IPrefixMangledType.BaseType 15 | { 16 | get 17 | { 18 | return _delegateType; 19 | } 20 | } 21 | 22 | string IPrefixMangledType.Prefix 23 | { 24 | get 25 | { 26 | return "ForwardDelegateCreationStub"; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class ForwardDelegateCreationThunk 11 | { 12 | protected internal override int ClassCode => 1026039617; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (ForwardDelegateCreationThunk)other; 17 | 18 | return comparer.Compare(DelegateType, otherMethod.DelegateType); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | partial class MethodBaseGetCurrentMethodThunk : IPrefixMangledMethod 10 | { 11 | MethodDesc IPrefixMangledMethod.BaseMethod 12 | { 13 | get 14 | { 15 | return Method; 16 | } 17 | } 18 | 19 | string IPrefixMangledMethod.Prefix 20 | { 21 | get 22 | { 23 | return "GetCurrentMethod"; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class MethodBaseGetCurrentMethodThunk 11 | { 12 | protected override int ClassCode => 1889524798; 13 | 14 | protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (MethodBaseGetCurrentMethodThunk)other; 17 | return comparer.Compare(Method, otherMethod.Method); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | partial class PInvokeLazyFixupField 10 | { 11 | protected internal override int ClassCode => -1784477702; 12 | 13 | protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer) 14 | { 15 | return comparer.Compare(_targetMethod, ((PInvokeLazyFixupField)other)._targetMethod); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/PInvokeTargetNativeMethod.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | partial class PInvokeTargetNativeMethod : IPrefixMangledMethod 10 | { 11 | MethodDesc IPrefixMangledMethod.BaseMethod 12 | { 13 | get 14 | { 15 | return _declMethod; 16 | } 17 | } 18 | 19 | string IPrefixMangledMethod.Prefix 20 | { 21 | get 22 | { 23 | return "rawpinvoke"; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/PInvokeTargetNativeMethod.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class PInvokeTargetNativeMethod 11 | { 12 | protected internal override int ClassCode => -1626939381; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (PInvokeTargetNativeMethod)other; 17 | return comparer.Compare(_declMethod, otherMethod._declMethod); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | public partial class StructMarshallingThunk : IPrefixMangledType 10 | { 11 | TypeDesc IPrefixMangledType.BaseType 12 | { 13 | get 14 | { 15 | return ManagedType; 16 | } 17 | } 18 | 19 | string IPrefixMangledType.Prefix 20 | { 21 | get 22 | { 23 | return NamePrefix; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | // Functionality related to deterministic ordering of types 10 | partial class StructMarshallingThunk 11 | { 12 | protected internal override int ClassCode => 340834018; 13 | 14 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 15 | { 16 | var otherMethod = (StructMarshallingThunk)other; 17 | 18 | int result = ThunkType - otherMethod.ThunkType; 19 | if (result != 0) 20 | return result; 21 | 22 | return comparer.Compare(ManagedType, otherMethod.ManagedType); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | using Internal.TypeSystem; 8 | 9 | namespace Internal.IL.Stubs 10 | { 11 | // Functionality related to deterministic ordering of types 12 | partial class TypeGetTypeMethodThunk 13 | { 14 | protected override int ClassCode => -949164050; 15 | 16 | protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 17 | { 18 | var otherMethod = (TypeGetTypeMethodThunk)other; 19 | int result = StringComparer.Ordinal.Compare(DefaultAssemblyName, otherMethod.DefaultAssemblyName); 20 | if (result != 0) 21 | return result; 22 | 23 | return comparer.Compare(Signature, otherMethod.Signature); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace Internal.IL.Stubs 8 | { 9 | partial class ValueTypeGetFieldHelperMethodOverride 10 | { 11 | protected internal override int ClassCode => 2036839816; 12 | 13 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 14 | { 15 | var otherMethod = (ValueTypeGetFieldHelperMethodOverride)other; 16 | 17 | return comparer.Compare(_owningType, otherMethod._owningType); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | partial class TypeSystemContext 10 | { 11 | // Functionality related to determinstic ordering of types and members 12 | partial class CompilerGeneratedType : MetadataType 13 | { 14 | protected internal override int ClassCode => -1036681447; 15 | 16 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 17 | { 18 | // Should be a singleton 19 | throw new NotSupportedException(); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/NativeStructType.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | partial class NativeStructType : IPrefixMangledType 8 | { 9 | TypeDesc IPrefixMangledType.BaseType => ManagedStructType; 10 | 11 | string IPrefixMangledType.Prefix => "NativeStructType"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class NativeStructType 9 | { 10 | protected internal override int ClassCode => -377751537; 11 | 12 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return comparer.Compare(ManagedStructType, ((NativeStructType)other).ManagedStructType); 15 | } 16 | 17 | partial class NativeStructField 18 | { 19 | protected internal override int ClassCode => 1580219745; 20 | 21 | protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer) 22 | { 23 | return comparer.Compare(_managedField, ((NativeStructField)other)._managedField); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Mangling.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | partial class PInvokeDelegateWrapper : IPrefixMangledType 8 | { 9 | TypeDesc IPrefixMangledType.BaseType 10 | { 11 | get 12 | { 13 | return DelegateType; 14 | } 15 | } 16 | 17 | string IPrefixMangledType.Prefix 18 | { 19 | get 20 | { 21 | return "PInvokeDelegateWrapper"; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class PInvokeDelegateWrapper 9 | { 10 | protected internal override int ClassCode => -262930217; 11 | 12 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return comparer.Compare(DelegateType, ((PInvokeDelegateWrapper)other).DelegateType); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.Interop 6 | { 7 | // Functionality related to deterministic ordering of methods 8 | partial class PInvokeDelegateWrapperConstructor 9 | { 10 | protected internal override int ClassCode => 1000342011; 11 | 12 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 13 | { 14 | var owningType = (PInvokeDelegateWrapper)OwningType; 15 | var otherOwningType = (PInvokeDelegateWrapper)other.OwningType; 16 | return comparer.Compare(owningType.DelegateType, otherOwningType.DelegateType); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/IL/PInvokeILEmitterConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.IL 6 | { 7 | public abstract class PInvokeILEmitterConfiguration 8 | { 9 | public abstract bool GenerateDirectCall(string libraryName, string methodName); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/InstantiatedType.Interop.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | public partial class InstantiatedType 8 | { 9 | public override PInvokeStringFormat PInvokeStringFormat 10 | { 11 | get 12 | { 13 | return _typeDef.PInvokeStringFormat; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Interop/MethodDelegator.Interop.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class MethodDelegator 8 | { 9 | public override bool IsPInvoke => _wrappedMethod.IsPInvoke; 10 | 11 | public override PInvokeMetadata GetPInvokeMethodMetadata() 12 | { 13 | return _wrappedMethod.GetPInvokeMethodMetadata(); 14 | } 15 | 16 | public override ParameterMetadata[] GetParameterMetadata() 17 | { 18 | return _wrappedMethod.GetParameterMetadata(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Mangling/IPrefixMangledMethod.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// When implemented by a or , instructs a name mangler to use the same mangled name 9 | /// as another entity while prepending a specific prefix to that mangled name. 10 | /// 11 | public interface IPrefixMangledMethod 12 | { 13 | /// 14 | /// Method whose mangled name to use. 15 | /// 16 | MethodDesc BaseMethod { get; } 17 | 18 | /// 19 | /// Prefix to apply when mangling. 20 | /// 21 | string Prefix { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Mangling/IPrefixMangledSignature.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// When implemented by a , instructs a name mangler to use the same mangled name 9 | /// as another entity while prepending a specific prefix to that mangled name. 10 | /// 11 | public interface IPrefixMangledSignature 12 | { 13 | /// 14 | /// Signature whose mangled name to use. 15 | /// 16 | MethodSignature BaseSignature { get; } 17 | 18 | /// 19 | /// Prefix to apply when mangling. 20 | /// 21 | string Prefix { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Mangling/IPrefixMangledType.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | /// 8 | /// When implemented by a or , instructs a name mangler to use the same mangled name 9 | /// as another entity while prepending a specific prefix to that mangled name. 10 | /// 11 | public interface IPrefixMangledType 12 | { 13 | /// 14 | /// Type whose mangled name to use. 15 | /// 16 | TypeDesc BaseType { get; } 17 | 18 | /// 19 | /// Prefix to apply when mangling. 20 | /// 21 | string Prefix { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/NativeFormat/NativeFormatField.CodeGen.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem.NativeFormat 6 | { 7 | partial class NativeFormatField 8 | { 9 | public override bool IsIntrinsic 10 | { 11 | get 12 | { 13 | return (GetFieldFlags(FieldFlags.AttributeMetadataCache | FieldFlags.Intrinsic) & FieldFlags.Intrinsic) != 0; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/ByRefType.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class ByRefType 8 | { 9 | public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 10 | { 11 | TypeDesc parameterTypeConverted = ParameterType.GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(typeInstantiation, methodInstantiation); 12 | if (ParameterType != parameterTypeConverted) 13 | { 14 | return Context.GetByRefType(parameterTypeConverted); 15 | } 16 | 17 | return this; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/FieldDesc.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class FieldDesc 8 | { 9 | public FieldDesc GetNonRuntimeDeterminedFieldFromRuntimeDeterminedFieldViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 10 | { 11 | DefType owningType = OwningType; 12 | TypeDesc owningTypeInstantiated = owningType.GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(typeInstantiation, methodInstantiation); 13 | if (owningTypeInstantiated != owningType) 14 | { 15 | return Context.GetFieldForInstantiatedType(GetTypicalFieldDefinition(), (InstantiatedType)owningTypeInstantiated); 16 | } 17 | 18 | return this; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/FunctionPointerType.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | partial class FunctionPointerType 10 | { 11 | public override bool IsRuntimeDeterminedSubtype 12 | { 13 | get 14 | { 15 | if (_signature.ReturnType.IsRuntimeDeterminedSubtype) 16 | return true; 17 | 18 | for (int i = 0; i < _signature.Length; i++) 19 | if (_signature[i].IsRuntimeDeterminedSubtype) 20 | return true; 21 | 22 | return false; 23 | } 24 | } 25 | 26 | public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 27 | { 28 | Debug.Assert(false); 29 | return this; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/GenericParameterDesc.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | partial class GenericParameterDesc 10 | { 11 | public sealed override bool IsRuntimeDeterminedSubtype 12 | { 13 | get 14 | { 15 | Debug.Fail("IsRuntimeDeterminedSubtype of an indefinite type"); 16 | return false; 17 | } 18 | } 19 | 20 | public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 21 | { 22 | Debug.Assert(false); 23 | return this; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/MethodForRuntimeDeterminedType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to deterministic ordering of types 8 | partial class MethodForRuntimeDeterminedType 9 | { 10 | protected internal override int ClassCode => 719937490; 11 | 12 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 13 | { 14 | var otherMethod = (MethodForRuntimeDeterminedType)other; 15 | 16 | int result = comparer.CompareWithinClass(_rdType, otherMethod._rdType); 17 | if (result != 0) 18 | return result; 19 | 20 | return comparer.Compare(_typicalMethodDef, otherMethod._typicalMethodDef); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/ParameterizedType.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class ParameterizedType 8 | { 9 | public sealed override bool IsRuntimeDeterminedSubtype 10 | { 11 | get 12 | { 13 | return _parameterType.IsRuntimeDeterminedSubtype; 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/PointerType.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class PointerType 8 | { 9 | public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 10 | { 11 | TypeDesc parameterTypeConverted = ParameterType.GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(typeInstantiation, methodInstantiation); 12 | if (ParameterType != parameterTypeConverted) 13 | { 14 | return Context.GetPointerType(parameterTypeConverted); 15 | } 16 | 17 | return this; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/RuntimeDeterminedType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class RuntimeDeterminedType 9 | { 10 | protected internal override int ClassCode => 351938209; 11 | 12 | protected internal sealed override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | var otherType = (RuntimeDeterminedType)other; 15 | int result = comparer.Compare(_rawCanonType, otherType._rawCanonType); 16 | if (result != 0) 17 | return result; 18 | 19 | return comparer.Compare(_runtimeDeterminedDetailsType, otherType._runtimeDeterminedDetailsType); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/RuntimeDetermined/SignatureVariable.RuntimeDetermined.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Debug = System.Diagnostics.Debug; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | partial class SignatureVariable 10 | { 11 | public sealed override bool IsRuntimeDeterminedSubtype 12 | { 13 | get 14 | { 15 | Debug.Fail("IsRuntimeDeterminedSubtype of an indefinite type"); 16 | return false; 17 | } 18 | } 19 | 20 | public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation) 21 | { 22 | Debug.Assert(false); 23 | return this; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Serialization/FieldDesc.Serialization.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Additional members of FieldDesc related to serialization. 8 | partial class FieldDesc 9 | { 10 | /// 11 | /// Gets a value indicating whether this field is not serialized. 12 | /// specially. 13 | /// 14 | public virtual bool IsNotSerialized 15 | { 16 | get 17 | { 18 | return false; 19 | } 20 | } 21 | } 22 | 23 | partial class FieldForInstantiatedType 24 | { 25 | public override bool IsNotSerialized 26 | { 27 | get 28 | { 29 | return _fieldDef.IsNotSerialized; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Serialization/TypeDesc.Serialization.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | partial class TypeDesc 8 | { 9 | /// 10 | /// Gets a value indicating whether this type is serializable. 11 | /// 12 | public virtual bool IsSerializable 13 | { 14 | get 15 | { 16 | return false; 17 | } 18 | } 19 | } 20 | 21 | partial class InstantiatedType 22 | { 23 | public override bool IsSerializable 24 | { 25 | get 26 | { 27 | return _typeDef.IsSerializable; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/ByRefType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class ByRefType 9 | { 10 | protected internal override int ClassCode => -959602231; 11 | 12 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return comparer.Compare(ParameterType, ((ByRefType)other).ParameterType); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/FieldDesc.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to deterministic ordering of types and members 8 | partial class FieldDesc 9 | { 10 | /// 11 | /// Gets an identifier that is the same for all instances of this 12 | /// descendant, but different from the of any other descendant. 13 | /// 14 | /// 15 | /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". 16 | /// If two manage to conflict (which is pretty unlikely), just make a new one... 17 | /// 18 | protected internal abstract int ClassCode { get; } 19 | 20 | // Note to implementers: the type of `other` is actually the same as the type of `this`. 21 | protected internal abstract int CompareToImpl(FieldDesc other, TypeSystemComparer comparer); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/FieldForInstantiatedType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to deterministic ordering of types and members 8 | partial class FieldForInstantiatedType 9 | { 10 | protected internal override int ClassCode => 1140200283; 11 | 12 | protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer) 13 | { 14 | var otherField = (FieldForInstantiatedType)other; 15 | 16 | int result = comparer.CompareWithinClass(_instantiatedType, otherField._instantiatedType); 17 | if (result != 0) 18 | return result; 19 | 20 | return comparer.Compare(_fieldDef, otherField._fieldDef); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/FunctionPointerType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class FunctionPointerType 9 | { 10 | protected internal override int ClassCode => -914739489; 11 | 12 | protected internal sealed override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return _signature.CompareTo(((FunctionPointerType)other)._signature, comparer); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/MethodDesc.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to deterministic ordering of types and members 8 | partial class MethodDesc 9 | { 10 | /// 11 | /// Gets an identifier that is the same for all instances of this 12 | /// descendant, but different from the of any other descendant. 13 | /// 14 | /// 15 | /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". 16 | /// If two manage to conflict (which is pretty unlikely), just make a new one... 17 | /// 18 | protected internal abstract int ClassCode { get; } 19 | 20 | // Note to implementers: the type of `other` is actually the same as the type of `this`. 21 | protected internal abstract int CompareToImpl(MethodDesc other, TypeSystemComparer comparer); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/MethodForInstantiatedType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to deterministic ordering of types 8 | partial class MethodForInstantiatedType 9 | { 10 | protected internal override int ClassCode => 1359759636; 11 | 12 | protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 13 | { 14 | var otherMethod = (MethodForInstantiatedType)other; 15 | 16 | int result = comparer.CompareWithinClass(_instantiatedType, otherMethod._instantiatedType); 17 | if (result != 0) 18 | return result; 19 | 20 | return comparer.Compare(_typicalMethodDef, otherMethod._typicalMethodDef); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/PointerType.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to determinstic ordering of types 8 | partial class PointerType 9 | { 10 | protected internal override int ClassCode => -2124247792; 11 | 12 | protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return comparer.Compare(ParameterType, ((PointerType)other).ParameterType); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/SignatureVariable.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace Internal.TypeSystem 8 | { 9 | // Functionality related to determinstic ordering of types 10 | partial class SignatureVariable 11 | { 12 | protected internal sealed override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer) 13 | { 14 | return ((SignatureVariable)other).Index - Index; 15 | } 16 | } 17 | 18 | partial class SignatureTypeVariable 19 | { 20 | protected internal override int ClassCode 21 | { 22 | get 23 | { 24 | return 1042124696; 25 | } 26 | } 27 | } 28 | 29 | partial class SignatureMethodVariable 30 | { 31 | protected internal override int ClassCode 32 | { 33 | get 34 | { 35 | return 144542889; 36 | } 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ILCompiler/Common/TypeSystem/Sorting/TypeDesc.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace Internal.TypeSystem 6 | { 7 | // Functionality related to determinstic ordering of types and members 8 | partial class TypeDesc 9 | { 10 | /// 11 | /// Gets an identifier that is the same for all instances of this 12 | /// descendant, but different from the of any other descendant. 13 | /// 14 | /// 15 | /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". 16 | /// If two manage to conflict (which is pretty unlikely), just make a new one... 17 | /// 18 | protected internal abstract int ClassCode { get; } 19 | 20 | // Note to implementers: the type of `other` is actually the same as the type of `this`. 21 | protected internal abstract int CompareToImpl(TypeDesc other, TypeSystemComparer comparer); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/CodeGenerationFailedException.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | using Internal.TypeSystem; 8 | 9 | namespace ILCompiler 10 | { 11 | public class CodeGenerationFailedException : InternalCompilerErrorException 12 | { 13 | private const string MessageText = "Code generation failed for method '{0}'"; 14 | 15 | public MethodDesc Method { get; } 16 | 17 | public CodeGenerationFailedException(MethodDesc method) 18 | : this(method, null) 19 | { 20 | } 21 | 22 | public CodeGenerationFailedException(MethodDesc method, Exception inner) 23 | : base(String.Format(MessageText, method), inner) 24 | { 25 | Method = method; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DebugInformationProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.IL; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// Provides debug information by delegating to the . 11 | /// 12 | public class DebugInformationProvider 13 | { 14 | public virtual MethodDebugInformation GetDebugInfo(MethodIL methodIL) 15 | { 16 | return methodIL.GetDebugInfo(); 17 | } 18 | } 19 | 20 | /// 21 | /// Provides empty debug information. 22 | /// 23 | public sealed class NullDebugInformationProvider : DebugInformationProvider 24 | { 25 | public override MethodDebugInformation GetDebugInfo(MethodIL methodIL) 26 | { 27 | return MethodDebugInformation.None; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternEETypeSymbolNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | /// 10 | /// Represents a symbol that is defined externally but modelled as a type in the 11 | /// DependencyAnalysis infrastructure during compilation. 12 | /// 13 | public sealed class ExternEETypeSymbolNode : ExternSymbolNode, IEETypeNode 14 | { 15 | private TypeDesc _type; 16 | 17 | public ExternEETypeSymbolNode(NodeFactory factory, TypeDesc type) 18 | : base(factory.NameMangler.NodeMangler.EEType(type)) 19 | { 20 | _type = type; 21 | 22 | EETypeNode.CheckCanGenerateEEType(factory, type); 23 | } 24 | 25 | public TypeDesc Type => _type; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/HelperEntrypoint.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | public enum HelperEntrypoint 8 | { 9 | EnsureClassConstructorRunAndReturnGCStaticBase, 10 | EnsureClassConstructorRunAndReturnNonGCStaticBase, 11 | EnsureClassConstructorRunAndReturnThreadStaticBase, 12 | GetThreadStaticBaseForType, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IEETypeNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | /// 10 | /// A dependency analysis node that represents a runtime type data structure. 11 | /// 12 | public interface IEETypeNode : ISortableSymbolNode 13 | { 14 | TypeDesc Type { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IExportableSymbolNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using ILCompiler.DependencyAnalysisFramework; 7 | using Internal.Text; 8 | 9 | namespace ILCompiler.DependencyAnalysis 10 | { 11 | public interface IExportableSymbolNode : ISymbolDefinitionNode 12 | { 13 | /// 14 | /// Set the return value of this property to non-ExportForm.None to indicate that this symbol 15 | /// is exported and will be referenced by external modules. The values of the enum indicate what form 16 | /// of export is to be used. 17 | /// 18 | ExportForm GetExportForm(NodeFactory factory); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IMethodBodyNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | /// 8 | /// Marker interface that identifies the node representing a compiled method body. 9 | /// 10 | public interface IMethodBodyNode : IMethodNode 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IMethodBodyNodeWithFuncletSymbols.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | public interface IMethodBodyNodeWithFuncletSymbols : IMethodBodyNode 8 | { 9 | /// 10 | /// Symbols of any funclets associated with this method. 11 | /// 12 | ISymbolNode[] FuncletSymbols { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IMethodNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | /// 10 | /// A dependency analysis node that represents a method. 11 | /// 12 | public interface IMethodNode : ISortableSymbolNode 13 | { 14 | MethodDesc Method { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/INodeWithRuntimeDeterminedDependencies.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Collections.Generic; 6 | 7 | using Internal.TypeSystem; 8 | 9 | namespace ILCompiler.DependencyAnalysis 10 | { 11 | using DependencyListEntry = DependencyAnalysisFramework.DependencyNodeCore.DependencyListEntry; 12 | 13 | /// 14 | /// Represents a node whose dependencies are runtime determined (they depend on the generic context) 15 | /// and which provides means to compute concrete dependencies when given the generic context. 16 | /// 17 | public interface INodeWithRuntimeDeterminedDependencies 18 | { 19 | /// 20 | /// Instantiates runtime determined dependencies of this node using the supplied generic context. 21 | /// 22 | IEnumerable InstantiateDependencies(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/IObjectDumper.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ObjectData = ILCompiler.DependencyAnalysis.ObjectNode.ObjectData; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public interface IObjectDumper 10 | { 11 | void DumpObjectNode(NameMangler mangler, ObjectNode node, ObjectData objectData); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ISortableNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | public interface ISortableNode 8 | { 9 | #if !SUPPORT_JIT 10 | /// 11 | /// Gets an identifier that is the same for all instances of this 12 | /// descendant, but different from the of any other descendant. 13 | /// 14 | /// 15 | /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". 16 | /// If two manage to conflict (which is pretty unlikely), just make a new one... 17 | /// 18 | int ClassCode { get; } 19 | 20 | int CompareToImpl(ISortableNode other, CompilerComparer comparer); 21 | #endif 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ISpecialUnboxThunkNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | /// 10 | /// A dependency analysis node that represents a special instantiating unboxing stub. 11 | /// 12 | public interface ISpecialUnboxThunkNode : IMethodNode 13 | { 14 | bool IsSpecialUnboxingThunk { get; } 15 | ISymbolNode GetUnboxingThunkTarget(NodeFactory factory); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ISymbolNodeWithDebugInfo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using ILCompiler.DependencyAnalysisFramework; 7 | using Internal.Text; 8 | 9 | namespace ILCompiler.DependencyAnalysis 10 | { 11 | /// 12 | /// Represents a symbol definition with debug info, i.e., the S_GDATA32 record. 13 | /// 14 | public interface ISymbolNodeWithDebugInfo : ISymbolDefinitionNode 15 | { 16 | IDebugInfo DebugInfo { get; } 17 | } 18 | 19 | public interface IDebugInfo 20 | { } 21 | 22 | public interface ITypeIndexDebugInfo : IDebugInfo 23 | { 24 | int TypeIndex { get; } 25 | } 26 | 27 | public class NullTypeIndexDebugInfo : ITypeIndexDebugInfo 28 | { 29 | private NullTypeIndexDebugInfo() { } 30 | 31 | public int TypeIndex => 0; 32 | 33 | public static IDebugInfo Instance 34 | { 35 | get { return new NullTypeIndexDebugInfo(); } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ISymbolNodeWithFuncletId.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using ILCompiler.DependencyAnalysisFramework; 7 | using Internal.Text; 8 | 9 | namespace ILCompiler.DependencyAnalysis 10 | { 11 | /// 12 | /// Represents a reference to a symbol attributed with a funclet id. 13 | /// 14 | public interface ISymbolNodeWithFuncletId : ISymbolNode 15 | { 16 | ISymbolNode AssociatedMethodSymbol { get; } 17 | int FuncletId { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ImportedStaticsNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public sealed class ImportedGCStaticsNode : ExternSymbolNode 10 | { 11 | public ImportedGCStaticsNode(NodeFactory factory, MetadataType type) 12 | : base("__imp_" + GCStaticsNode.GetMangledName(type, factory.NameMangler)) 13 | { 14 | } 15 | 16 | public override bool RepresentsIndirectionCell => true; 17 | } 18 | 19 | public sealed class ImportedNonGCStaticsNode : ExternSymbolNode 20 | { 21 | public ImportedNonGCStaticsNode(NodeFactory factory, MetadataType type) 22 | : base("__imp_" + NonGCStaticsNode.GetMangledName(type, factory.NameMangler)) 23 | { 24 | } 25 | 26 | public override bool RepresentsIndirectionCell => true; 27 | } 28 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/ImportedThreadStaticsNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public sealed class ImportedThreadStaticsIndexNode : ExternSymbolNode 10 | { 11 | public ImportedThreadStaticsIndexNode(NodeFactory factory) 12 | : base("__imp_" + ThreadStaticsIndexNode.GetMangledName(((UTCNameMangler)factory.NameMangler).GetImportedTlsIndexPrefix())) 13 | { 14 | } 15 | 16 | public override bool RepresentsIndirectionCell => true; 17 | } 18 | 19 | public sealed class ImportedThreadStaticsOffsetNode : ExternSymbolNode 20 | { 21 | public ImportedThreadStaticsOffsetNode(MetadataType type, NodeFactory factory) 22 | : base("__imp_" + ThreadStaticsOffsetNode.GetMangledName(factory.NameMangler, type)) 23 | { 24 | } 25 | 26 | public override bool RepresentsIndirectionCell => true; 27 | } 28 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/JumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | public abstract partial class JumpStubNode : AssemblyStubNode 8 | { 9 | private ISymbolNode _target; 10 | 11 | public ISymbolNode Target 12 | { 13 | get 14 | { 15 | return _target; 16 | } 17 | } 18 | 19 | public JumpStubNode(ISymbolNode target) 20 | { 21 | _target = target; 22 | } 23 | 24 | protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); 25 | 26 | public override int ClassCode => 737788182; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/NamedJumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.Text; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | class NamedJumpStubNode : JumpStubNode 10 | { 11 | Utf8String _name; 12 | 13 | public NamedJumpStubNode(string name, ISymbolNode target) : base(target) 14 | { 15 | _name = new Utf8String(name); 16 | } 17 | 18 | public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) 19 | { 20 | sb.Append(_name); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM/ARMJumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.ARM; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class JumpStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref ARMEmitter encoder, bool relocsOnly) 12 | { 13 | if (!_target.RepresentsIndirectionCell) 14 | { 15 | encoder.EmitJMP(_target); // b methodEntryPoint 16 | } 17 | else 18 | { 19 | encoder.EmitMOV(encoder.TargetRegister.InterproceduralScratch, _target); 20 | encoder.EmitJMP(encoder.TargetRegister.InterproceduralScratch); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM/ARMNodeFactory.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class NodeFactory 10 | { 11 | private InitialInterfaceDispatchStubNode _initialInterfaceDispatchStubNode; 12 | 13 | public InitialInterfaceDispatchStubNode InitialInterfaceDispatchStub 14 | { 15 | get 16 | { 17 | if (_initialInterfaceDispatchStubNode == null) 18 | { 19 | _initialInterfaceDispatchStubNode = new InitialInterfaceDispatchStubNode(); 20 | } 21 | 22 | return _initialInterfaceDispatchStubNode; 23 | } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM/ARMUnboxingStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.ARM; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class UnboxingStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref ARMEmitter encoder, bool relocsOnly) 12 | { 13 | encoder.EmitADD(encoder.TargetRegister.Arg0, (byte)factory.Target.PointerSize); // add r0, sizeof(void*); 14 | encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory)); // b methodEntryPoint 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM/Register.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ILCompiler.DependencyAnalysis.ARM 12 | { 13 | public enum Register 14 | { 15 | R0 = 0, 16 | R1 = 1, 17 | R2 = 2, 18 | R3 = 3, 19 | R4 = 4, 20 | R5 = 5, 21 | R6 = 6, 22 | R7 = 7, 23 | R8 = 8, 24 | R9 = 9, 25 | R10 = 10, 26 | R11 = 11, 27 | R12 = 12, 28 | R13 = 13, 29 | R14 = 14, 30 | R15 = 15, 31 | 32 | None = 16, 33 | RegDirect = 24, 34 | 35 | NoIndex = 128, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM64/ARM64JumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.ARM64; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class JumpStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref ARM64Emitter encoder, bool relocsOnly) 12 | { 13 | encoder.EmitJMP(_target); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM64/ARM64ReadyToRunHelperNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Diagnostics; 7 | 8 | using ILCompiler.DependencyAnalysis.ARM64; 9 | using Internal.TypeSystem; 10 | 11 | namespace ILCompiler.DependencyAnalysis 12 | { 13 | /// 14 | /// ARM64 specific portions of ReadyToRunHelperNode 15 | /// 16 | public partial class ReadyToRunHelperNode 17 | { 18 | protected override void EmitCode(NodeFactory factory, ref ARM64Emitter encoder, bool relocsOnly) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM64/ARM64UnboxingStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using ILCompiler.DependencyAnalysis.ARM64; 7 | 8 | namespace ILCompiler.DependencyAnalysis 9 | { 10 | public partial class UnboxingStubNode 11 | { 12 | protected override void EmitCode(NodeFactory factory, ref ARM64Emitter encoder, bool relocsOnly) 13 | { 14 | encoder.EmitADD(encoder.TargetRegister.Arg0, (byte)factory.Target.PointerSize); // add r0, sizeof(void*); 15 | encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory)); // b methodEntryPoint 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_ARM64/AddrMode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler.DependencyAnalysis.ARM64 8 | { 9 | public enum AddrModeSize 10 | { 11 | Int8 = 1, 12 | Int16 = 2, 13 | Int32 = 4, 14 | Int64 = 8, 15 | Int128 = 16 16 | } 17 | 18 | public struct AddrMode 19 | { 20 | public readonly Register BaseReg; 21 | public readonly Register? IndexReg; 22 | public readonly int Offset; 23 | public readonly byte Scale; 24 | public readonly AddrModeSize Size; 25 | 26 | public AddrMode(Register baseRegister, Register? indexRegister, int offset, byte scale, AddrModeSize size) 27 | { 28 | BaseReg = baseRegister; 29 | IndexReg = indexRegister; 30 | Offset = offset; 31 | Scale = scale; 32 | Size = size; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/AddrMode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler.DependencyAnalysis.X64 8 | { 9 | public enum AddrModeSize 10 | { 11 | Int8 = 1, 12 | Int16 = 2, 13 | Int32 = 4, 14 | Int64 = 8, 15 | Int128 = 16 16 | } 17 | 18 | public struct AddrMode 19 | { 20 | public readonly Register BaseReg; 21 | public readonly Register? IndexReg; 22 | public readonly int Offset; 23 | public readonly byte Scale; 24 | public readonly AddrModeSize Size; 25 | 26 | public AddrMode(Register baseRegister, Register? indexRegister, int offset, byte scale, AddrModeSize size) 27 | { 28 | BaseReg = baseRegister; 29 | IndexReg = indexRegister; 30 | Offset = offset; 31 | Scale = scale; 32 | Size = size; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/Register.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ILCompiler.DependencyAnalysis.X64 12 | { 13 | public enum Register 14 | { 15 | RAX = 0, 16 | RCX = 1, 17 | RDX = 2, 18 | RBX = 3, 19 | RSP = 4, 20 | RBP = 5, 21 | RSI = 6, 22 | RDI = 7, 23 | R8 = 8, 24 | R9 = 9, 25 | R10 = 10, 26 | R11 = 11, 27 | R12 = 12, 28 | R13 = 13, 29 | R14 = 14, 30 | R15 = 15, 31 | 32 | None = 16, 33 | RegDirect = 24, 34 | 35 | NoIndex = 128, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/X64JumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.X64; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class JumpStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref X64Emitter encoder, bool relocsOnly) 12 | { 13 | encoder.EmitJMP(_target); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/X64UnboxingStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.X64; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class UnboxingStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref X64Emitter encoder, bool relocsOnly) 12 | { 13 | AddrMode thisPtr = new AddrMode( 14 | Register.RegDirect | encoder.TargetRegister.Arg0, null, 0, 0, AddrModeSize.Int64); 15 | encoder.EmitADD(ref thisPtr, (sbyte)factory.Target.PointerSize); 16 | encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/AddrMode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler.DependencyAnalysis.X86 8 | { 9 | public enum AddrModeSize 10 | { 11 | Int8 = 1, 12 | Int16 = 2, 13 | Int32 = 4 14 | } 15 | 16 | public struct AddrMode 17 | { 18 | public readonly Register BaseReg; 19 | public readonly Register? IndexReg; 20 | public readonly int Offset; 21 | public readonly byte Scale; 22 | public readonly AddrModeSize Size; 23 | 24 | public AddrMode(Register baseRegister, Register? indexRegister, int offset, byte scale, AddrModeSize size) 25 | { 26 | BaseReg = baseRegister; 27 | IndexReg = indexRegister; 28 | Offset = offset; 29 | Scale = scale; 30 | Size = size; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/Register.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ILCompiler.DependencyAnalysis.X86 12 | { 13 | public enum Register 14 | { 15 | EAX = 0, 16 | ECX = 1, 17 | EDX = 2, 18 | EBX = 3, 19 | ESP = 4, 20 | EBP = 5, 21 | ESI = 6, 22 | EDI = 7, 23 | 24 | None = 8, 25 | RegDirect = 24, 26 | 27 | NoIndex = 128, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/TargetRegisterMap.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | using Internal.TypeSystem; 8 | 9 | namespace ILCompiler.DependencyAnalysis.X86 10 | { 11 | /// 12 | /// Maps logical registers to physical registers on a specified OS. 13 | /// 14 | public struct TargetRegisterMap 15 | { 16 | public readonly Register Arg0; 17 | public readonly Register Arg1; 18 | public readonly Register Result; 19 | 20 | public TargetRegisterMap(TargetOS os) 21 | { 22 | switch (os) 23 | { 24 | case TargetOS.Windows: 25 | Arg0 = Register.ECX; 26 | Arg1 = Register.EDX; 27 | Result = Register.EAX; 28 | break; 29 | 30 | default: 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/X86JumpStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.X86; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class JumpStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref X86Emitter encoder, bool relocsOnly) 12 | { 13 | encoder.EmitJMP(_target); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/X86ReadyToRunGenericHelperNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | using ILCompiler.DependencyAnalysis.X86; 8 | 9 | using Internal.TypeSystem; 10 | 11 | using Debug = System.Diagnostics.Debug; 12 | 13 | namespace ILCompiler.DependencyAnalysis 14 | { 15 | partial class ReadyToRunGenericHelperNode 16 | { 17 | protected sealed override void EmitCode(NodeFactory factory, ref X86Emitter encoder, bool relocsOnly) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/X86ReadyToRunHelperNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Diagnostics; 8 | using ILCompiler.DependencyAnalysis.X86; 9 | using Internal.TypeSystem; 10 | using ILCompiler; 11 | 12 | namespace ILCompiler.DependencyAnalysis 13 | { 14 | /// 15 | /// X64 specific portions of ReadyToRunHelperNode 16 | /// 17 | public partial class ReadyToRunHelperNode 18 | { 19 | protected override void EmitCode(NodeFactory factory, ref X86Emitter encoder, bool relocsOnly) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X86/X86UnboxingStubNode.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using ILCompiler.DependencyAnalysis.X86; 6 | 7 | namespace ILCompiler.DependencyAnalysis 8 | { 9 | public partial class UnboxingStubNode 10 | { 11 | protected override void EmitCode(NodeFactory factory, ref X86Emitter encoder, bool relocsOnly) 12 | { 13 | AddrMode thisPtr = new AddrMode( 14 | Register.RegDirect | encoder.TargetRegister.Arg0, null, 0, 0, AddrModeSize.Int32); 15 | encoder.EmitADD(ref thisPtr, (sbyte)factory.Target.PointerSize); 16 | encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DictionaryLayoutProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | using ILCompiler.DependencyAnalysis; 7 | 8 | namespace ILCompiler 9 | { 10 | /// 11 | /// Provides generic dictionary layout information for a specific type or method. 12 | /// 13 | public abstract class DictionaryLayoutProvider 14 | { 15 | public abstract DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType); 16 | } 17 | 18 | /// 19 | /// Provides dictionary layout information that collects data during the compilation to build a dictionary layout 20 | /// for a type or method on demand. 21 | /// 22 | public sealed class LazyDictionaryLayoutProvider : DictionaryLayoutProvider 23 | { 24 | public override DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType) 25 | { 26 | return new LazilyBuiltDictionaryLayoutNode(methodOrType); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/DirectPInvokePolicy.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.IL; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// P/Invoke policy that generates direct calls for all methods and avoids lazy resolution 11 | /// of P/invokes at runtime. 12 | /// 13 | public sealed class DirectPInvokePolicy : PInvokeILEmitterConfiguration 14 | { 15 | public override bool GenerateDirectCall(string libraryName, string methodName) 16 | { 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/ICompilationRootProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace ILCompiler 6 | { 7 | /// 8 | /// Provides a set of seeds from which compilation will start. 9 | /// 10 | public interface ICompilationRootProvider 11 | { 12 | /// 13 | /// When implemented in a class, uses to add compilation 14 | /// roots to the compilation. 15 | /// 16 | void AddCompilationRoots(IRootingServiceProvider rootProvider); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/InternalCompilerErrorException.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler 8 | { 9 | public class InternalCompilerErrorException : Exception 10 | { 11 | public InternalCompilerErrorException(string message) 12 | : this(message, innerException: null) 13 | { 14 | } 15 | 16 | public InternalCompilerErrorException(string message, Exception innerException) 17 | : base(message, innerException) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/ManifestResourceBlockingPolicy.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// Represents a manifest resource blocking policy. The policy dictates whether manifest resources should 11 | /// be generated into the executable. 12 | /// 13 | public abstract class ManifestResourceBlockingPolicy 14 | { 15 | /// 16 | /// Returns true if manifest resource with name '' in module '' 17 | /// is reflection blocked. 18 | /// 19 | public abstract bool IsManifestResourceBlocked(ModuleDesc module, string resourceName); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/NoManifestResourceBlockingPolicy.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// A blocking policy that doesn't block any manifest resources. 11 | /// 12 | public sealed class NoManifestResourceBlockingPolicy : ManifestResourceBlockingPolicy 13 | { 14 | public override bool IsManifestResourceBlocked(ModuleDesc module, string resourceName) 15 | { 16 | return false; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/SingleMethodRootProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// Compilation root that is a single method. 11 | /// 12 | public class SingleMethodRootProvider : ICompilationRootProvider 13 | { 14 | private MethodDesc _method; 15 | 16 | public SingleMethodRootProvider(MethodDesc method) 17 | { 18 | _method = method; 19 | } 20 | 21 | public void AddCompilationRoots(IRootingServiceProvider rootProvider) 22 | { 23 | rootProvider.AddCompilationRoot(_method, "Single method root"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/UniversalGenericsRootProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | namespace ILCompiler 8 | { 9 | /// 10 | /// Compilation roots necessary to enable universal shared generics thats 11 | /// are not encompassed in other root providers 12 | /// 13 | public class UniversalGenericsRootProvider : ICompilationRootProvider 14 | { 15 | TypeSystemContext _context; 16 | 17 | public UniversalGenericsRootProvider(TypeSystemContext context) 18 | { 19 | _context = context; 20 | } 21 | 22 | public void AddCompilationRoots(IRootingServiceProvider rootProvider) 23 | { 24 | if (_context.SupportsUniversalCanon) 25 | rootProvider.AddCompilationRoot(_context.UniversalCanonType.MakeArrayType(), "Universal generic array support"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/UtcNodeMangler.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.Text; 6 | using Internal.TypeSystem; 7 | using System.Diagnostics; 8 | 9 | namespace ILCompiler 10 | { 11 | // 12 | // The naming format of these names is known to the debugger 13 | // 14 | public class UtcNodeMangler : WindowsNodeMangler 15 | { 16 | public override string MethodGenericDictionary(MethodDesc method) 17 | { 18 | return GenericDictionaryNamePrefix + ((UTCNameMangler)NameMangler).GetMangledMethodNameForDictionary(method); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Compiler/VTableSliceProvider.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | using ILCompiler.DependencyAnalysis; 7 | 8 | namespace ILCompiler 9 | { 10 | /// 11 | /// Provides VTable information for a specific type. 12 | /// 13 | public abstract class VTableSliceProvider 14 | { 15 | internal abstract VTableSliceNode GetSlice(TypeDesc type); 16 | } 17 | 18 | /// 19 | /// Provides VTable information that collects data during the compilation to build a VTable for a type. 20 | /// 21 | public sealed class LazyVTableSliceProvider : VTableSliceProvider 22 | { 23 | internal override VTableSliceNode GetSlice(TypeDesc type) 24 | { 25 | return new LazilyBuiltVTableSliceNode(type); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Internal.TypeSystem; 6 | 7 | using Debug = System.Diagnostics.Debug; 8 | 9 | namespace Internal.IL.Stubs.StartupCode 10 | { 11 | partial class AppContextInitializerMethod 12 | { 13 | protected override int ClassCode => 15749517; 14 | 15 | protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 16 | { 17 | // Should be a singleton 18 | Debug.Assert(this == other); 19 | return 0; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.Sorting.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | using Internal.TypeSystem; 9 | 10 | using Debug = System.Diagnostics.Debug; 11 | 12 | namespace Internal.IL.Stubs.StartupCode 13 | { 14 | partial class NativeLibraryStartupMethod 15 | { 16 | protected override int ClassCode => -304225482; 17 | 18 | protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer) 19 | { 20 | // Should be a singleton 21 | Debug.Assert(this == other); 22 | return 0; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Compiler/Logger.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.IO; 6 | 7 | namespace ILCompiler 8 | { 9 | // Poor man's logger. We can do better than this. 10 | 11 | public class Logger 12 | { 13 | public static Logger Null = new Logger(TextWriter.Null, false); 14 | 15 | public TextWriter Writer { get; } 16 | 17 | public bool IsVerbose { get; } 18 | 19 | public Logger(TextWriter writer, bool isVerbose) 20 | { 21 | Writer = writer; 22 | IsVerbose = isVerbose; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.DependencyAnalysisFramework/IDependencyAnalyzerLogEdgeVisitor.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ILCompiler.DependencyAnalysisFramework 12 | { 13 | public interface IDependencyAnalyzerLogEdgeVisitor 14 | { 15 | void VisitEdge(DependencyNodeCore nodeDepender, DependencyNodeCore nodeDependedOn, string reason); 16 | void VisitEdge(string root, DependencyNodeCore dependedOn); 17 | void VisitEdge(DependencyNodeCore nodeDepender, DependencyNodeCore nodeDependerOther, DependencyNodeCore nodeDependedOn, string reason); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.DependencyAnalysisFramework/IDependencyAnalyzerLogNodeVisitor.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | 7 | namespace ILCompiler.DependencyAnalysisFramework 8 | { 9 | public interface IDependencyAnalyzerLogNodeVisitor 10 | { 11 | void VisitCombinedNode(Tuple, DependencyNodeCore> node); 12 | void VisitNode(DependencyNodeCore node); 13 | void VisitRootNode(string rootName); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler.Host.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | VisualStudioVersion = 15.0.26020.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILCompiler.Host", "ILCompiler.Host.csproj", "{DFF6B5D4-608F-402B-ABC2-FB217306A88E}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {DFF6B5D4-608F-402B-ABC2-FB217306A88E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {DFF6B5D4-608F-402B-ABC2-FB217306A88E}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {DFF6B5D4-608F-402B-ABC2-FB217306A88E}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {DFF6B5D4-608F-402B-ABC2-FB217306A88E}.Release|Any CPU.Build.0 = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(SolutionProperties) = preSolution 19 | HideSolutionNode = FALSE 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/ByteArrayEqualityComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ILCompiler 5 | { 6 | public sealed class ByteArrayEqualityComparer : IEqualityComparer 7 | { 8 | public ByteArrayEqualityComparer() 9 | { 10 | } 11 | 12 | public bool Equals(byte[] left, byte[] right) 13 | { 14 | if ((int)left.Length != (int)right.Length) 15 | { 16 | return false; 17 | } 18 | for (int i = 0; i < (int)left.Length; i++) 19 | { 20 | if (left[i] != right[i]) 21 | { 22 | return false; 23 | } 24 | } 25 | return true; 26 | } 27 | 28 | public int GetHashCode(byte[] array) 29 | { 30 | int num = 0; 31 | for (int i = 0; i < (int)array.Length; i++) 32 | { 33 | num = (num << 5) + num ^ array[i]; 34 | } 35 | return num; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/CtlClassification.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | internal enum CtlClassification 6 | { 7 | CtlTokenNormal, 8 | CtlTokenLoadToken, 9 | CtlTokenLoadInst, 10 | CtlTokenLoadSize, 11 | CtlTokenAllocObject, 12 | CtlTokenAllocArray, 13 | CtlTokenAllocLocal, 14 | CtlTokenActivatorCreateInstanceAny, 15 | CtlTokenBox, 16 | CtlTokenUnboxAny, 17 | CtlTokenSharedImplementation, 18 | CtlTokenGetBase, 19 | CtlTokenGetTlsBase, 20 | CtlTokenCallDefaultCtor, 21 | CtlTokenCast, 22 | CtlTokenIsInst, 23 | CtlTokenConstrained, 24 | CtlTokenElemAddressCheck, 25 | CtlTokenArrayStoreCheckAny, 26 | CtlTokenLoadRvaField, 27 | CtlTokenCall, 28 | CtlTokenCallVirtual, 29 | CtlTokenLoadFunction, 30 | CtlTokenLoadVirtualFunction, 31 | CtlTokenLoadLazyDictContext, 32 | CtlTokenConstData, 33 | CtlTokenTypeFieldsOnly, 34 | CtlTokenSignature 35 | } 36 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/DependencyAnalysis/WriteablePrecomputedDictionaryLayoutNode.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ILCompiler.DependencyAnalysis 6 | { 7 | internal class WriteablePrecomputedDictionaryLayoutNode : PrecomputedDictionaryLayoutNode 8 | { 9 | public WriteablePrecomputedDictionaryLayoutNode(TypeSystemEntity owningMethodOrType, IEnumerable layout) : base(owningMethodOrType, layout) 10 | { 11 | } 12 | 13 | public override ObjectNodeSection DictionarySection(NodeFactory factory) 14 | { 15 | return ObjectNodeSection.DataSection; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/DictionaryQueryResult.cs: -------------------------------------------------------------------------------- 1 | using ILCompiler.DependencyAnalysis; 2 | using System; 3 | 4 | namespace ILCompiler 5 | { 6 | public struct DictionaryQueryResult 7 | { 8 | public GenericLookupResultReferenceType GenericReferenceType; 9 | 10 | public GenericLookupLayoutType GenericLayoutType; 11 | 12 | public int SlotIndex; 13 | 14 | public string SlotName; 15 | 16 | public GenericLookupResult LookupResult; 17 | 18 | public DictionaryLayoutNode DictLayout; 19 | } 20 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/FloatingLookupKey.cs: -------------------------------------------------------------------------------- 1 | using ILCompiler.DependencyAnalysis; 2 | using ILCompiler.DependencyAnalysisFramework; 3 | using System; 4 | 5 | namespace ILCompiler 6 | { 7 | internal struct FloatingLookupKey 8 | { 9 | public readonly DictionaryLayoutNode LayoutNode; 10 | 11 | public readonly GenericLookupResult LookupResult; 12 | 13 | public FloatingLookupKey(DictionaryLayoutNode layoutNode, GenericLookupResult lookupResult) 14 | { 15 | this.LayoutNode = layoutNode; 16 | this.LookupResult = lookupResult; 17 | } 18 | 19 | public bool Equals(FloatingLookupKey other) 20 | { 21 | if (this.LayoutNode != other.LayoutNode) 22 | { 23 | return false; 24 | } 25 | return this.LookupResult == other.LookupResult; 26 | } 27 | 28 | public override bool Equals(object obj) 29 | { 30 | if (!(obj is FloatingLookupKey)) 31 | { 32 | return false; 33 | } 34 | return this.Equals((FloatingLookupKey)obj); 35 | } 36 | 37 | public override int GetHashCode() 38 | { 39 | return this.LayoutNode.GetHashCode(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/GenericLookupLayoutType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | public enum GenericLookupLayoutType 6 | { 7 | Fixed, 8 | FloatingSlotWithIndex, 9 | FloatingSlotWithFixup 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/HostedCompilationType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | public enum HostedCompilationType 6 | { 7 | STSDependencyBased, 8 | Scanner, 9 | Compile 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/ISTSTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | 4 | namespace ILCompiler 5 | { 6 | public interface ISTSTokenProvider 7 | { 8 | int GetTokenForMethod(MethodDesc method); 9 | 10 | int GetTokenForUnboxingStub(MethodDesc method); 11 | } 12 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/LinkageTokenType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | public enum LinkageTokenType 6 | { 7 | Type, 8 | Method, 9 | RuntimeFieldHandle, 10 | RuntimeMethodHandle, 11 | NonGcStaticBase, 12 | GcStaticBase, 13 | TlsBase, 14 | TlsBaseOffset, 15 | TlsIndex, 16 | LoopHijackFlag, 17 | DataBlob, 18 | GenericMethodDictionary, 19 | FatFunctionPointer, 20 | MethodAssociatedData, 21 | TypeRuntimeLookupSignature, 22 | MethodRuntimeLookupSignature 23 | } 24 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/MethodKey.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | 4 | namespace ILCompiler 5 | { 6 | public struct MethodKey : IEquatable 7 | { 8 | public readonly MethodDesc Method; 9 | 10 | public readonly bool IsUnboxingStub; 11 | 12 | public MethodKey(MethodDesc method, bool isUnboxingStub) 13 | { 14 | this.Method = method; 15 | this.IsUnboxingStub = isUnboxingStub; 16 | } 17 | 18 | public bool Equals(MethodKey other) 19 | { 20 | if (this.Method != other.Method) 21 | { 22 | return false; 23 | } 24 | return this.IsUnboxingStub == other.IsUnboxingStub; 25 | } 26 | 27 | public override bool Equals(object obj) 28 | { 29 | if (!(obj is MethodKey)) 30 | { 31 | return false; 32 | } 33 | return this.Equals((MethodKey)obj); 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | return this.Method.GetHashCode(); 39 | } 40 | 41 | public override string ToString() 42 | { 43 | string str = this.Method.ToString(); 44 | bool isUnboxingStub = this.IsUnboxingStub; 45 | return string.Concat(str, " IsUnboxingStub:", isUnboxingStub.ToString()); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/MultifilePolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | public enum MultifilePolicy 6 | { 7 | SharedLibraryMultifile, 8 | AppWithSharedLibrary, 9 | Incremental 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/NetNativeFieldLayoutAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | 4 | namespace ILCompiler 5 | { 6 | internal class NetNativeFieldLayoutAlgorithm : MetadataFieldLayoutAlgorithm 7 | { 8 | public NetNativeFieldLayoutAlgorithm() 9 | { 10 | } 11 | 12 | protected override void PrepareRuntimeSpecificStaticFieldLayout(TypeSystemContext context, ref ComputedStaticFieldLayout layout) 13 | { 14 | layout.GcStatics.Size = LayoutInt.Zero; 15 | layout.ThreadGcStatics.Size = LayoutInt.Zero; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/ScannerOutcome.cs: -------------------------------------------------------------------------------- 1 | using ILCompiler.DependencyAnalysis; 2 | using Internal.TypeSystem; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Runtime.CompilerServices; 6 | 7 | namespace ILCompiler 8 | { 9 | public class ScannerOutcome 10 | { 11 | public Dictionary GenericDictionaryLayouts 12 | { 13 | get; 14 | } 15 | 16 | public HashSet RequiredCompiledMethods 17 | { 18 | get; 19 | } 20 | 21 | public HashSet RequiredImportedMethods 22 | { 23 | get; 24 | } 25 | 26 | public ScannerOutcome() 27 | { 28 | this.GenericDictionaryLayouts = new Dictionary(); 29 | this.RequiredCompiledMethods = new HashSet(); 30 | this.RequiredImportedMethods = new HashSet(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/SymbolIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ILCompiler 5 | { 6 | public struct SymbolIdentifier 7 | { 8 | public uint id; 9 | 10 | private const int _unknownId = 0; 11 | 12 | public static SymbolIdentifier UnknownId; 13 | 14 | public static Dictionary predefinedSymbols; 15 | 16 | static SymbolIdentifier() 17 | { 18 | SymbolIdentifier.UnknownId = new SymbolIdentifier(0); 19 | SymbolIdentifier.predefinedSymbols = new Dictionary(); 20 | SymbolIdentifier.predefinedSymbols["__managedcode_a"] = (uint)(SymbolIdentifier.predefinedSymbols.Count + 1); 21 | SymbolIdentifier.predefinedSymbols["__managedcode_z"] = (uint)(SymbolIdentifier.predefinedSymbols.Count + 1); 22 | } 23 | 24 | public SymbolIdentifier(uint id) 25 | { 26 | if (id == 0) 27 | { 28 | this.id = 0; 29 | return; 30 | } 31 | this.id = (uint)(id + SymbolIdentifier.predefinedSymbols.Count); 32 | } 33 | 34 | public SymbolIdentifier(string name) 35 | { 36 | if (!SymbolIdentifier.predefinedSymbols.TryGetValue(name, out this.id)) 37 | { 38 | this.id = 0; 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/Toc/ElementsToExport.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ILCompiler.Toc 6 | { 7 | public class ElementsToExport 8 | { 9 | private HashSet _exports = new HashSet(); 10 | 11 | public ElementsToExport() 12 | { 13 | } 14 | 15 | public void AddExport(TypeSystemEntity export) 16 | { 17 | this._exports.Add(export); 18 | } 19 | 20 | public bool ShouldExport(TypeDesc type) 21 | { 22 | return this._exports.Contains(type); 23 | } 24 | 25 | public bool ShouldExport(MethodDesc method) 26 | { 27 | return this._exports.Contains(method); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/Toc/ImportExportInfo.cs: -------------------------------------------------------------------------------- 1 | using ILCompiler; 2 | using Internal.TypeSystem; 3 | using System; 4 | 5 | namespace ILCompiler.Toc 6 | { 7 | public class ImportExportInfo 8 | { 9 | public ILCompiler.MethodKey MethodKey; 10 | 11 | public TypeDesc Type; 12 | 13 | public NativeImportExportKind ImportExportKind; 14 | 15 | public int Module; 16 | 17 | public int Ordinal; 18 | 19 | public ImportExportInfo() 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/Toc/NativeImportExportKind.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler.Toc 4 | { 5 | public enum NativeImportExportKind 6 | { 7 | ModuleTlsIndex, 8 | MethodCode, 9 | MethodDict, 10 | TypeMethodTable, 11 | TypeDict, 12 | TypeGcStatics, 13 | TypeNonGcStatics, 14 | TypeTlsStatics 15 | } 16 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/Toc/TocData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ILCompiler.Toc 5 | { 6 | public class TocData 7 | { 8 | public List ImportExports; 9 | 10 | public List Modules; 11 | 12 | public ILCompiler.Toc.ElementsToExport ElementsToExport; 13 | 14 | public const int InvalidOrdinal = 0; 15 | 16 | public TocData() 17 | { 18 | this.ImportExports = new List(); 19 | this.Modules = new List(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/Toc/TocOutputFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler.Toc 4 | { 5 | [Flags] 6 | public enum TocOutputFlags 7 | { 8 | EmitSharedDictionaryLayout = 1, 9 | EmitStableGenericLayout = 2 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/TocModuleKind.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILCompiler 4 | { 5 | public enum TocModuleKind 6 | { 7 | Toc, 8 | TagToc, 9 | ExportIlToc, 10 | BaselineToc, 11 | IlToc 12 | } 13 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/ILCompiler/TypeSystemContextModuleProviderAdapter.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem.Bridge; 2 | using Internal.TypeSystem.Ecma; 3 | using System; 4 | 5 | namespace ILCompiler 6 | { 7 | internal class TypeSystemContextModuleProviderAdapter : IEcmaModuleProvider 8 | { 9 | private readonly CompilerTypeSystemContext _typeSystemContext; 10 | 11 | public TypeSystemContextModuleProviderAdapter(CompilerTypeSystemContext typeSystemContext) 12 | { 13 | this._typeSystemContext = typeSystemContext; 14 | } 15 | 16 | public EcmaModule GetModuleFromPath(string filePath) 17 | { 18 | return this._typeSystemContext.GetModuleFromPath(filePath); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.CommandLine/CommandLineException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Internal.CommandLine 4 | { 5 | internal class CommandLineException : Exception 6 | { 7 | public CommandLineException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/ComposerModule.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem.Ecma; 2 | using System; 3 | using System.IO; 4 | 5 | namespace Internal.TypeSystem.Bridge 6 | { 7 | public class ComposerModule 8 | { 9 | public string FileName; 10 | 11 | public System.IO.FileStream FileStream; 12 | 13 | public Internal.TypeSystem.Ecma.EcmaModule EcmaModule; 14 | 15 | public int TypedefMinToken; 16 | 17 | public int TypedefMaxToken; 18 | 19 | public int MinMergedToken; 20 | 21 | public int MaxMergedToken; 22 | 23 | public int TokenOffset; 24 | 25 | public ComposerModule() 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/DummyGenericContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Internal.TypeSystem.Bridge 4 | { 5 | internal class DummyGenericContext 6 | { 7 | public DummyGenericContext() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/IEcmaModuleProvider.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem.Ecma; 2 | using System; 3 | 4 | namespace Internal.TypeSystem.Bridge 5 | { 6 | public interface IEcmaModuleProvider 7 | { 8 | EcmaModule GetModuleFromPath(string filePath); 9 | } 10 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/IEcmaTokenResolver.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System.Reflection.Metadata; 3 | 4 | namespace Internal.TypeSystem.Bridge 5 | { 6 | public interface IEcmaTokenResolver 7 | { 8 | TypeSystemContext Context 9 | { 10 | get; 11 | } 12 | 13 | TypeDesc ResolveTypeHandle(EntityHandle entityHandle); 14 | } 15 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/IReverseTypeSystemBridgeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Internal.TypeSystem.Bridge 5 | { 6 | // Token: 0x0200004C RID: 76 7 | [Guid("53B671F1-9E6A-49C9-A293-84AD342723A1")] 8 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 9 | [ComImport] 10 | public interface IReverseTypeSystemBridgeProvider 11 | { 12 | // Token: 0x0600023C RID: 572 13 | void NotifyNewTypeToken(int tempToken, [MarshalAs(UnmanagedType.LPArray)][In] byte[] signature, int signatureLength); 14 | 15 | // Token: 0x0600023D RID: 573 16 | void NotifyNewInstantiatedMethodToken(int tempToken, int uninstantiatedMethodToken, [MarshalAs(UnmanagedType.LPArray)][In] byte[] signature, int signatureLength); 17 | 18 | // Token: 0x0600023E RID: 574 19 | void NotifyNewMethodTokenFromTempTypeTokenAndECMAMethodToken(int token, int typeToken, int ECMAMethodToken); 20 | 21 | // Token: 0x0600023F RID: 575 22 | void NotifyNewUnboxingMethodToken(int tempToken, int nonUnboxingMethodToken); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/SignatureExtensions.cs: -------------------------------------------------------------------------------- 1 | using Internal.TypeSystem; 2 | using System; 3 | using System.Linq; 4 | using System.Reflection.Metadata; 5 | using System.Runtime.CompilerServices; 6 | 7 | namespace Internal.TypeSystem.Bridge 8 | { 9 | public static class SignatureExtensions 10 | { 11 | public static MethodSignature GetTypeSystemMethodSignature(this MethodSignature signature) 12 | { 13 | MethodSignatureFlags methodSignatureFlag = MethodSignatureFlags.None; 14 | if (!signature.Header.IsInstance) 15 | { 16 | methodSignatureFlag |= MethodSignatureFlags.Static; 17 | } 18 | return new MethodSignature(methodSignatureFlag, signature.GenericParameterCount, signature.ReturnType, signature.ParameterTypes.ToArray()); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/TempToPermanentMapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Internal.TypeSystem.Bridge 4 | { 5 | public struct TempToPermanentMapping 6 | { 7 | public int TempToken; 8 | 9 | public int PermanentToken; 10 | } 11 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Internal.TypeSystem.Bridge/TokenType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Internal.TypeSystem.Bridge 4 | { 5 | [Flags] 6 | internal enum TokenType 7 | { 8 | Mask = -16777216, 9 | Type = 33554432, 10 | Field = 67108864, 11 | Method = 100663296, 12 | MethodSignature = 285212672 13 | } 14 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Microsoft.NetNative/ErrorTraceListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | 5 | namespace Microsoft.NetNative 6 | { 7 | internal class ErrorTraceListener : DefaultTraceListener 8 | { 9 | public ErrorTraceListener() 10 | { 11 | } 12 | 13 | public override void Fail(string message, string detailMessage) 14 | { 15 | if (!string.Equals(Environment.GetEnvironmentVariable("NETNATIVE_DISABLEASSERTUI"), "true", StringComparison.OrdinalIgnoreCase)) 16 | { 17 | base.Fail(message, detailMessage); 18 | return; 19 | } 20 | string str = string.Concat(new string[] { "Assertion failed: ", message, Environment.NewLine, detailMessage, Environment.NewLine, (new StackTrace(4)).ToString() }); 21 | Console.Error.WriteLine(str); 22 | base.WriteLine(str); 23 | if (Debugger.IsAttached) 24 | { 25 | Debugger.Break(); 26 | } 27 | Environment.Exit(-1); 28 | } 29 | 30 | public static void ReplaceDefaulTraceListener() 31 | { 32 | Debug.Listeners.Clear(); 33 | Debug.Listeners.Add(new ErrorTraceListener()); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Security.Permissions; 5 | 6 | [assembly: AssemblyCompany("Microsoft Corporation")] 7 | [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] 8 | [assembly: AssemblyDefaultAlias("ILCompiler.Host")] 9 | [assembly: AssemblyDescription("ILCompiler.Host")] 10 | [assembly: AssemblyFileVersion("2.2.31116.00")] 11 | [assembly: AssemblyInformationalVersion("2.2.31116.00 built by: PROJECTNREL")] 12 | [assembly: AssemblyMetadata("", "")] 13 | [assembly: AssemblyProduct("Microsoft® .NET Framework")] 14 | [assembly: AssemblyTitle("ILCompiler.Host")] 15 | [assembly: AssemblyVersion("2.2.0.0")] 16 | [assembly: CompilationRelaxations(8)] 17 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 18 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)] 19 | [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification=true)] 20 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.Host/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ILCompiler/ILCompiler.MetadataTransform/ILCompiler/Metadata/Transform.String.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | using Internal.Metadata.NativeFormat.Writer; 9 | 10 | namespace ILCompiler.Metadata 11 | { 12 | partial class Transform 13 | { 14 | private Dictionary _strings = new Dictionary(StringComparer.Ordinal); 15 | 16 | private ConstantStringValue HandleString(string s) 17 | { 18 | if (s == null) 19 | return null; 20 | 21 | ConstantStringValue result; 22 | if (!_strings.TryGetValue(s, out result)) 23 | { 24 | result = (ConstantStringValue)s; 25 | _strings.Add(s, result); 26 | } 27 | 28 | return result; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Libs/ARM/mrt100X_app.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/ARM/mrt100X_app.exp -------------------------------------------------------------------------------- /Libs/ARM/mrt100X_app.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/ARM/mrt100X_app.lib -------------------------------------------------------------------------------- /Libs/x64/mrt100X_app.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/x64/mrt100X_app.exp -------------------------------------------------------------------------------- /Libs/x64/mrt100X_app.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/x64/mrt100X_app.lib -------------------------------------------------------------------------------- /Libs/x86/mrt100X_app.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/x86/mrt100X_app.exp -------------------------------------------------------------------------------- /Libs/x86/mrt100X_app.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed605/ProjectRT/c998595bf1423954a1f1c4eaf989749f523b6c12/Libs/x86/mrt100X_app.lib -------------------------------------------------------------------------------- /bootstrap/bootstrap.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /bootstrap_dll/bootstrap_dll.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /shimAppDll/shimAppDll.cpp: -------------------------------------------------------------------------------- 1 | extern "C" __int64 InvokeExeMain(void* main); 2 | extern "C" void __Managed_Main(); 3 | 4 | extern "C" __int64 InvokeMain() 5 | { 6 | return InvokeExeMain(&__Managed_Main); 7 | } 8 | 9 | #pragma comment(linker, "/export:InvokeMain") -------------------------------------------------------------------------------- /shimAppDll/shimAppDll.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /shimExe/shimExe.cpp: -------------------------------------------------------------------------------- 1 | #pragma comment(linker, "/nodefaultlib") 2 | #pragma comment(linker, "/defaultlib:uuid.lib") 3 | 4 | extern "C" __declspec(dllimport) void InvokeMain(); 5 | 6 | extern "C" int wmain() 7 | { 8 | InvokeMain(); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /shimExe/shimExe.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | --------------------------------------------------------------------------------