Class: Seafoam::Graal::GraphDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/seafoam/graal/graph_description.rb

Overview

Provides a high level description of a Graal graph’s features.

Constant Summary collapse

ATTRIBUTES =
[:branches, :calls, :deopts, :linear, :loops]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraphDescription

Returns a new instance of GraphDescription.



12
13
14
15
16
17
18
# File 'lib/seafoam/graal/graph_description.rb', line 12

def initialize
  @branches = false
  @calls = false
  @deopts = false
  @loops = false
  @node_counts = Hash.new(0)
end

Instance Attribute Details

#node_countsObject (readonly)

Returns the value of attribute node_counts.



10
11
12
# File 'lib/seafoam/graal/graph_description.rb', line 10

def node_counts
  @node_counts
end

Instance Method Details

#linearObject



20
21
22
# File 'lib/seafoam/graal/graph_description.rb', line 20

def linear
  !branches && !loops
end

#sorted_node_countsObject



24
25
26
# File 'lib/seafoam/graal/graph_description.rb', line 24

def sorted_node_counts
  @node_counts.to_a.sort_by { |node_class, count| [-count, node_class] }.to_h
end