From 313b108a6c535c7e8ffea50650759b4428d4f61b Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 14 Apr 2021 20:39:34 +0200 Subject: [PATCH] Move get_option under delay to handle pre-initialization --- src/main/ruby/truffleruby/core/truffle/regexp_operations.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb b/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb index e010b3f4ae1c..f13ef8f63e48 100644 --- a/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb +++ b/src/main/ruby/truffleruby/core/truffle/regexp_operations.rb @@ -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 @@ -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|