src/sys/dotnet/perwapi/PERWAPI.cs
/// <summary>
/// Get the delta distance for this instruction.
/// </summary>
/// <remarks>
/// The delta distance is the resulting difference of items
/// left on the stack after calling this instruction.
/// </remarks>
/// <returns>An integer value representing the delta distance.</returns>
Get the delta distance for this instruction.
Get the delta distance for this instruction .
internal override int GetDeltaDistance() {
            switch ((MethodOp)instr) {
                case MethodOp.callvirt:
                case MethodOp.call: {
                        int depth = (int)meth.GetSig().numPars * -1;
                        if (meth.GetSig().HasCallConv(CallConv.Instance)) depth--;
                        if (meth.GetSig().HasCallConv(CallConv.Vararg)) depth += (int)meth.GetSig().numOptPars * -1;
                        if (meth.GetSig().HasCallConv(CallConv.Generic)) depth += (int)meth.GetSig().numGenPars * -1;
                        if (!meth.GetRetType().SameType(PrimitiveType.Void)) depth++;
                        return depth;
                    }
                case MethodOp.newobj: {
                        int depth = (int)meth.GetSig().numPars * -1;
                        if (meth.GetSig().HasCallConv(CallConv.Vararg)) depth += (int)meth.GetSig().numOptPars * -1;
                        if (meth.GetSig().HasCallConv(CallConv.Generic)) depth += (int)meth.GetSig().numGenPars * -1;
                        depth++;
                        return depth;
                    }
                case MethodOp.ldtoken:
                case MethodOp.ldftn:
                    return 1;
                case MethodOp.jmp:
                case MethodOp.ldvirtfn:
                    return 0;
                default:
                    throw new Exception("The MethodOp for this MethoInstr is not supported.");
            }
        }
internal override int GetDeltaDistance ( ) { switch ( ( MethodOp ) instr ) { case MethodOp . callvirt : case MethodOp . call : { int depth = ( int ) meth . GetSig ( ) . numPars * - 1 ; if ( meth . GetSig ( ) . HasCallConv ( CallConv . Instance ) ) depth -- ; if ( meth . GetSig ( ) . HasCallConv ( CallConv . Vararg ) ) depth += ( int ) meth . GetSig ( ) . numOptPars * - 1 ; if ( meth . GetSig ( ) . HasCallConv ( CallConv . Generic ) ) depth += ( int ) meth . GetSig ( ) . numGenPars * - 1 ; if ( ! meth . GetRetType ( ) . SameType ( PrimitiveType . Void ) ) depth ++ ; return depth ; } case MethodOp . newobj : { int depth = ( int ) meth . GetSig ( ) . numPars * - 1 ; if ( meth . GetSig ( ) . HasCallConv ( CallConv . Vararg ) ) depth += ( int ) meth . GetSig ( ) . numOptPars * - 1 ; if ( meth . GetSig ( ) . HasCallConv ( CallConv . Generic ) ) depth += ( int ) meth . GetSig ( ) . numGenPars * - 1 ; depth ++ ; return depth ; } case MethodOp . ldtoken : case MethodOp . ldftn : return 1 ; case MethodOp . jmp : case MethodOp . ldvirtfn : return 0 ; default : throw new Exception ( " " ) ; } }
Get the delta distance for this instruction.
Get the delta distance for this instruction .
// Add the parameter count to the depth // Check to see if this is an instance method // Check to see if this method uses the optional parameters // Check to see if this method uses the generic parameters // Check if a return value will be placed on the stack. // Add the parameter count to the depth // Check to see if this method uses the optional parameters // Check to see if this method uses the generic parameters // Add the object reference that is loaded onto the stack // Someone has added a new MethodOp and not added a case for it here.
An integer value representing the delta distance.
An integer value representing the delta distance .
remarks
The delta distance is the resulting difference of items
left on the stack after calling this instruction.
The delta distance is the resulting difference of items left on the stack after calling this instruction .