Show / Hide Table of Contents

    Class OnDemandOptimizer

    An optimizer that computes optimized method bodies on an on-demand basis: method bodies are not optimized until they are requested. Optimized method bodies are cached, so method bodies are never optimized twice.

    Inheritance
    System.Object
    Optimizer
    OnDemandOptimizer
    ParallelOnDemandOptimizer
    Inherited Members
    Optimizer.RunAllAsync<T>(IEnumerable<Func<Task<T>>>)
    Optimizer.RunAllAsync(IEnumerable<Func<Task>>)
    Optimizer.RunAllAsync(IEnumerable<Task>)
    Optimizer.RunAllAsync<T>(IEnumerable<Task<T>>)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Flame.Compiler.Pipeline
    Assembly: Flame.Compiler.dll
    Syntax
    public class OnDemandOptimizer : Optimizer

    Constructors

    | Improve this Doc View Source

    OnDemandOptimizer(IReadOnlyList<Optimization>)

    Creates a method body optimizer.

    Declaration
    public OnDemandOptimizer(IReadOnlyList<Optimization> pipeline)
    Parameters
    Type Name Description
    System.Collections.Generic.IReadOnlyList<Optimization> pipeline

    A pass pipeline: a sequence of optimizations to apply to every method body.

    | Improve this Doc View Source

    OnDemandOptimizer(IReadOnlyList<Optimization>, Func<IMethod, MethodBody>)

    Creates a method body optimizer.

    Declaration
    public OnDemandOptimizer(IReadOnlyList<Optimization> pipeline, Func<IMethod, MethodBody> getInitialMethodBody)
    Parameters
    Type Name Description
    System.Collections.Generic.IReadOnlyList<Optimization> pipeline

    A pass pipeline: a sequence of optimizations to apply to every method body.

    System.Func<IMethod, MethodBody> getInitialMethodBody

    A delegate that tries to find an initial method body for a method. This initial method body is is the starting point for further optimizations, both interprocedural and intraprocedural.

    Methods

    | Improve this Doc View Source

    GetBodyAsync(IMethod)

    Asynchronously requests a method's body. This method should only used by external entities: if methods that are being optimized call this method, then they might cause a deadlock.

    Declaration
    public override Task<MethodBody> GetBodyAsync(IMethod requested)
    Parameters
    Type Name Description
    IMethod requested

    The method whose body is requested.

    Returns
    Type Description
    System.Threading.Tasks.Task<MethodBody>

    The method's body.

    Overrides
    Optimizer.GetBodyAsync(IMethod)
    Remarks

    The optimizer is free to return any method body that is semantically equivalent to requested's body. This ranges from requested's initial method body to its final optimized body.

    Which version of requested's body is returned depends on the optimizer. The optimizer is expected to return a method body that is as optimized as possible given the constraints imposed by the optimizer's implementation.

    | Improve this Doc View Source

    GetBodyAsync(IMethod, IMethod)

    Asynchronously requests a method's body. This method will never cause a deadlock, even when methods cyclically request each other's method bodies.

    Declaration
    public override Task<MethodBody> GetBodyAsync(IMethod requested, IMethod requesting)
    Parameters
    Type Name Description
    IMethod requested

    The method whose body is requested.

    IMethod requesting

    The method that requests requested's method body.

    Returns
    Type Description
    System.Threading.Tasks.Task<MethodBody>

    The method's body.

    Overrides
    Optimizer.GetBodyAsync(IMethod, IMethod)
    Remarks

    The optimizer is free to return any method body that is semantically equivalent to requested's body. This ranges from requested's initial method body to its final optimized body.

    Which version of requested's body is returned depends on the optimizer. The optimizer is expected to return a method body that is as optimized as possible given the constraints imposed by the optimizer's implementation.

    | Improve this Doc View Source

    GetInitialMethodBodyDefault(IMethod)

    Gets an initial method body for a method using the default mechanism of checking if the method is a body method and requesting its method body if so.

    Declaration
    public static MethodBody GetInitialMethodBodyDefault(IMethod method)
    Parameters
    Type Name Description
    IMethod method

    The recursive generic method declaration to inspect.

    Returns
    Type Description
    MethodBody

    A method body if one can be found; otherwise null.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX