diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs index 4b298fa4174..3dda08437c7 100644 --- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs +++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs @@ -152,7 +152,7 @@ internal virtual bool CleanupRequired 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 +245,7 @@ public void StoreValue(ILCodeStream stream) 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 +333,7 @@ public static Marshaller CreateMarshaller(TypeDesc parameterType, // 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 +634,7 @@ protected void StoreNativeValue(ILCodeStream stream) /// /// 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 /// protected void PropagateFromByRefArg(ILCodeStream stream, Home home) @@ -646,7 +646,7 @@ protected void PropagateFromByRefArg(ILCodeStream stream, Home home) /// /// 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 /// protected void PropagateToByRefArg(ILCodeStream stream, Home home) @@ -838,7 +838,7 @@ protected virtual void EmitMarshalFieldManagedToNative() SetupArgumentsForFieldMarshalling(); // // For field marshalling we expect the value of the field is already loaded - // in the stack. + // in the stack. // StoreManagedValue(marshallingCodeStream); @@ -980,11 +980,6 @@ protected TypeDesc NativeElementType } } - protected override void SetupArgumentsForReturnValueMarshalling() - { - ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, ManagedType); - } - protected override void SetupArgumentsForFieldMarshalling() { ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, ManagedType); @@ -1358,7 +1353,7 @@ protected override void AllocAndTransformManagedToNative(ILCodeStream codeStream // Check for null array LoadManagedValue(codeStream); codeStream.Emit(ILOpcode.brfalse, lNullArray); - + if (IsManagedByRef) { base.AllocManagedToNative(codeStream); @@ -1774,7 +1769,7 @@ protected override void EmitMarshalArgumentManagedToNative() 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); } @@ -1785,7 +1780,7 @@ protected override void EmitMarshalArgumentManagedToNative() // 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); @@ -1902,7 +1897,7 @@ protected override void TransformNativeToManaged(ILCodeStream codeStream) )))); #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,