class Ven::Optimizer

Included Modules

Defined in:

ven/optimize.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(chunks : Chunks) #

[View source]

Class Method Detail

def self.optimize(chunks, passes = 1) #

Returns the chunks optimized in several passes.


[View source]

Instance Method Detail

def binary2n(operator : String, left : BigDecimal, right : BigDecimal) #

Computes, if possible, an operator with left, right being known BigDecimals (in Ven, nums).


[View source]
def binary2s(operator : String, left : String, right : String) #

Computes, if possible, an operator with left, right being known Strings (in Ven, strs).


[View source]
def optimize(chunk : Chunk) #

Goes over chunk's snippets, performing exactly one optimization first for threes, and then for twos of instructions in each snippet.

This method performs what's known as peephole optimization. It finds blobs of redundant or readily computable instructions, and eliminates them in various ways.


[View source]
def optimize(passes) #

Optimizes the chunks of this Optimizer in several passes.


[View source]