From 0a75e8c3bab5d0e43542adcb9b89348056f3b045 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 27 Feb 2019 10:13:38 +0200 Subject: [PATCH] update parser since not we run 2.4+ also update the statistics gatherer --- Gemfile.lock | 6 +++--- {stash/fragments => bin}/collector.rb | 26 +++++++++++++++++++------- rubyx.gemspec | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) rename {stash/fragments => bin}/collector.rb (82%) diff --git a/Gemfile.lock b/Gemfile.lock index 0740491f..e74cc65e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ PATH remote: . specs: rubyx (0.6.0) - parser (~> 2.3.0) + parser (~> 2.4.0) rx-file (~> 0.3) GEM @@ -60,8 +60,8 @@ GEM notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) - parser (2.3.3.1) - ast (~> 2.2) + parser (2.4.0.2) + ast (~> 2.3) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) diff --git a/stash/fragments/collector.rb b/bin/collector.rb similarity index 82% rename from stash/fragments/collector.rb rename to bin/collector.rb index 9c163cc9..699a5f97 100644 --- a/stash/fragments/collector.rb +++ b/bin/collector.rb @@ -1,12 +1,24 @@ -require "risc/interpreter" -require "parser/ruby22" +require 'rubygems' +require 'bundler' +Bundler.setup(:default, :test) + +require "rubyx" +require "parser/current" require "yaml" # An experiment to find out how much ruby there is to achieve bootstrap # -# currently (jan/2017) just under 150 classes, 1.5k methods , 10k sends, only 10 yields -# 1 retry and redo (to be avoided), 4 ensure , 5 rescue -# +# currently (feb/2019) just over +# 173 classes +# 1.8k methods +# 13k sends +# 13 yields (250 blocks) +# 1 redo (to be avoided) +# 4 ensure +# 6 rescue +# 38 singleton classes (not in rubyx) +# 14 evals (different versions , and all problematic) +# and a whole list of every other possible ruby feature class Walker < AST::Processor def initialize collector @collector = collector @@ -47,7 +59,7 @@ end class Collector def initialize - @parser = Parser::Ruby22 + @parser = Parser::CurrentRuby @paths = Bundler.load.specs.collect { |s| s.gem_dir + "/lib/" } @class_defs = [] @const_uses = Hash.new(0) @@ -89,7 +101,7 @@ class Collector def print @class_defs.uniq! @files.uniq! - puts "Types #{@types.to_yaml}" + puts "Types #{@types.sort.to_h.to_yaml}" puts "Class defs #{@class_defs.length}" puts "Class defs #{@class_defs}" puts "evals=#{@evals.length} #{@evals.uniq}" diff --git a/rubyx.gemspec b/rubyx.gemspec index 3c7a9088..e8213b13 100644 --- a/rubyx.gemspec +++ b/rubyx.gemspec @@ -13,6 +13,6 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.summary = 'RubyX is a native object vm without any c, one day possibly a ruby vm' - s.add_dependency "parser" , "~> 2.3.0" + s.add_dependency "parser" , "~> 2.4.0" s.add_dependency "rx-file" , "~> 0.3" end