Skip to content

Commit

Permalink
Remove not needed change
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 committed May 25, 2021
1 parent 4db4a0e commit beca115
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -634,7 +634,7 @@ protected void StoreNativeValue(ILCodeStream stream)

/// <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)
Expand All @@ -646,7 +646,7 @@ protected void PropagateFromByRefArg(ILCodeStream stream, Home home)

/// <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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit beca115

Please sign in to comment.