iseq_collector 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32d9403f57f44d72f2ee72f561ab06992f8386ed
4
- data.tar.gz: '01815aa3e10ae9e4604df248d4e30b43eab20ea8'
3
+ metadata.gz: 65748299ec8c1bc18d1b2331297771eeecf8f3dd
4
+ data.tar.gz: d29f03e81016604d187f8353cf785e20564bcdde
5
5
  SHA512:
6
- metadata.gz: e4ef072b72332d02f84be80efb99349f60d81a52384536015eca377b0d09117f6cdf8097a68ee764d0708f7fd35184e0095ab38e5957fe2df891a077572513c7
7
- data.tar.gz: 67b09baefad027719f545a1085a55337d7f6245dec1b9d81a3da0833698fc2b22ce16f796a3ff44dd4d8f5c8bf4accffc89df542c7dddacd869beca04503f088
6
+ metadata.gz: 42cc8cebb4387e286ba8aa17ea2b130b225e45405d913d28c698452b109e43c7030ef5e095e5e7c56078b68829177b95f13cb2975e518e4e48981953fffd0393
7
+ data.tar.gz: 12acb6034afd13b57f49059769a1f19eb31165bb4da0ae9af1c9bb967cc2ed69ec961a0af6c99a1ec7afea8366b7b661f55d32b0530816e6e4ceecd0377025c6
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # IseqCollector
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/iseq_collector`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem introduce several methdos to `ObjectSpace` to operate all of iseq objects in a process.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Background
6
+
7
+ Ruby (MRI) 2.2 and erlier, all of bytecode (iseq: instruction sequence) are `RubyVM::InstructionSequence` objects and we can touch them with `ObjectSpace.each_object` method.
8
+ However Ruby 2.3 and later does not expose iseqs by `RubyVM::InstructionSequence`. You need to use `RubyVM::InstructionSequence.of(proc or method object)` to get `RubyVM::InstructionSequence` and it is impossible to get all of iseqs in a process.
9
+
10
+ This gem provides `ObjectSpace.each_iseq`, `ObjectSpace.count_iseq` and `ObjectSpace.memsize_of_all_iseq` to get all of iseqs in a process for Ruby 2.3, 2.4. Ruby 2.5 will provide same feature in `objspace` external lib.
6
11
 
7
12
  ## Installation
8
13
 
@@ -22,7 +27,11 @@ Or install it yourself as:
22
27
 
23
28
  ## Usage
24
29
 
25
- TODO: Write usage instructions here
30
+ `require 'iseq_collector'` adds the following singleton methods to `ObjectSpace` module.
31
+
32
+ * `ObjectSpace.each_iseq{|iseq| ...}`
33
+ * `ObjectSpace.count_iseq #=> Integer`
34
+ * `ObjectSpace.memsize_of_all_iseq #=> Integer` (this feature can be implemented by `ObjectSpace.each_iseq`)
26
35
 
27
36
  ## Development
28
37
 
@@ -0,0 +1,4 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile('iseq_collector')
4
+
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.extensions = ['ext/iseq_collector/extconf.rb']
25
+
24
26
  spec.add_development_dependency "bundler", "~> 1.14"
25
27
  spec.add_development_dependency "rake", "~> 10.0"
26
28
  spec.add_development_dependency "minitest", "~> 5.0"
@@ -1,3 +1,3 @@
1
1
  module IseqCollector
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iseq_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Sasada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,7 +70,8 @@ description: ISeq collector for MRI 2.3 and 2.4
70
70
  email:
71
71
  - ko1@atdot.net
72
72
  executables: []
73
- extensions: []
73
+ extensions:
74
+ - ext/iseq_collector/extconf.rb
74
75
  extra_rdoc_files: []
75
76
  files:
76
77
  - ".gitignore"
@@ -81,6 +82,7 @@ files:
81
82
  - Rakefile
82
83
  - bin/console
83
84
  - bin/setup
85
+ - ext/iseq_collector/extconf.rb
84
86
  - iseq_collector.gemspec
85
87
  - lib/iseq_collector.rb
86
88
  - lib/iseq_collector/version.rb
@@ -104,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  version: '0'
105
107
  requirements: []
106
108
  rubyforge_project:
107
- rubygems_version: 2.5.2
109
+ rubygems_version: 2.6.11
108
110
  signing_key:
109
111
  specification_version: 4
110
112
  summary: ISeq collector for MRI 2.3 and 2.4