update parser since not we run 2.4+

also update the statistics gatherer
This commit is contained in:
Torsten Ruger 2019-02-27 10:13:38 +02:00
parent eec72a9fca
commit 0a75e8c3ba
3 changed files with 23 additions and 11 deletions

View File

@ -8,7 +8,7 @@ PATH
remote: . remote: .
specs: specs:
rubyx (0.6.0) rubyx (0.6.0)
parser (~> 2.3.0) parser (~> 2.4.0)
rx-file (~> 0.3) rx-file (~> 0.3)
GEM GEM
@ -60,8 +60,8 @@ GEM
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
parser (2.3.3.1) parser (2.4.0.2)
ast (~> 2.2) ast (~> 2.3)
pry (0.11.3) pry (0.11.3)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)

View File

@ -1,12 +1,24 @@
require "risc/interpreter" require 'rubygems'
require "parser/ruby22" require 'bundler'
Bundler.setup(:default, :test)
require "rubyx"
require "parser/current"
require "yaml" require "yaml"
# An experiment to find out how much ruby there is to achieve bootstrap # 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 # currently (feb/2019) just over
# 1 retry and redo (to be avoided), 4 ensure , 5 rescue # 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 class Walker < AST::Processor
def initialize collector def initialize collector
@collector = collector @collector = collector
@ -47,7 +59,7 @@ end
class Collector class Collector
def initialize def initialize
@parser = Parser::Ruby22 @parser = Parser::CurrentRuby
@paths = Bundler.load.specs.collect { |s| s.gem_dir + "/lib/" } @paths = Bundler.load.specs.collect { |s| s.gem_dir + "/lib/" }
@class_defs = [] @class_defs = []
@const_uses = Hash.new(0) @const_uses = Hash.new(0)
@ -89,7 +101,7 @@ class Collector
def print def print
@class_defs.uniq! @class_defs.uniq!
@files.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.length}"
puts "Class defs #{@class_defs}" puts "Class defs #{@class_defs}"
puts "evals=#{@evals.length} #{@evals.uniq}" puts "evals=#{@evals.length} #{@evals.uniq}"

View File

@ -13,6 +13,6 @@ Gem::Specification.new do |s|
s.require_paths = ['lib'] s.require_paths = ['lib']
s.summary = 'RubyX is a native object vm without any c, one day possibly a ruby vm' 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" s.add_dependency "rx-file" , "~> 0.3"
end end