diff options
author | Jan Kotas <jkotas@microsoft.com> | 2021-06-03 15:58:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 15:58:33 +0300 |
commit | 0fcd7690a14335a8807144d0e7ad937aa83699b0 (patch) | |
tree | 670bc92ffb399fdfa0a359aa07ddef8be98e247d /src/coreclr/tools/Common | |
parent | f18f41b14816f02877c721d99ccc761967748184 (diff) |
Integrate changes from NativeAOT branch (#53650)
* Integrate changes from NativeAOT branch
Includes faster virtual method enumerator that should help crossgen2 too
* Fix tests
Diffstat (limited to 'src/coreclr/tools/Common')
17 files changed, 180 insertions, 39 deletions
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ArrayType.cs b/src/coreclr/tools/Common/TypeSystem/Common/ArrayType.cs index c3e227ed3f6..c21ba9342e1 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/ArrayType.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/ArrayType.cs @@ -119,6 +119,11 @@ namespace Internal.TypeSystem return _methods; } + public override IEnumerable<MethodDesc> GetVirtualMethods() + { + return MethodDesc.EmptyMethods; + } + public MethodDesc GetArrayMethod(ArrayMethodKind kind) { if (_methods == null) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs index dd38a715c5f..ab093a379d2 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/ExceptionStringID.cs @@ -41,5 +41,8 @@ namespace Internal.TypeSystem // BadImageFormatException BadImageFormatGeneric, BadImageFormatSpecific, + + // MarshalDirectiveException + MarshalDirectiveGeneric, } } diff --git a/src/coreclr/tools/Common/TypeSystem/Common/InstantiatedType.cs b/src/coreclr/tools/Common/TypeSystem/Common/InstantiatedType.cs index 8d9d18c1a99..f1164b677e2 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/InstantiatedType.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/InstantiatedType.cs @@ -144,6 +144,14 @@ namespace Internal.TypeSystem } } + public override IEnumerable<MethodDesc> GetVirtualMethods() + { + foreach (var typicalMethodDef in _typeDef.GetVirtualMethods()) + { + yield return _typeDef.Context.GetMethodForInstantiatedType(typicalMethodDef, this); + } + } + // TODO: Substitutions, generics, modopts, ... public override MethodDesc GetMethod(string name, MethodSignature signature, Instantiation substitution) { diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataVirtualMethodAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataVirtualMethodAlgorithm.cs index a3af0aa5faa..5a33ab437a5 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataVirtualMethodAlgorithm.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataVirtualMethodAlgorithm.cs @@ -330,11 +330,8 @@ namespace Internal.TypeSystem MethodSignature sig = targetMethod.Signature; MethodDesc implMethod = null; - foreach (MethodDesc candidate in currentType.GetAllMethods()) + foreach (MethodDesc candidate in currentType.GetAllVirtualMethods()) { - if (!candidate.IsVirtual) - continue; - if (candidate.Name == name) { if (candidate.Signature.Equals(sig)) @@ -810,11 +807,8 @@ namespace Internal.TypeSystem { do { - foreach (MethodDesc m in type.GetAllMethods()) + foreach (MethodDesc m in type.GetAllVirtualMethods()) { - if (!m.IsVirtual) - continue; - MethodDesc possibleVirtual = FindSlotDefiningMethodForVirtualMethod(m); if (!alreadyEnumerated.Contains(possibleVirtual)) { diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx b/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx index 489fa6d1e3d..a4f9e6ac985 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx +++ b/src/coreclr/tools/Common/TypeSystem/Common/Properties/Resources.resx @@ -183,4 +183,7 @@ <data name="BadImageFormatSpecific" xml:space="preserve"> <value>The format of a DLL or executable being loaded is invalid with {0}</value> </data> + <data name="MarshalDirectiveGeneric" xml:space="preserve"> + <value>Marshaling directives are invalid</value> + </data> </root> diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs b/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs index 90c02f6ad3a..4e31950b40e 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/ThrowHelper.cs @@ -65,6 +65,12 @@ namespace Internal.TypeSystem throw new TypeSystemException.BadImageFormatException(message); } + [System.Diagnostics.DebuggerHidden] + public static void ThrowMarshalDirectiveException() + { + throw new TypeSystemException.MarshalDirectiveException(ExceptionStringID.MarshalDirectiveGeneric); + } + private static partial class Format { public static string OwningModule(TypeDesc type) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs index b60e0161c81..51cf7291cdd 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeDesc.cs @@ -511,6 +511,16 @@ namespace Internal.TypeSystem } /// <summary> + /// Gets a subset of methods returned by <see cref="GetMethods"/> that are virtual. + /// </summary> + public virtual IEnumerable<MethodDesc> GetVirtualMethods() + { + foreach (MethodDesc method in GetMethods()) + if (method.IsVirtual) + yield return method; + } + + /// <summary> /// Gets a named method on the type. This method only looks at methods defined /// in type's metadata. The <paramref name="signature"/> parameter can be null. /// If signature is not specified and there are multiple matches, the first one diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemContext.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemContext.cs index 21c17d47d99..fcb47f42d3c 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemContext.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemContext.cs @@ -677,6 +677,11 @@ namespace Internal.TypeSystem return type.GetMethods(); } + protected internal virtual IEnumerable<MethodDesc> GetAllVirtualMethods(TypeDesc type) + { + return type.GetVirtualMethods(); + } + /// <summary> /// Abstraction to allow the type system context to affect the field layout /// algorithm used by types to lay themselves out. diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemException.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemException.cs index 598f0f60274..39015e807d9 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemException.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemException.cs @@ -162,5 +162,13 @@ namespace Internal.TypeSystem } } + + public class MarshalDirectiveException : TypeSystemException + { + internal MarshalDirectiveException(ExceptionStringID id) + : base(id) + { + } + } } } diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs index 76bb19921aa..2442f04fee8 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs @@ -261,6 +261,14 @@ namespace Internal.TypeSystem return type.Context.GetAllMethods(type); } + /// <summary> + /// Retrieves all virtual methods on a type, including the ones injected by the type system context. + /// </summary> + public static IEnumerable<MethodDesc> GetAllVirtualMethods(this TypeDesc type) + { + return type.Context.GetAllVirtualMethods(type); + } + public static IEnumerable<MethodDesc> EnumAllVirtualSlots(this TypeDesc type) { return type.Context.GetVirtualMethodAlgorithmForType(type).ComputeAllVirtualSlots(type); diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/DebugNameFormatter.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/DebugNameFormatter.cs index e353a592df4..ea55c07ad76 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/DebugNameFormatter.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/DebugNameFormatter.cs @@ -202,9 +202,15 @@ namespace Internal.TypeSystem } if (assemblyName.StartsWith("System.Private", StringComparison.Ordinal)) - assemblyName = "S.P" + assemblyName.Substring(14); + { + sb.Append("S.P"); + sb.Append(assemblyName, 14, assemblyName.Length - 14); + } + else + { + sb.Append(assemblyName); + } - sb.Append(assemblyName); sb.Append(']'); } } diff --git a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs index 8075ef7e4b6..073cb7a4fdf 100644 --- a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs +++ b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.cs @@ -306,7 +306,18 @@ namespace Internal.TypeSystem.Ecma { foreach (var handle in _typeDefinition.GetMethods()) { - yield return (MethodDesc)_module.GetObject(handle); + yield return (EcmaMethod)_module.GetObject(handle); + } + } + + public override IEnumerable<MethodDesc> GetVirtualMethods() + { + MetadataReader reader = _module.MetadataReader; + foreach (var handle in _typeDefinition.GetMethods()) + { + MethodDefinition methodDef = reader.GetMethodDefinition(handle); + if ((methodDef.Attributes & MethodAttributes.Virtual) != 0) + yield return (EcmaMethod)_module.GetObject(handle); } } @@ -319,7 +330,7 @@ namespace Internal.TypeSystem.Ecma { if (stringComparer.Equals(metadataReader.GetMethodDefinition(handle).Name, name)) { - MethodDesc method = (MethodDesc)_module.GetObject(handle); + var method = (EcmaMethod)_module.GetObject(handle); if (signature == null || signature.Equals(method.Signature.ApplySubstitution(substitution))) return method; } @@ -339,7 +350,7 @@ namespace Internal.TypeSystem.Ecma if (methodDefinition.Attributes.IsRuntimeSpecialName() && stringComparer.Equals(methodDefinition.Name, ".cctor")) { - MethodDesc method = (MethodDesc)_module.GetObject(handle); + var method = (EcmaMethod)_module.GetObject(handle); return method; } } @@ -362,7 +373,7 @@ namespace Internal.TypeSystem.Ecma if (attributes.IsRuntimeSpecialName() && attributes.IsPublic() && stringComparer.Equals(methodDefinition.Name, ".ctor")) { - MethodDesc method = (MethodDesc)_module.GetObject(handle); + var method = (EcmaMethod)_module.GetObject(handle); if (method.Signature.Length != 0) continue; @@ -435,7 +446,7 @@ namespace Internal.TypeSystem.Ecma { foreach (var handle in _typeDefinition.GetNestedTypes()) { - yield return (MetadataType)_module.GetObject(handle); + yield return (EcmaType)_module.GetObject(handle); } } @@ -460,7 +471,7 @@ namespace Internal.TypeSystem.Ecma } if (nameMatched) - return (MetadataType)_module.GetObject(handle); + return (EcmaType)_module.GetObject(handle); } return null; @@ -527,7 +538,7 @@ namespace Internal.TypeSystem.Ecma // Note: GetOffset() returns -1 when offset was not set in the metadata int specifiedOffset = fieldDefinition.GetOffset(); result.Offsets[index] = - new FieldAndOffset((FieldDesc)_module.GetObject(handle), specifiedOffset == -1 ? FieldAndOffset.InvalidOffset : new LayoutInt(specifiedOffset)); + new FieldAndOffset((EcmaField)_module.GetObject(handle), specifiedOffset == -1 ? FieldAndOffset.InvalidOffset : new LayoutInt(specifiedOffset)); index++; } diff --git a/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs b/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs index b7aacf68eb8..5d8d4fd0f4c 100644 --- a/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs +++ b/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs @@ -123,12 +123,25 @@ namespace Internal.TypeSystem.Ecma var sequencePoints = debugInformation.GetSequencePoints(); + DocumentHandle previousDocumentHandle = default; + string previousDocumentUrl = null; + foreach (var sequencePoint in sequencePoints) { - if (sequencePoint.StartLine == 0xFEEFEE) + if (sequencePoint.StartLine == SequencePoint.HiddenLine) continue; - var url = _reader.GetString(_reader.GetDocument(sequencePoint.Document).Name); + string url; + if (sequencePoint.Document == previousDocumentHandle) + { + url = previousDocumentUrl; + } + else + { + url = _reader.GetString(_reader.GetDocument(sequencePoint.Document).Name); + previousDocumentHandle = sequencePoint.Document; + previousDocumentUrl = url; + } yield return new ILSequencePoint(sequencePoint.Offset, url, sequencePoint.StartLine); } diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs index 1989b6514b8..64ba412f6af 100644 --- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs +++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs @@ -63,6 +63,9 @@ namespace Internal.TypeSystem.Interop case MarshallerKind.CBool: return context.GetWellKnownType(WellKnownType.Byte); + case MarshallerKind.VariantBool: + return context.GetWellKnownType(WellKnownType.Int16); + case MarshallerKind.Enum: case MarshallerKind.BlittableStruct: case MarshallerKind.Decimal: @@ -162,6 +165,14 @@ namespace Internal.TypeSystem.Interop case MarshallerKind.ComInterface: return context.GetWellKnownType(WellKnownType.IntPtr); +#if !READYTORUN + case MarshallerKind.Variant: + return InteropTypes.GetVariant(context); +#endif + + case MarshallerKind.OleCurrency: + return context.GetWellKnownType(WellKnownType.Int64); + case MarshallerKind.Unknown: default: throw new NotSupportedException(); @@ -254,6 +265,9 @@ namespace Internal.TypeSystem.Interop case NativeTypeKind.I1: return MarshallerKind.CBool; + case NativeTypeKind.VariantBool: + return MarshallerKind.VariantBool; + default: return MarshallerKind.Invalid; } @@ -355,6 +369,8 @@ namespace Internal.TypeSystem.Interop return MarshallerKind.Decimal; else if (nativeType == NativeTypeKind.LPStruct && !isField) return MarshallerKind.BlittableStructPtr; + else if (nativeType == NativeTypeKind.Currency) + return MarshallerKind.OleCurrency; else return MarshallerKind.Invalid; } @@ -434,9 +450,6 @@ namespace Internal.TypeSystem.Interop { case NativeTypeKind.Array: { - if (isField || isReturn) - return MarshallerKind.Invalid; - var arrayType = (ArrayType)type; elementMarshallerKind = GetArrayElementMarshallerKind( @@ -569,7 +582,7 @@ namespace Internal.TypeSystem.Interop || nativeType == NativeTypeKind.IUnknown) return MarshallerKind.ComInterface; else - return MarshallerKind.Invalid; + return MarshallerKind.Variant; } else if (InteropTypes.IsStringBuilder(context, type)) { @@ -794,6 +807,11 @@ namespace Internal.TypeSystem.Interop return MarshallerKind.UnicodeString; case NativeTypeKind.LPUTF8Str: return MarshallerKind.UTF8String; + case NativeTypeKind.BStr: + case NativeTypeKind.TBStr: + return MarshallerKind.BSTRString; + case NativeTypeKind.AnsiBStr: + return MarshallerKind.AnsiBSTRString; default: return MarshallerKind.Invalid; } diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs index d9d23c55836..46c53157b46 100644 --- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs +++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs @@ -19,6 +19,7 @@ namespace Internal.TypeSystem.Interop BlittableArray, Bool, // 4 byte bool CBool, // 1 byte bool + VariantBool, // Variant bool Enum, AnsiChar, // Marshal char (Unicode 16bits) for byte (Ansi 8bits) UnicodeChar, @@ -43,6 +44,7 @@ namespace Internal.TypeSystem.Interop Object, OleDateTime, Decimal, + OleCurrency, Guid, Struct, BlittableStruct, @@ -152,7 +154,7 @@ namespace Internal.TypeSystem.Interop public bool Return; public bool IsManagedByRef; // Whether managed argument is passed by ref public bool IsNativeByRef; // Whether native argument is passed by byref - // There are special cases (such as LpStruct, and class) that + // There are special cases (such as LpStruct, and class) that // isNativeByRef != IsManagedByRef public MarshalDirection MarshalDirection; protected PInvokeILCodeStreams _ilCodeStreams; @@ -245,7 +247,7 @@ namespace Internal.TypeSystem.Interop break; default: // Storing by-ref arg/local is not supported because StInd require - // address to be pushed first. Instead we need to introduce a non-byref + // address to be pushed first. Instead we need to introduce a non-byref // local and propagate value as needed for by-ref arguments Debug.Assert(false); break; @@ -333,7 +335,7 @@ namespace Internal.TypeSystem.Interop // if (isOut) { - // Passing as [Out] by ref is always valid. + // Passing as [Out] by ref is always valid. if (!marshaller.IsManagedByRef) { // Ignore [Out] for ValueType, string and pointers @@ -634,7 +636,7 @@ namespace Internal.TypeSystem.Interop /// <summary> /// Propagate by-ref arg to corresponding local - /// We can't load value + ldarg + ldind in the expected order, so + /// We can't load value + ldarg + ldind in the expected order, so /// we had to use a non-by-ref local and manually propagate the value /// </summary> protected void PropagateFromByRefArg(ILCodeStream stream, Home home) @@ -646,7 +648,7 @@ namespace Internal.TypeSystem.Interop /// <summary> /// Propagate local to corresponding by-ref arg - /// We can't load value + ldarg + ldind in the expected order, so + /// We can't load value + ldarg + ldind in the expected order, so /// we had to use a non-by-ref local and manually propagate the value /// </summary> protected void PropagateToByRefArg(ILCodeStream stream, Home home) @@ -838,7 +840,7 @@ namespace Internal.TypeSystem.Interop SetupArgumentsForFieldMarshalling(); // // For field marshalling we expect the value of the field is already loaded - // in the stack. + // in the stack. // StoreManagedValue(marshallingCodeStream); @@ -980,6 +982,11 @@ namespace Internal.TypeSystem.Interop } } + protected override void SetupArgumentsForFieldMarshalling() + { + ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, ManagedType); + } + protected Marshaller GetElementMarshaller(MarshalDirection direction) { if (_elementMarshaller == null) @@ -1038,7 +1045,7 @@ namespace Internal.TypeSystem.Interop if (index < 0 || index >= Marshallers.Length - 1) { - throw new InvalidProgramException("Invalid SizeParamIndex, must be between 0 and parameter count"); + ThrowHelper.ThrowMarshalDirectiveException(); } //zero-th index is for return type @@ -1058,7 +1065,8 @@ namespace Internal.TypeSystem.Interop case TypeFlags.UIntPtr: break; default: - throw new InvalidProgramException("Invalid SizeParamIndex, parameter must be of type int/uint"); + ThrowHelper.ThrowMarshalDirectiveException(); + break; } // @TODO - We can use LoadManagedValue, but that requires byref arg propagation happen in a special setup stream @@ -1347,7 +1355,7 @@ namespace Internal.TypeSystem.Interop // Check for null array LoadManagedValue(codeStream); codeStream.Emit(ILOpcode.brfalse, lNullArray); - + if (IsManagedByRef) { base.AllocManagedToNative(codeStream); @@ -1405,13 +1413,38 @@ namespace Internal.TypeSystem.Interop class BooleanMarshaller : Marshaller { + private int _trueValue; + public BooleanMarshaller(int trueValue = 1) + { + _trueValue = trueValue; + } + protected override void AllocAndTransformManagedToNative(ILCodeStream codeStream) { + ILEmitter emitter = _ilCodeStreams.Emitter; + ILCodeLabel pLoadFalseLabel = emitter.NewCodeLabel(); + ILCodeLabel pDoneLabel = emitter.NewCodeLabel(); + LoadManagedValue(codeStream); - codeStream.EmitLdc(0); - codeStream.Emit(ILOpcode.ceq); - codeStream.EmitLdc(0); - codeStream.Emit(ILOpcode.ceq); + if (_trueValue == 1) + { + codeStream.EmitLdc(0); + codeStream.Emit(ILOpcode.ceq); + codeStream.EmitLdc(0); + codeStream.Emit(ILOpcode.ceq); + } + else + { + codeStream.Emit(ILOpcode.brfalse, pLoadFalseLabel); + codeStream.EmitLdc(_trueValue); + codeStream.Emit(ILOpcode.br, pDoneLabel); + + codeStream.EmitLabel(pLoadFalseLabel); + codeStream.EmitLdc(0); + + codeStream.EmitLabel(pDoneLabel); + } + StoreNativeValue(codeStream); } @@ -1763,7 +1796,7 @@ namespace Internal.TypeSystem.Interop cleanupCodeStream.Emit(ILOpcode.brfalse, lNotAddrefed); LoadManagedValue(cleanupCodeStream); cleanupCodeStream.Emit(ILOpcode.call, emitter.NewToken( - safeHandleType.GetKnownMethod("DangerousRelease", + safeHandleType.GetKnownMethod("DangerousRelease", new MethodSignature(0, 0, Context.GetWellKnownType(WellKnownType.Void), TypeDesc.EmptyTypes)))); cleanupCodeStream.EmitLabel(lNotAddrefed); } @@ -1774,7 +1807,7 @@ namespace Internal.TypeSystem.Interop // must allocate this before the native call to avoid a failure point when we already have a native resource // allocated. We must allocate a new SafeHandle even if we have one on input since both input and output native // handles need to be tracked and released by a SafeHandle. - // 2) Initialize a local IntPtr that will be passed to the native call. + // 2) Initialize a local IntPtr that will be passed to the native call. // 3) After the native call, the new handle value is written into the output SafeHandle and that SafeHandle // is propagated back to the caller. var vSafeHandle = emitter.NewLocal(ManagedType); @@ -1891,7 +1924,7 @@ namespace Internal.TypeSystem.Interop )))); #else codeStream.Emit(ILOpcode.ldtoken, _ilCodeStreams.Emitter.NewToken(ManagedType)); - + codeStream.Emit(ILOpcode.call, _ilCodeStreams.Emitter.NewToken( InteropTypes.GetPInvokeMarshal(Context).GetKnownMethod("GetDelegateForFunctionPointer", new MethodSignature(MethodSignatureFlags.Static, 0, Context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType, diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/MarshalAsDescriptor.cs b/src/coreclr/tools/Common/TypeSystem/Interop/MarshalAsDescriptor.cs index 05c95826e26..26b5312c4b8 100644 --- a/src/coreclr/tools/Common/TypeSystem/Interop/MarshalAsDescriptor.cs +++ b/src/coreclr/tools/Common/TypeSystem/Interop/MarshalAsDescriptor.cs @@ -19,6 +19,7 @@ namespace Internal.TypeSystem U8 = 0xa, R4 = 0xb, R8 = 0xc, + Currency = 0xf, BStr = 0x13, LPStr = 0x14, LPWStr = 0x15, @@ -33,6 +34,7 @@ namespace Internal.TypeSystem SysUInt = 0x20, AnsiBStr = 0x23, TBStr = 0x24, + VariantBool = 0x25, Func = 0x26, AsAny = 0x28, Array = 0x2a, diff --git a/src/coreclr/tools/Common/TypeSystem/RuntimeDetermined/RuntimeDeterminedType.cs b/src/coreclr/tools/Common/TypeSystem/RuntimeDetermined/RuntimeDeterminedType.cs index e651989e182..df7dbd13dde 100644 --- a/src/coreclr/tools/Common/TypeSystem/RuntimeDetermined/RuntimeDeterminedType.cs +++ b/src/coreclr/tools/Common/TypeSystem/RuntimeDetermined/RuntimeDeterminedType.cs @@ -114,6 +114,14 @@ namespace Internal.TypeSystem } } + public override IEnumerable<MethodDesc> GetVirtualMethods() + { + foreach (var method in _rawCanonType.GetVirtualMethods()) + { + yield return Context.GetMethodForRuntimeDeterminedType(method.GetTypicalMethodDefinition(), this); + } + } + public override MethodDesc GetMethod(string name, MethodSignature signature, Instantiation substitution) { MethodDesc method = _rawCanonType.GetMethod(name, signature, substitution); |