Skip to content

Commit

Permalink
Move get_option under delay to handle pre-initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Apr 14, 2021
1 parent 46384d7 commit 313b108
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/ruby/truffleruby/core/truffle/regexp_operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ def self.match_from(re, str, pos)
Truffle::Boot.delay do
COMPARE_ENGINES = Truffle::Boot.get_option('compare-regex-engines')
USE_TRUFFLE_REGEX = Truffle::Boot.get_option('use-truffle-regex')
end

if Truffle::Boot.get_option('regexp-instrument-creation') || Truffle::Boot.get_option('regexp-instrument-match')
Truffle::Boot.delay do
if Truffle::Boot.get_option('regexp-instrument-creation') or Truffle::Boot.get_option('regexp-instrument-match')
at_exit do
Truffle::RegexpOperations.print_stats
end
Expand Down Expand Up @@ -189,6 +187,7 @@ def self.print_stats
end

def self.print_stats_table(table)
return if table.empty?
sorted = table.to_a.sort_by(&:last).reverse
width = sorted.first.last.to_s.size
sorted.each do |regexp, count|
Expand Down

0 comments on commit 313b108

Please sign in to comment.