Table of Contents

Class CallHandlerBase

Namespace
Echo.Platforms.AsmResolver.Emulation.Dispatch.ObjectModel
Assembly
Echo.Platforms.AsmResolver.dll

Provides a base implementation for operation codes that call functions or methods.

public abstract class CallHandlerBase : ICilOpCodeHandler
Inheritance
CallHandlerBase
Implements
Derived
Inherited Members

Methods

DevirtualizeMethodInternal(CilExecutionContext, IMethodDescriptor, IList<BitVector>)

Devirtualizes and resolves the method that is referenced by the provided instruction.

protected abstract MethodDevirtualizationResult DevirtualizeMethodInternal(CilExecutionContext context, IMethodDescriptor method, IList<BitVector> arguments)

Parameters

context CilExecutionContext

The execution context the instruction is evaluated in.

method IMethodDescriptor

The method that is being devirtualized.

arguments IList<BitVector>

The arguments pushed onto the stack.

Returns

MethodDevirtualizationResult

The result of the devirtualization.

Dispatch(CilExecutionContext, CilInstruction)

Evaluates a CIL instruction in the provided execution context.

public virtual CilDispatchResult Dispatch(CilExecutionContext context, CilInstruction instruction)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

instruction CilInstruction

The instruction to dispatch and evaluate.

Returns

CilDispatchResult

A value indicating whether the dispatch was successful or caused an error.

FindMethodImplementationInType(TypeDefinition?, MethodDefinition?)

Finds a matching implementation or override of a base method in a type.

protected static MethodDefinition? FindMethodImplementationInType(TypeDefinition? type, MethodDefinition? baseMethod)

Parameters

type TypeDefinition

The type to search in.

baseMethod MethodDefinition

The method to find an implementation for.

Returns

MethodDefinition

The method, or null if none is found.

GetArguments(CilExecutionContext, IMethodDescriptor)

Pops the required arguments for a method call from the stack.

protected IList<BitVector> GetArguments(CilExecutionContext context, IMethodDescriptor method)

Parameters

context CilExecutionContext

The context to evaluate the method call in.

method IMethodDescriptor

The method to pop arguments for.

Returns

IList<BitVector>

The list of marshalled arguments.

HandleCall(CilExecutionContext, CilInstruction, IMethodDescriptor, IList<BitVector>)

Handles the actual calling mechanism of the instruction.

protected CilDispatchResult HandleCall(CilExecutionContext context, CilInstruction instruction, IMethodDescriptor method, IList<BitVector> arguments)

Parameters

context CilExecutionContext

The context to evaluate the instruction in.

instruction CilInstruction

The instruction to dispatch and evaluate.

method IMethodDescriptor

The method that is called.

arguments IList<BitVector>

The arguments to call the method with.

Returns

CilDispatchResult

The dispatching result.

ShouldPopInstanceObject(IMethodDescriptor)

Determines whether the instance object should be popped from the stack for the provided method.

protected virtual bool ShouldPopInstanceObject(IMethodDescriptor method)

Parameters

method IMethodDescriptor

The method to test.

Returns

bool

true if the instance object should be popped, false otherwise.