Module: Seafoam::Passes

Defined in:
lib/seafoam/passes.rb,
lib/seafoam/passes/graal.rb,
lib/seafoam/passes/truffle.rb,
lib/seafoam/passes/fallback.rb

Overview

Passes are routines to read the graph and apply properties which tools, such as the render command, can use to show more understandable output.

Defined Under Namespace

Classes: FallbackPass, GraalPass, TrufflePass

Class Method Summary collapse

Class Method Details

.apply(graph, options = {}) ⇒ Object

Apply all applicable passes to a graph.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/seafoam/passes.rb', line 6

def self.apply(graph, options = {})
  passes.each do |pass|
    next unless pass.applies?(graph)

    # Record for information that the pass was applied this graph.
    passes_applied = graph.props[:passes_applied] ||= []
    passes_applied.push pass

    # Run the pass.
    instance = pass.new(options)
    instance.apply graph
  end
end

.passesObject

Get a list of all passes in the system.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/seafoam/passes.rb', line 21

def self.passes
  # We have a defined order for passes to run - these passes at the start.
  pre_passes = [
    TrufflePass,
    GraalPass
  ]

  # The fallback pass runs last.
  post_passes = [
    FallbackPass
  ]

  # Any extra passes in the middle.
  extra_passes = Pass::SUBCLASSES.dup - pre_passes - post_passes

  pre_passes + extra_passes + post_passes
end