cast_off 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/README +578 -0
  2. data/README.en +256 -0
  3. data/bin/CastOff +145 -0
  4. data/cast_off.gemspec +25 -0
  5. data/ext/cast_off/cast_off.c.rb +1386 -0
  6. data/ext/cast_off/cast_off.h +24 -0
  7. data/ext/cast_off/depend +70 -0
  8. data/ext/cast_off/extconf.rb +19 -0
  9. data/ext/cast_off/generated_c_include/inline_api.h +507 -0
  10. data/ext/cast_off/generated_c_include/iter_api.h +595 -0
  11. data/ext/cast_off/generated_c_include/unbox_api.h.rb +76 -0
  12. data/ext/cast_off/generated_c_include/vm_api.h +751 -0
  13. data/ext/cast_off/ruby_source/atomic.h +56 -0
  14. data/ext/cast_off/ruby_source/constant.h +34 -0
  15. data/ext/cast_off/ruby_source/debug.h +41 -0
  16. data/ext/cast_off/ruby_source/eval_intern.h +234 -0
  17. data/ext/cast_off/ruby_source/gc.h +98 -0
  18. data/ext/cast_off/ruby_source/id.h +175 -0
  19. data/ext/cast_off/ruby_source/insns.inc +179 -0
  20. data/ext/cast_off/ruby_source/insns_info.inc +695 -0
  21. data/ext/cast_off/ruby_source/internal.h +227 -0
  22. data/ext/cast_off/ruby_source/iseq.h +125 -0
  23. data/ext/cast_off/ruby_source/manual_update.h +135 -0
  24. data/ext/cast_off/ruby_source/method.h +105 -0
  25. data/ext/cast_off/ruby_source/node.h +503 -0
  26. data/ext/cast_off/ruby_source/thread_pthread.h +51 -0
  27. data/ext/cast_off/ruby_source/thread_win32.h +40 -0
  28. data/ext/cast_off/ruby_source/vm_core.h +756 -0
  29. data/ext/cast_off/ruby_source/vm_exec.h +184 -0
  30. data/ext/cast_off/ruby_source/vm_insnhelper.c +1748 -0
  31. data/ext/cast_off/ruby_source/vm_insnhelper.h +220 -0
  32. data/ext/cast_off/ruby_source/vm_opts.h +51 -0
  33. data/lib/cast_off.rb +15 -0
  34. data/lib/cast_off/compile.rb +629 -0
  35. data/lib/cast_off/compile/basicblock.rb +144 -0
  36. data/lib/cast_off/compile/cfg.rb +391 -0
  37. data/lib/cast_off/compile/code_manager.rb +284 -0
  38. data/lib/cast_off/compile/configuration.rb +2368 -0
  39. data/lib/cast_off/compile/dependency.rb +240 -0
  40. data/lib/cast_off/compile/information.rb +775 -0
  41. data/lib/cast_off/compile/instruction.rb +446 -0
  42. data/lib/cast_off/compile/ir/call_ir.rb +2348 -0
  43. data/lib/cast_off/compile/ir/guard_ir.rb +423 -0
  44. data/lib/cast_off/compile/ir/jump_ir.rb +223 -0
  45. data/lib/cast_off/compile/ir/operand.rb +934 -0
  46. data/lib/cast_off/compile/ir/param_ir.rb +98 -0
  47. data/lib/cast_off/compile/ir/return_ir.rb +92 -0
  48. data/lib/cast_off/compile/ir/simple_ir.rb +808 -0
  49. data/lib/cast_off/compile/ir/sub_ir.rb +212 -0
  50. data/lib/cast_off/compile/iseq.rb +454 -0
  51. data/lib/cast_off/compile/method_information.rb +1384 -0
  52. data/lib/cast_off/compile/namespace/namespace.rb +556 -0
  53. data/lib/cast_off/compile/namespace/uuid.rb +323 -0
  54. data/lib/cast_off/compile/stack.rb +65 -0
  55. data/lib/cast_off/compile/translator.rb +1562 -0
  56. data/lib/cast_off/suggestion.rb +98 -0
  57. data/lib/cast_off/util.rb +58 -0
  58. metadata +107 -0
@@ -0,0 +1,284 @@
1
+ # coding=utf-8
2
+
3
+ require 'rbconfig'
4
+ require 'fileutils'
5
+
6
+ module CastOff
7
+ module Compiler
8
+ class CodeManager
9
+ include RbConfig
10
+ include CastOff::Util
11
+ extend CastOff::Util
12
+
13
+ attr_reader :signiture, :compilation_target
14
+
15
+ CastOffDir = "#{ENV["HOME"]}/.CastOff"
16
+ FileUtils.mkdir(CastOffDir) unless File.exist?(CastOffDir)
17
+
18
+ @@program_name = File.expand_path($PROGRAM_NAME)
19
+ CastOff::Compiler.class_eval do
20
+ def program_name=(dir)
21
+ CastOff::Compiler::CodeManager.class_variable_set(:@@program_name, dir)
22
+ end
23
+ end
24
+
25
+ def self.program_dir()
26
+ dir = "#{CastOffDir}/#{@@program_name.gsub(/\.|\/|-|:/, "_")}"
27
+ FileUtils.mkdir(dir) unless File.exist?(dir)
28
+ dir
29
+ end
30
+
31
+ def self.clear()
32
+ dir = program_dir()
33
+ vlog("delete #{dir}")
34
+ FileUtils.remove_entry_secure(dir)
35
+ dir
36
+ end
37
+
38
+ def self.load_autocompiled()
39
+ begin
40
+ dir = program_dir()
41
+ path = "#{dir}/auto_compiled.dump"
42
+ return nil unless File.exist?(path)
43
+ str = File.open(path, 'rb:us-ascii').read()
44
+ str.untaint # FIXME
45
+ Marshal.load(str)
46
+ rescue ArgumentError, NameError
47
+ false
48
+ end
49
+ end
50
+
51
+ def self.dump_auto_compiled(compiled)
52
+ dir = program_dir()
53
+ path = "#{dir}/auto_compiled.dump"
54
+ File.open("#{path}", 'wb:us-ascii') do |f|
55
+ Marshal.dump(compiled, f)
56
+ end
57
+ load_autocompiled()
58
+ end
59
+
60
+ def create_dstdir()
61
+ FileUtils.mkdir(@dstdir) unless File.exist?(@dstdir)
62
+ FileUtils.touch(@lockpath) unless File.exist?(@lockpath)
63
+ end
64
+
65
+ def version_up()
66
+ bug() unless File.exist?(@versionpath)
67
+ v = File.read(@versionpath).to_i
68
+ bug() if v < 0
69
+ v = [@version, v].max + 1
70
+ vlog("version: #{@version} => #{v}")
71
+ File.open(@versionpath, 'w'){|f| f.write(v)}
72
+ end
73
+
74
+ def fetch_version()
75
+ bug() unless File.exist?(@dstdir)
76
+ if File.exist?(@versionpath)
77
+ version = File.read(@versionpath)
78
+ else
79
+ version = 0
80
+ end
81
+ version.to_i
82
+ end
83
+
84
+ def initialize(filepath, line_no)
85
+ @filepath = filepath
86
+ @line_no = line_no
87
+ base_sign = "#{@filepath}_#{@line_no}".gsub(/\.|\/|-|:/, "_")
88
+ dir = self.class.program_dir()
89
+ @dstdir = "#{dir}/#{base_sign}"
90
+ @lockpath = "#{@dstdir}/lock"
91
+ @versionfile = "version"
92
+ @versionpath = "#{@dstdir}/#{@versionfile}"
93
+ create_dstdir()
94
+ @version = fetch_version()
95
+ @signiture = "#{base_sign}_ver#{@version}"
96
+ @dstfile = "#{@signiture}.c"
97
+ @depfile = "#{@signiture}.mdep"
98
+ @deppath = "#{@dstdir}/#{@depfile}"
99
+ @conffile = "#{@signiture}.conf"
100
+ @base_configuration_path = "#{@dstdir}/#{@signiture}.base.conf"
101
+ @annotation_path = "#{@dstdir}/#{@signiture}.ann"
102
+ @development_mark_file = "development"
103
+ @development_mark_path = "#{@dstdir}/#{@development_mark_file}"
104
+ @dstbin = "#{@dstdir}/#{@signiture}.so"
105
+ @compilation_target = nil
106
+ end
107
+
108
+ class CompilationTarget
109
+ include CastOff::Util
110
+
111
+ attr_reader :target_object, :method_id
112
+
113
+ def initialize(target, mid, singleton)
114
+ @target_object = target
115
+ @method_id = mid
116
+ @singleton_p = singleton
117
+ bug() unless @method_id.is_a?(Symbol)
118
+ bug() unless @singleton_p == true || @singleton_p == false
119
+ end
120
+
121
+ def singleton_method?
122
+ @singleton_p
123
+ end
124
+ end
125
+
126
+ def compilation_target_is_a(target, mid, singleton)
127
+ @compilation_target = CompilationTarget.new(target, mid, singleton)
128
+ end
129
+
130
+ def do_atomically()
131
+ bug() unless block_given?
132
+ File.open(@lockpath, "w") do |f|
133
+ f.flock(File::LOCK_EX)
134
+ yield
135
+ end
136
+ end
137
+
138
+ def target_file_updated?
139
+ not (File.exist?(@dstbin) && File.mtime(@filepath).tv_sec < File.mtime(@dstbin).tv_sec)
140
+ end
141
+
142
+ def compiled_binary()
143
+ @dstbin
144
+ end
145
+
146
+ def remove_binary_if_raised(&b)
147
+ begin
148
+ b.call()
149
+ rescue => e
150
+ FileUtils.remove_entry_secure(@dstbin) if File.exist?(@dstbin)
151
+ raise(e)
152
+ end
153
+ end
154
+
155
+ def compile_c_source(c_source, conf, dep)
156
+ base = load_base_configuration()
157
+ FileUtils.remove_entry_secure(@dstdir, true)
158
+ create_dstdir()
159
+ File.open("#{@dstdir}/#{@dstfile}", 'w'){|f| f.write(c_source)}
160
+ gen_makefile(@dstdir, @dstfile)
161
+ gen_header_files(@dstdir)
162
+ Dir.chdir(@dstdir) do
163
+ File.open(@dstfile, 'wb:us-ascii') do |f|
164
+ f.write(c_source.dup.force_encoding('US-ASCII'))
165
+ end
166
+ if CONFIG["host_os"].match(/mswin/)
167
+ # windows
168
+ makecmd = 'nmake'
169
+ else
170
+ # linux, freebsd, solaris
171
+ makecmd = 'make'
172
+ end
173
+ log = `#{makecmd} 2>&1`
174
+ if $? != 0
175
+ dlog(c_source)
176
+ dlog(log)
177
+ bug("failed to compile c source: status = (#{$?})")
178
+ else
179
+ dlog(c_source, 2)
180
+ dlog(log, 2)
181
+ end
182
+ remove_binary_if_raised do
183
+ File.open(@conffile, 'wb:us-ascii') do |f|
184
+ bug() unless conf
185
+ conf.dump(f)
186
+ end
187
+ File.open(@depfile, 'wb:us-ascii') do |f|
188
+ bug() unless dep.instance_of?(Dependency)
189
+ dep.dump(f)
190
+ end
191
+ end
192
+ bug() unless @version.is_a?(Integer)
193
+ File.open(@versionfile, 'w'){|f| f.write(@version)}
194
+ save_base_configuration(base) if base
195
+ end
196
+ end
197
+
198
+ def last_configuration_enabled_development?
199
+ File.exist?(@development_mark_path)
200
+ end
201
+
202
+ def dump_development_mark(conf)
203
+ bug() unless conf
204
+ FileUtils.touch(@development_mark_path) if conf.development?
205
+ end
206
+
207
+ def save_base_configuration(conf)
208
+ begin
209
+ File.open(@base_configuration_path, 'wb:us-ascii') do |f|
210
+ bug() unless conf.instance_of?(Configuration)
211
+ conf.dump(f)
212
+ end
213
+ rescue => e
214
+ vlog("failed to update base configuration: #{e}")
215
+ end
216
+ end
217
+
218
+ def clear_base_configuration()
219
+ return unless File.exist?(@base_configuration_path)
220
+ FileUtils.remove_entry_secure(@base_configuration_path)
221
+ end
222
+
223
+ def load_base_configuration()
224
+ return nil unless File.exist?(@base_configuration_path)
225
+ conf_str = File.open(@base_configuration_path, 'rb:us-ascii').read()
226
+ Configuration.load(conf_str)
227
+ end
228
+
229
+ def load_last_configuration()
230
+ return nil unless File.exist?("#{@dstdir}/#{@conffile}")
231
+ exist_conf_str = File.open("#{@dstdir}/#{@conffile}", 'rb:us-ascii').read()
232
+ # exist_conf_str が tainted であるため、Marshal.load で読み込んだ class も tainted になってしまう
233
+ # RDoc だと、それのせいで Insecure: can't modify array となる
234
+ #exist_conf_str.untaint
235
+ Configuration.load(exist_conf_str)
236
+ end
237
+
238
+ def save_annotation(ann)
239
+ bug() unless ann.is_a?(Hash)
240
+ remove_binary_if_raised do
241
+ File.open("#{@annotation_path}", 'wb:us-ascii'){|f| Marshal.dump(ann, f)}
242
+ end
243
+ end
244
+
245
+ def load_annotation()
246
+ return nil unless File.exist?(@annotation_path)
247
+ ann_str = File.open(@annotation_path, 'rb:us-ascii').read()
248
+ ann_str.untaint
249
+ Marshal.load(ann_str)
250
+ end
251
+
252
+ def load_dependency()
253
+ raise(LoadError.new("method dependency file is not exist")) unless File.exist?(@deppath)
254
+ str = File.open(@deppath, 'rb:us-ascii').read()
255
+ str.untaint # FIXME
256
+ Dependency.load(str)
257
+ end
258
+
259
+ def gen_makefile(dir, file)
260
+ Dir.chdir(dir) do
261
+ File.open('extconf.rb', 'wb:us-ascii') do |f|
262
+ f.write <<-EOS
263
+ require 'mkmf'
264
+ create_makefile("#{File.basename(file, ".c")}")
265
+ EOS
266
+ end
267
+ runruby = CONFIG["prefix"] + "/bin/" + CONFIG["ruby_install_name"]
268
+ dlog(`#{runruby} extconf.rb`, 2)
269
+ bug("failed to generate extconf.rb: status = (#{$?})") if $? != 0
270
+ end
271
+ end
272
+
273
+ def gen_header_files(dir)
274
+ Dir.chdir(dir) do
275
+ Headers.each_pair do |k, v|
276
+ File.open(k, 'wb:binary'){|f| f.write(v)}
277
+ FileUtils.touch("insns.inc")
278
+ end
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
284
+
@@ -0,0 +1,2368 @@
1
+ # coding=utf-8
2
+
3
+ module CastOff
4
+ module Compiler
5
+
6
+ class SingletonClass
7
+ def self.to_s
8
+ "<< SINGLETON CLASS >>"
9
+ end
10
+ end
11
+
12
+ class Configuration
13
+ include CastOff::Util
14
+ extend CastOff::Util
15
+
16
+ class InvalidConfigurationError < StandardError; end
17
+
18
+ attr_reader :return_value_configuration
19
+ attr_reader :variable_configuration
20
+ attr_reader :method_information_usage
21
+ attr_reader :option_table_configuration
22
+ attr_reader :bind
23
+
24
+ class BindingWrapper
25
+ include CastOff::Util
26
+
27
+ attr_reader :bind, :nest
28
+
29
+ def initialize(bind)
30
+ bug() unless bind.instance_of?(Binding)
31
+ @bind = bind
32
+ nest = eval("Module.nesting", @bind)
33
+ pre = ""
34
+ @nest = nest.reverse.map{|n|
35
+ n = n.to_s
36
+ if n[pre]
37
+ replen = pre.length
38
+ replen += 2 unless pre.empty?
39
+ pre = n
40
+ n.slice(replen, n.length - replen)
41
+ else
42
+ n
43
+ end
44
+ }
45
+ begin
46
+ marshal_load(@nest) # validation
47
+ rescue NameError => e
48
+ raise(UnsupportedError.new(<<-EOS))
49
+
50
+ Failed to construct binding from Module.nesting result (#{nest}).
51
+ Currently, CastOff doesn't support binding which cannot construct from Module.nesting result.
52
+ CastOff constructs binding with the following process.
53
+
54
+ --- binding construction process ---
55
+ o = Object
56
+ #{@nest.map{|n| "o = o.const_get(:#{n})" }.join("\n")}
57
+
58
+ --- error message ---
59
+ #{e.message}
60
+ EOS
61
+ rescue => e
62
+ bug("e = #{e}, @nest = #{@nest}, nest = #{nest}")
63
+ end
64
+ end
65
+
66
+ def marshal_dump()
67
+ @nest
68
+ end
69
+
70
+ def marshal_load(nest)
71
+ o = Object
72
+ ary = []
73
+ nest.each do |n|
74
+ n.split("::").each do |__n|
75
+ o = o.const_get(__n)
76
+ end
77
+ ary << [n, o]
78
+ end
79
+ s0 = []
80
+ s1 = []
81
+ ary.each_with_index do |no, idx|
82
+ n, o = no
83
+ case o
84
+ when Class
85
+ decl = "class"
86
+ when Module
87
+ decl = "module"
88
+ else
89
+ bug("obj = #{o}")
90
+ end
91
+ indent = " " * idx
92
+ s0 << indent + "#{decl} #{n}"
93
+ s1 << indent + "end"
94
+ end
95
+ indent = " " * ary.size
96
+ eval_str = s0.join("\n") + "\n#{indent}binding\n" + s1.reverse.join("\n")
97
+ bind = eval(eval_str, TOPLEVEL_BINDING)
98
+ bug() unless bind.instance_of?(Binding)
99
+ @bind = bind
100
+ @nest = nest
101
+ end
102
+
103
+ def eql?(other)
104
+ return false unless other.instance_of?(BindingWrapper)
105
+ @nest == other.nest
106
+ end
107
+
108
+ def ==(other)
109
+ eql?(other)
110
+ end
111
+
112
+ def hash()
113
+ bug()
114
+ end
115
+ end
116
+
117
+ def initialize(configuration, bind)
118
+ @bind = bind ? BindingWrapper.new(bind) : nil
119
+ @return_value_configuration = {}
120
+ @variable_configuration = {}
121
+ case configuration
122
+ when Hash
123
+ configuration.each do |(k, v)|
124
+ case k
125
+ when Array
126
+ k.each do |var|
127
+ invalid_configuration() unless var.is_a?(Symbol)
128
+ case v
129
+ when Class
130
+ # [:var0, :var1, ...] => class
131
+ a = @variable_configuration[var] || []
132
+ a |= [ClassWrapper.new(v, true)]
133
+ @variable_configuration[var] = a
134
+ when Array
135
+ # [:var0, :var1, ...] => [class0, class1, ...]
136
+ v.each {|t| invalid_configuration() unless t.is_a?(Class)}
137
+ a = @variable_configuration[var] || []
138
+ a |= v.map{|t| ClassWrapper.new(t, true)}
139
+ @variable_configuration[var] = a
140
+ else
141
+ invalid_configuration()
142
+ end
143
+ end
144
+ when Symbol
145
+ case v
146
+ when Class
147
+ # :var => class
148
+ a = @variable_configuration[k] || []
149
+ a |= [ClassWrapper.new(v, true)]
150
+ @variable_configuration[k] = a
151
+ when Array
152
+ # :var => [class0, class1, ...]
153
+ v.each {|t| invalid_configuration() unless t.is_a?(Class)}
154
+ a = @variable_configuration[k] || []
155
+ a |= v.map{|t| ClassWrapper.new(t, true)}
156
+ @variable_configuration[k] = a
157
+ else
158
+ invalid_configuration("variable class should be specified by Class or Array")
159
+ end
160
+ when Class
161
+ # class => {:method_name => class, ...}
162
+ case v
163
+ when Hash
164
+ k = ClassWrapper.new(k, true)
165
+ h = @return_value_configuration[k] || {}
166
+ v.each do |(id, type)|
167
+ invalid_configuration() unless id.is_a?(Symbol)
168
+ case type
169
+ when Class
170
+ a = h[id] || []
171
+ a |= [ClassWrapper.new(type, true)]
172
+ h[id] = a
173
+ when Array
174
+ type.each {|t| invalid_configuration() unless t.is_a?(Class) }
175
+ a = h[id] || []
176
+ a |= type.map{|t| ClassWrapper.new(t, true)}
177
+ h[id] = a
178
+ else
179
+ invalid_configuration()
180
+ end
181
+ end
182
+ @return_value_configuration[k] = h
183
+ else
184
+ invalid_configuration()
185
+ end
186
+ end
187
+ end
188
+ else
189
+ invalid_configuration()
190
+ end
191
+ @return_value_configuration.each do |(k, v)|
192
+ bug() unless k.is_a?(ClassWrapper)
193
+ v.each do |(mid, ary)|
194
+ ary.each{|t| bug(t) unless t.is_a?(ClassWrapper)}
195
+ end
196
+ end
197
+ @variable_configuration.values.each do |ary|
198
+ ary.each{|t| bug(t) unless t.is_a?(ClassWrapper)}
199
+ end
200
+ @method_information_usage = []
201
+ @option_table_configuration = {}
202
+ @use_method_frame = false
203
+ OPTION_TABLE.each{|(cvar, val)| @option_table_configuration[cvar] = self.class.class_variable_get(cvar)}
204
+ end
205
+
206
+ def use_method_frame(bool)
207
+ @use_method_frame = !!bool
208
+ end
209
+
210
+ def use_method_frame?
211
+ @use_method_frame
212
+ end
213
+
214
+ def class_of_variable(var)
215
+ bug() unless var.is_a?(Symbol)
216
+ @variable_configuration[var]
217
+ end
218
+
219
+ def return_value_class(c, m)
220
+ bug() unless c.is_a?(ClassWrapper)
221
+ bug() unless m.is_a?(Symbol)
222
+ h = @return_value_configuration[c]
223
+ h ? h[m] : nil
224
+ end
225
+
226
+ def has_binding?
227
+ !!@bind
228
+ end
229
+
230
+ def evaluate_by_passed_binding(str)
231
+ bug() unless @bind.instance_of?(BindingWrapper)
232
+ bug() unless @bind.bind.instance_of?(Binding)
233
+ begin
234
+ eval(str, @bind.bind)
235
+ rescue
236
+ raise(CastOff::CompileError.new("Failed to evaluate < #{str} > with passed binding"))
237
+ end
238
+ end
239
+
240
+ def union(conf)
241
+ bug() unless conf.instance_of?(Configuration)
242
+ conf.variable_configuration.each do |(sym, src)|
243
+ bug() unless src.instance_of?(Array)
244
+ dst = (@variable_configuration[sym] ||= [])
245
+ (src + dst).each do |cw|
246
+ bug() unless cw.instance_of?(ClassWrapper)
247
+ bug() if cw.singleton?
248
+ bug() if cw.contain_class == SingletonClass
249
+ end
250
+ @variable_configuration[sym] = (dst | src)
251
+ end
252
+
253
+ conf.return_value_configuration.each do |(cw0, src0)|
254
+ bug() unless src0.instance_of?(Hash)
255
+ bug() unless cw0.instance_of?(ClassWrapper)
256
+ bug() if cw0.singleton?
257
+ bug() if cw0.contain_class == SingletonClass
258
+ dst0 = (@return_value_configuration[cw0] ||= {})
259
+ src0.each do |(sym, src1)|
260
+ bug() unless src1.instance_of?(Array)
261
+ dst1 = (dst0[sym] ||= [])
262
+ (src1 + dst1).each do |cw1|
263
+ bug() unless cw1.instance_of?(ClassWrapper)
264
+ bug() if cw1.singleton?
265
+ bug() if cw1.contain_class == SingletonClass
266
+ end
267
+ dst0[sym] = (dst1 | src1)
268
+ end
269
+ end
270
+ return if @bind
271
+ return unless conf.bind
272
+ bug() unless conf.bind.instance_of?(BindingWrapper)
273
+ @bind = conf.bind
274
+ end
275
+
276
+ def update_variable_configuration(update_hash)
277
+ update_p = false
278
+ update_hash.each do |(k, v)|
279
+ bug() unless k.instance_of?(Symbol)
280
+ bug() unless v.instance_of?(Array)
281
+ next if v.include?(SingletonClass)
282
+ # variable annotation
283
+ a0 = v
284
+ a0 = a0.map{|c|
285
+ bug(c) unless c.is_a?(Class)
286
+ bug() unless c != SingletonClass
287
+ ClassWrapper.new(c, true)
288
+ }
289
+ a1 = @variable_configuration[k] || []
290
+ update_p = true unless (a0 - a1).empty?
291
+ a1 |= a0
292
+ @variable_configuration[k] = a1
293
+ end
294
+ update_p
295
+ end
296
+
297
+ def update_return_value_configuration(update_hash)
298
+ update_p = false
299
+ update_hash.each do |(k, v)|
300
+ bug() unless k.instance_of?(Class)
301
+ bug() unless v.instance_of?(Hash)
302
+ next if k == SingletonClass
303
+ # return value annotation
304
+ h0 = v
305
+ k = ClassWrapper.new(k, true)
306
+ h1 = @return_value_configuration[k] || {}
307
+ h0.each do |(mid, klasses0)|
308
+ next if klasses0.include?(SingletonClass)
309
+ klasses0 = klasses0.map{|c|
310
+ bug(c) unless c.is_a?(Class)
311
+ bug() unless c != SingletonClass
312
+ ClassWrapper.new(c, true)
313
+ }
314
+ klasses1 = h1[mid] || []
315
+ update_p = true unless (klasses0 - klasses1).empty?
316
+ klasses1 |= klasses0
317
+ h1[mid] = klasses1
318
+ end
319
+ @return_value_configuration[k] = h1
320
+ end
321
+ update_p
322
+ end
323
+
324
+ def compact()
325
+ rejects0 = []
326
+ @return_value_configuration.each do |(k0, v0)|
327
+ rejects1 = []
328
+ v0.each{|(k1, v1)| rejects1 << k1 if v1.size > 5}
329
+ rejects1.each{|v| v0.delete(v)}
330
+ rejects0 << k0 if v0.empty?
331
+ end
332
+ rejects0.each{|v| @return_value_configuration.delete(v)}
333
+ rejects0 = []
334
+ @variable_configuration.each do |(k0, v0)|
335
+ rejects0 << k0 if v0.size > 5
336
+ end
337
+ rejects0.each{|v| @variable_configuration.delete(v)}
338
+ end
339
+
340
+ def validate()
341
+ begin
342
+ dump()
343
+ rescue TypeError => e
344
+ raise(UnsupportedError.new(<<-EOS))
345
+
346
+ Failed to marshal dump configuration.
347
+ Configuration object should be able to marshal dump.
348
+ Currently, CastOff doesn't support object, which cannot marshal dump (e.g. STDIN).
349
+ --- Marshal.dump error message ---
350
+ #{e.message}
351
+ EOS
352
+ end
353
+ end
354
+
355
+ def dump(io = nil)
356
+ if io
357
+ Marshal.dump(self, io)
358
+ else
359
+ Marshal.dump(self)
360
+ end
361
+ end
362
+
363
+ def self.load(io)
364
+ conf = Marshal.load(io)
365
+ bug() unless conf.instance_of?(Configuration)
366
+ return nil unless conf.check_method_information_usage()
367
+ conf
368
+ end
369
+
370
+ def eql?(other)
371
+ return false if other.nil?
372
+ bug() unless other.is_a?(Configuration)
373
+ return false unless @variable_configuration == other.variable_configuration
374
+ return false unless @return_value_configuration == other.return_value_configuration
375
+ return false unless same_option?(other.option_table_configuration)
376
+ return false unless @bind == other.bind
377
+ true
378
+ end
379
+
380
+ def ==(other)
381
+ eql?(other)
382
+ end
383
+
384
+ def to_s
385
+ ary = []
386
+ @variable_configuration.each do |(k, v)|
387
+ bug() unless k.instance_of?(Symbol)
388
+ ary << "#{k.inspect} => #{v.inspect}"
389
+ end
390
+ @return_value_configuration.each do |(k, v)|
391
+ bug() unless k.instance_of?(ClassWrapper)
392
+ ary << "#{k.inspect} => #{inspect_method_return_value(v)}"
393
+ end
394
+ "{#{ary.join(",\n ")}}"
395
+ end
396
+
397
+ def inspect_method_return_value(h)
398
+ bug() unless h.instance_of?(Hash)
399
+ '{' + h.map{|(mid, classes)|
400
+ bug() unless mid.instance_of?(Symbol)
401
+ bug() unless classes.instance_of?(Array)
402
+ "#{mid.inspect} => #{classes.inspect}"
403
+ }.join(', ') + '}'
404
+ end
405
+
406
+ DIRECT_CALL_TARGETS = [
407
+ [BasicObject, :initialize, :class],
408
+ [BasicObject, :==, :class],
409
+ [BasicObject, :equal?, :class],
410
+ [BasicObject, :!, :class],
411
+ [BasicObject, :!=, :class],
412
+ [BasicObject, :singleton_method_added, :class],
413
+ [BasicObject, :singleton_method_removed, :class],
414
+ [BasicObject, :singleton_method_undefined, :class],
415
+ [Class, :inherited, :class],
416
+ [Module, :included, :class],
417
+ [Module, :extended, :class],
418
+ [Module, :method_added, :class],
419
+ [Module, :method_removed, :class],
420
+ [Module, :method_undefined, :class],
421
+ [Kernel, :nil?, :module],
422
+ [Kernel, :===, :module],
423
+ [Kernel, :=~, :module],
424
+ [Kernel, :!~, :module],
425
+ [Kernel, :eql?, :module],
426
+ [Kernel, :hash, :module],
427
+ [Kernel, :<=>, :module],
428
+ [Kernel, :class, :module],
429
+ [Kernel, :singleton_class, :module],
430
+ [Kernel, :clone, :module],
431
+ [Kernel, :dup, :module],
432
+ [Kernel, :initialize_copy, :module],
433
+ [Kernel, :initialize_dup, :module],
434
+ [Kernel, :initialize_clone, :module],
435
+ [Kernel, :taint, :module],
436
+ [Kernel, :tainted?, :module],
437
+ [Kernel, :untaint, :module],
438
+ [Kernel, :untrust, :module],
439
+ [Kernel, :untrusted?, :module],
440
+ [Kernel, :trust, :module],
441
+ [Kernel, :freeze, :module],
442
+ [Kernel, :frozen?, :module],
443
+ [Kernel, :to_s, :module],
444
+ #[Kernel, :inspect, :module], #rb_exec_recursive => recursive_list_access
445
+ [Kernel, :methods, :module],
446
+ [Kernel, :singleton_methods, :module],
447
+ [Kernel, :protected_methods, :module],
448
+ [Kernel, :private_methods, :module],
449
+ [Kernel, :public_methods, :module],
450
+ [Kernel, :instance_variables, :module],
451
+ [Kernel, :instance_variable_get, :module],
452
+ [Kernel, :instance_variable_set, :module],
453
+ [Kernel, :instance_variable_defined?, :module],
454
+ [Kernel, :remove_instance_variable, :module],
455
+ [Kernel, :instance_of?, :module],
456
+ [Kernel, :kind_of?, :module],
457
+ [Kernel, :is_a?, :module],
458
+ [Kernel, :tap, :module],
459
+ [Kernel, :sprintf, :module],
460
+ [Kernel, :sprintf, :singleton],
461
+ [Kernel, :format, :module],
462
+ [Kernel, :format, :singleton],
463
+ [Kernel, :Integer, :module],
464
+ [Kernel, :Integer, :singleton],
465
+ [Kernel, :Float, :module],
466
+ [Kernel, :Float, :singleton],
467
+ [Kernel, :String, :module],
468
+ [Kernel, :String, :singleton],
469
+ [Kernel, :Array, :module],
470
+ [Kernel, :Array, :singleton],
471
+ [NilClass, :to_i, :class],
472
+ [NilClass, :to_f, :class],
473
+ [NilClass, :to_s, :class],
474
+ [NilClass, :to_a, :class],
475
+ [NilClass, :inspect, :class],
476
+ [NilClass, :&, :class],
477
+ [NilClass, :|, :class],
478
+ [NilClass, :^, :class],
479
+ [NilClass, :nil?, :class],
480
+ [Module, :freeze, :class],
481
+ [Module, :===, :class],
482
+ [Module, :==, :class],
483
+ [Module, :<=>, :class],
484
+ [Module, :<, :class],
485
+ [Module, :<=, :class],
486
+ [Module, :>, :class],
487
+ [Module, :>=, :class],
488
+ [Module, :initialize_copy, :class],
489
+ [Module, :to_s, :class],
490
+ [Module, :included_modules, :class],
491
+ [Module, :include?, :class],
492
+ [Module, :name, :class],
493
+ [Module, :ancestors, :class],
494
+ [Module, :attr, :class],
495
+ [Module, :attr_reader, :class],
496
+ [Module, :attr_writer, :class],
497
+ [Module, :attr_accessor, :class],
498
+ #[Module, :initialize, :class], #rb_mod_initialize => rb_block_given_p
499
+ [Module, :instance_methods, :class],
500
+ [Module, :public_instance_methods, :class],
501
+ [Module, :protected_instance_methods, :class],
502
+ [Module, :private_instance_methods, :class],
503
+ [Module, :constants, :class],
504
+ [Module, :const_get, :class],
505
+ [Module, :const_set, :class],
506
+ [Module, :const_defined?, :class],
507
+ [Module, :remove_const, :class],
508
+ [Module, :const_missing, :class],
509
+ [Module, :class_variables, :class],
510
+ [Module, :remove_class_variable, :class],
511
+ [Module, :class_variable_get, :class],
512
+ [Module, :class_variable_set, :class],
513
+ [Module, :class_variable_defined?, :class],
514
+ [Module, :public_constant, :class],
515
+ [Module, :private_constant, :class],
516
+ [Class, :allocate, :class],
517
+ [Class, :new, :class],
518
+ #[Class, :initialize, :class], #rb_class_initialize => rb_mod_initialize => rb_block_given_p
519
+ [Class, :initialize_copy, :class],
520
+ [Class, :superclass, :class],
521
+ [TrueClass, :to_s, :class],
522
+ [TrueClass, :&, :class],
523
+ [TrueClass, :|, :class],
524
+ [TrueClass, :^, :class],
525
+ [FalseClass, :to_s, :class],
526
+ [FalseClass, :&, :class],
527
+ [FalseClass, :|, :class],
528
+ [FalseClass, :^, :class],
529
+ [Encoding, :to_s, :class],
530
+ [Encoding, :inspect, :class],
531
+ [Encoding, :name, :class],
532
+ [Encoding, :names, :class],
533
+ [Encoding, :dummy?, :class],
534
+ [Encoding, :ascii_compatible?, :class],
535
+ [Encoding, :replicate, :class],
536
+ [Encoding, :list, :singleton],
537
+ [Encoding, :name_list, :singleton],
538
+ [Encoding, :aliases, :singleton],
539
+ [Encoding, :find, :singleton],
540
+ [Encoding, :compatible?, :singleton],
541
+ [Encoding, :_dump, :class],
542
+ [Encoding, :_load, :singleton],
543
+ [Encoding, :default_external, :singleton],
544
+ [Encoding, :default_external=, :singleton],
545
+ [Encoding, :default_internal, :singleton],
546
+ [Encoding, :default_internal=, :singleton],
547
+ [Encoding, :locale_charmap, :singleton],
548
+ [Comparable, :==, :module],
549
+ [Comparable, :>, :module],
550
+ [Comparable, :>=, :module],
551
+ [Comparable, :<, :module],
552
+ [Comparable, :<=, :module],
553
+ [Comparable, :between?, :module],
554
+ [Enumerable, :to_a, :module],
555
+ [Enumerable, :entries, :module],
556
+ [Enumerable, :sort, :module],
557
+ #[Enumerable, :sort_by, :module], #enum_sort_by
558
+ #[Enumerable, :grep, :module], #enum_grep => rb_block_given_p
559
+ #[Enumerable, :count, :module], #enum_count => rb_block_given_p
560
+ #[Enumerable, :find, :module], #enum_find
561
+ #[Enumerable, :detect, :module], #enum_find
562
+ #[Enumerable, :find_index, :module], #enum_find_index => rb_block_given_p
563
+ #[Enumerable, :find_all, :module], #enum_find_all
564
+ #[Enumerable, :select, :module], #enum_find_all
565
+ #[Enumerable, :reject, :module], #enum_reject
566
+ #[Enumerable, :collect, :module], #enum_collect
567
+ #[Enumerable, :map, :module], #enum_collect
568
+ #[Enumerable, :flat_map, :module], #enum_flat_map
569
+ #[Enumerable, :collect_concat, :module], #enum_flat_map
570
+ #[Enumerable, :inject, :module], #enum_inject => rb_block_given_p
571
+ #[Enumerable, :reduce, :module], #enum_inject => rb_block_given_p
572
+ #[Enumerable, :partition, :module], #enum_partition
573
+ #[Enumerable, :group_by, :module], #enum_group_by
574
+ [Enumerable, :first, :module],
575
+ [Enumerable, :all?, :module],
576
+ [Enumerable, :any?, :module],
577
+ [Enumerable, :one?, :module],
578
+ [Enumerable, :none?, :module],
579
+ #[Enumerable, :min, :module], #enum_min => rb_block_given_p
580
+ #[Enumerable, :max, :module], #enum_max => rb_block_given_p
581
+ #[Enumerable, :minmax, :module], #enum_minmax => rb_block_given_p
582
+ #[Enumerable, :min_by, :module], #enum_min_by
583
+ #[Enumerable, :max_by, :module], #enum_max_by
584
+ #[Enumerable, :minmax_by, :module], #enum_minmax_by
585
+ [Enumerable, :member?, :module],
586
+ [Enumerable, :include?, :module],
587
+ #[Enumerable, :each_with_index, :module], #enum_each_with_index
588
+ #[Enumerable, :reverse_each, :module], #enum_reverse_each
589
+ #[Enumerable, :each_entry, :module], #enum_each_entry
590
+ #[Enumerable, :each_slice, :module], #enum_each_slice
591
+ #[Enumerable, :each_cons, :module], #enum_each_cons
592
+ #[Enumerable, :each_with_object, :module], #enum_each_with_object
593
+ #[Enumerable, :zip, :module], #enum_zip => rb_block_given_p
594
+ [Enumerable, :take, :module],
595
+ #[Enumerable, :take_while, :module], #enum_take_while
596
+ [Enumerable, :drop, :module],
597
+ #[Enumerable, :drop_while, :module], #enum_drop_while
598
+ #[Enumerable, :cycle, :module], #enum_cycle
599
+ #[Enumerable, :chunk, :module], #enum_chunk => rb_block_given_p
600
+ #[Enumerable, :slice_before, :module], #enum_slice_before => rb_block_given_p
601
+ [String, :try_convert, :singleton],
602
+ [String, :initialize, :class],
603
+ [String, :initialize_copy, :class],
604
+ [String, :<=>, :class],
605
+ [String, :==, :class],
606
+ [String, :===, :class],
607
+ [String, :eql?, :class],
608
+ [String, :hash, :class],
609
+ [String, :casecmp, :class],
610
+ [String, :+, :class],
611
+ [String, :*, :class],
612
+ [String, :%, :class],
613
+ [String, :[], :class],
614
+ [String, :[]=, :class],
615
+ [String, :insert, :class],
616
+ [String, :length, :class],
617
+ [String, :size, :class],
618
+ [String, :bytesize, :class],
619
+ [String, :empty?, :class],
620
+ [String, :=~, :class],
621
+ #[String, :match, :class], #rb_str_match_m => rb_block_given_p
622
+ [String, :succ, :class],
623
+ [String, :succ!, :class],
624
+ [String, :next, :class],
625
+ [String, :next!, :class],
626
+ #[String, :upto, :class], #rb_str_upto
627
+ [String, :index, :class],
628
+ [String, :rindex, :class],
629
+ [String, :replace, :class],
630
+ [String, :clear, :class],
631
+ [String, :chr, :class],
632
+ [String, :getbyte, :class],
633
+ [String, :setbyte, :class],
634
+ [String, :byteslice, :class],
635
+ [String, :to_i, :class],
636
+ [String, :to_f, :class],
637
+ [String, :to_s, :class],
638
+ [String, :to_str, :class],
639
+ [String, :inspect, :class],
640
+ [String, :dump, :class],
641
+ [String, :upcase, :class],
642
+ [String, :downcase, :class],
643
+ [String, :capitalize, :class],
644
+ [String, :swapcase, :class],
645
+ [String, :upcase!, :class],
646
+ [String, :downcase!, :class],
647
+ [String, :capitalize!, :class],
648
+ [String, :swapcase!, :class],
649
+ [String, :hex, :class],
650
+ [String, :oct, :class],
651
+ [String, :split, :class],
652
+ #[String, :lines, :class], #rb_str_each_line
653
+ #[String, :bytes, :class], #rb_str_each_byte
654
+ #[String, :chars, :class], #rb_str_each_char
655
+ #[String, :codepoints, :class], #rb_str_each_codepoint
656
+ [String, :reverse, :class],
657
+ [String, :reverse!, :class],
658
+ [String, :concat, :class],
659
+ [String, :<<, :class],
660
+ [String, :prepend, :class],
661
+ [String, :crypt, :class],
662
+ [String, :intern, :class],
663
+ [String, :to_sym, :class],
664
+ [String, :ord, :class],
665
+ [String, :include?, :class],
666
+ [String, :start_with?, :class],
667
+ [String, :end_with?, :class],
668
+ #[String, :scan, :class], #rb_str_scan => rb_block_given_p
669
+ [String, :ljust, :class],
670
+ [String, :rjust, :class],
671
+ [String, :center, :class],
672
+ #[String, :sub, :class], #rb_str_sub_bang => rb_block_given_p
673
+ #[String, :gsub, :class], #str_gsub
674
+ [String, :chop, :class],
675
+ [String, :chomp, :class],
676
+ [String, :strip, :class],
677
+ [String, :lstrip, :class],
678
+ [String, :rstrip, :class],
679
+ #[String, :sub!, :class], #rb_str_sub_bang => rb_block_given_p
680
+ #[String, :gsub!, :class], #str_gsub
681
+ [String, :chop!, :class],
682
+ [String, :chomp!, :class],
683
+ [String, :strip!, :class],
684
+ [String, :lstrip!, :class],
685
+ [String, :rstrip!, :class],
686
+ [String, :tr, :class],
687
+ [String, :tr_s, :class],
688
+ [String, :delete, :class],
689
+ [String, :squeeze, :class],
690
+ [String, :count, :class],
691
+ [String, :tr!, :class],
692
+ [String, :tr_s!, :class],
693
+ [String, :delete!, :class],
694
+ [String, :squeeze!, :class],
695
+ #[String, :each_line, :class], #rb_str_each_line
696
+ #[String, :each_byte, :class], #rb_str_each_byte
697
+ #[String, :each_char, :class], #rb_str_each_char
698
+ #[String, :each_codepoint, :class], #rb_str_each_codepoint
699
+ [String, :sum, :class],
700
+ [String, :slice, :class],
701
+ [String, :slice!, :class],
702
+ [String, :partition, :class],
703
+ [String, :rpartition, :class],
704
+ [String, :encoding, :class],
705
+ [String, :force_encoding, :class],
706
+ [String, :valid_encoding?, :class],
707
+ [String, :ascii_only?, :class],
708
+ [Symbol, :all_symbols, :singleton],
709
+ [Symbol, :==, :class],
710
+ [Symbol, :===, :class],
711
+ [Symbol, :inspect, :class],
712
+ [Symbol, :to_s, :class],
713
+ [Symbol, :id2name, :class],
714
+ [Symbol, :intern, :class],
715
+ [Symbol, :to_sym, :class],
716
+ [Symbol, :to_proc, :class],
717
+ [Symbol, :succ, :class],
718
+ [Symbol, :next, :class],
719
+ [Symbol, :<=>, :class],
720
+ [Symbol, :casecmp, :class],
721
+ [Symbol, :=~, :class],
722
+ [Symbol, :[], :class],
723
+ [Symbol, :slice, :class],
724
+ [Symbol, :length, :class],
725
+ [Symbol, :size, :class],
726
+ [Symbol, :empty?, :class],
727
+ [Symbol, :match, :class],
728
+ [Symbol, :upcase, :class],
729
+ [Symbol, :downcase, :class],
730
+ [Symbol, :capitalize, :class],
731
+ [Symbol, :swapcase, :class],
732
+ [Symbol, :encoding, :class],
733
+ [Exception, :exception, :singleton],
734
+ [Exception, :exception, :class],
735
+ [Exception, :initialize, :class],
736
+ [Exception, :==, :class],
737
+ [Exception, :to_s, :class],
738
+ [Exception, :message, :class],
739
+ [Exception, :inspect, :class],
740
+ [Exception, :backtrace, :class],
741
+ [Exception, :set_backtrace, :class],
742
+ #[SystemExit, :initialize, :class], #rb_call_super => vm_call_super
743
+ [SystemExit, :status, :class],
744
+ [SystemExit, :success?, :class],
745
+ #[NameError, :initialize, :class], #rb_call_super => vm_call_super
746
+ [NameError, :name, :class],
747
+ [NameError, :to_s, :class],
748
+ #[NameError::message, :==, :class],
749
+ #[NameError::message, :to_str, :class],
750
+ #[NameError::message, :_dump, :class],
751
+ #[NoMethodError, :initialize, :class], #rb_call_super => vm_call_super
752
+ [NoMethodError, :args, :class],
753
+ #[SystemCallError, :initialize, :class], #rb_call_super => vm_call_super
754
+ [SystemCallError, :errno, :class],
755
+ [SystemCallError, :===, :singleton],
756
+ [Kernel, :warn, :module],
757
+ [Kernel, :warn, :singleton],
758
+ [Kernel, :raise, :module],
759
+ [Kernel, :raise, :singleton],
760
+ [Kernel, :fail, :module],
761
+ [Kernel, :fail, :singleton],
762
+ [Kernel, :global_variables, :module],
763
+ [Kernel, :global_variables, :singleton],
764
+ [Kernel, :__method__, :module],
765
+ [Kernel, :__method__, :singleton],
766
+ [Kernel, :__callee__, :module],
767
+ [Kernel, :__callee__, :singleton],
768
+ [Module, :append_features, :class],
769
+ [Module, :extend_object, :class],
770
+ [Module, :include, :class],
771
+ [Kernel, :eval, :module],
772
+ [Kernel, :eval, :singleton],
773
+ [Kernel, :local_variables, :module],
774
+ [Kernel, :local_variables, :singleton],
775
+ [Kernel, :iterator?, :module],
776
+ [Kernel, :iterator?, :singleton],
777
+ [Kernel, :block_given?, :module],
778
+ [Kernel, :block_given?, :singleton],
779
+ [Kernel, :catch, :module],
780
+ [Kernel, :catch, :singleton],
781
+ [Kernel, :throw, :module],
782
+ [Kernel, :throw, :singleton],
783
+ #[Kernel, :loop, :module], #rb_f_loop
784
+ #[Kernel, :loop, :singleton], #rb_f_loop
785
+ [BasicObject, :instance_eval, :class],
786
+ [BasicObject, :instance_exec, :class],
787
+ [BasicObject, :method_missing, :class],
788
+ [Kernel, :public_send, :module],
789
+ [Module, :module_exec, :class],
790
+ [Module, :class_exec, :class],
791
+ [Module, :module_eval, :class],
792
+ [Module, :class_eval, :class],
793
+ [Kernel, :caller, :module],
794
+ [Kernel, :caller, :singleton],
795
+ [Kernel, :respond_to?, :module],
796
+ [Kernel, :respond_to_missing?, :module],
797
+ [Module, :remove_method, :class],
798
+ [Module, :undef_method, :class],
799
+ [Module, :alias_method, :class],
800
+ [Module, :public, :class],
801
+ [Module, :protected, :class],
802
+ [Module, :private, :class],
803
+ [Module, :module_function, :class],
804
+ [Module, :method_defined?, :class],
805
+ [Module, :public_method_defined?, :class],
806
+ [Module, :private_method_defined?, :class],
807
+ [Module, :protected_method_defined?, :class],
808
+ [Module, :public_class_method, :class],
809
+ [Module, :private_class_method, :class],
810
+ [Module, :nesting, :singleton],
811
+ [Module, :constants, :singleton],
812
+ [Kernel, :extend, :module],
813
+ [Kernel, :trace_var, :module],
814
+ [Kernel, :trace_var, :singleton],
815
+ [Kernel, :untrace_var, :module],
816
+ [Kernel, :untrace_var, :singleton],
817
+ #[Kernel, :at_exit, :module], #rb_f_at_exit
818
+ #[Kernel, :at_exit, :singleton], #rb_f_at_exit
819
+ [Numeric, :singleton_method_added, :class],
820
+ [Numeric, :initialize_copy, :class],
821
+ [Numeric, :coerce, :class],
822
+ [Numeric, :i, :class],
823
+ [Numeric, :+@, :class],
824
+ [Numeric, :-@, :class],
825
+ [Numeric, :<=>, :class],
826
+ [Numeric, :eql?, :class],
827
+ [Numeric, :quo, :class],
828
+ [Numeric, :fdiv, :class],
829
+ [Numeric, :div, :class],
830
+ [Numeric, :divmod, :class],
831
+ [Numeric, :%, :class],
832
+ [Numeric, :modulo, :class],
833
+ [Numeric, :remainder, :class],
834
+ [Numeric, :abs, :class],
835
+ [Numeric, :magnitude, :class],
836
+ [Numeric, :to_int, :class],
837
+ [Numeric, :real?, :class],
838
+ [Numeric, :integer?, :class],
839
+ [Numeric, :zero?, :class],
840
+ [Numeric, :nonzero?, :class],
841
+ [Numeric, :floor, :class],
842
+ [Numeric, :ceil, :class],
843
+ [Numeric, :round, :class],
844
+ [Numeric, :truncate, :class],
845
+ #[Numeric, :step, :class], #num_step
846
+ [Integer, :integer?, :class],
847
+ [Integer, :odd?, :class],
848
+ [Integer, :even?, :class],
849
+ #[Integer, :upto, :class], #int_upto
850
+ #[Integer, :downto, :class], #int_downto
851
+ #[Integer, :times, :class], #int_dotimes
852
+ [Integer, :succ, :class],
853
+ [Integer, :next, :class],
854
+ [Integer, :pred, :class],
855
+ [Integer, :chr, :class],
856
+ [Integer, :ord, :class],
857
+ [Integer, :to_i, :class],
858
+ [Integer, :to_int, :class],
859
+ [Integer, :floor, :class],
860
+ [Integer, :ceil, :class],
861
+ [Integer, :truncate, :class],
862
+ [Integer, :round, :class],
863
+ [Fixnum, :to_s, :class],
864
+ [Fixnum, :-@, :class],
865
+ [Fixnum, :+, :class],
866
+ [Fixnum, :-, :class],
867
+ [Fixnum, :*, :class],
868
+ [Fixnum, :/, :class],
869
+ [Fixnum, :div, :class],
870
+ [Fixnum, :%, :class],
871
+ [Fixnum, :modulo, :class],
872
+ [Fixnum, :divmod, :class],
873
+ [Fixnum, :fdiv, :class],
874
+ [Fixnum, :**, :class],
875
+ [Fixnum, :abs, :class],
876
+ [Fixnum, :magnitude, :class],
877
+ [Fixnum, :==, :class],
878
+ [Fixnum, :===, :class],
879
+ [Fixnum, :<=>, :class],
880
+ [Fixnum, :>, :class],
881
+ [Fixnum, :>=, :class],
882
+ [Fixnum, :<, :class],
883
+ [Fixnum, :<=, :class],
884
+ [Fixnum, :~, :class],
885
+ [Fixnum, :&, :class],
886
+ [Fixnum, :|, :class],
887
+ [Fixnum, :^, :class],
888
+ [Fixnum, :[], :class],
889
+ [Fixnum, :<<, :class],
890
+ [Fixnum, :>>, :class],
891
+ [Fixnum, :to_f, :class],
892
+ [Fixnum, :size, :class],
893
+ [Fixnum, :zero?, :class],
894
+ [Fixnum, :odd?, :class],
895
+ [Fixnum, :even?, :class],
896
+ [Fixnum, :succ, :class],
897
+ [Float, :to_s, :class],
898
+ [Float, :coerce, :class],
899
+ [Float, :-@, :class],
900
+ [Float, :+, :class],
901
+ [Float, :-, :class],
902
+ [Float, :*, :class],
903
+ [Float, :/, :class],
904
+ [Float, :quo, :class],
905
+ [Float, :fdiv, :class],
906
+ [Float, :%, :class],
907
+ [Float, :modulo, :class],
908
+ [Float, :divmod, :class],
909
+ [Float, :**, :class],
910
+ [Float, :==, :class],
911
+ [Float, :===, :class],
912
+ [Float, :<=>, :class],
913
+ [Float, :>, :class],
914
+ [Float, :>=, :class],
915
+ [Float, :<, :class],
916
+ [Float, :<=, :class],
917
+ [Float, :eql?, :class],
918
+ [Float, :hash, :class],
919
+ [Float, :to_f, :class],
920
+ [Float, :abs, :class],
921
+ [Float, :magnitude, :class],
922
+ [Float, :zero?, :class],
923
+ [Float, :to_i, :class],
924
+ [Float, :to_int, :class],
925
+ [Float, :floor, :class],
926
+ [Float, :ceil, :class],
927
+ [Float, :round, :class],
928
+ [Float, :truncate, :class],
929
+ [Float, :nan?, :class],
930
+ [Float, :infinite?, :class],
931
+ [Float, :finite?, :class],
932
+ [Bignum, :to_s, :class],
933
+ [Bignum, :coerce, :class],
934
+ [Bignum, :-@, :class],
935
+ [Bignum, :+, :class],
936
+ [Bignum, :-, :class],
937
+ [Bignum, :*, :class],
938
+ [Bignum, :/, :class],
939
+ [Bignum, :%, :class],
940
+ [Bignum, :div, :class],
941
+ [Bignum, :divmod, :class],
942
+ [Bignum, :modulo, :class],
943
+ [Bignum, :remainder, :class],
944
+ [Bignum, :fdiv, :class],
945
+ [Bignum, :**, :class],
946
+ [Bignum, :&, :class],
947
+ [Bignum, :|, :class],
948
+ [Bignum, :^, :class],
949
+ [Bignum, :~, :class],
950
+ [Bignum, :<<, :class],
951
+ [Bignum, :>>, :class],
952
+ [Bignum, :[], :class],
953
+ [Bignum, :<=>, :class],
954
+ [Bignum, :==, :class],
955
+ [Bignum, :>, :class],
956
+ [Bignum, :>=, :class],
957
+ [Bignum, :<, :class],
958
+ [Bignum, :<=, :class],
959
+ [Bignum, :===, :class],
960
+ [Bignum, :eql?, :class],
961
+ [Bignum, :hash, :class],
962
+ [Bignum, :to_f, :class],
963
+ [Bignum, :abs, :class],
964
+ [Bignum, :magnitude, :class],
965
+ [Bignum, :size, :class],
966
+ [Bignum, :odd?, :class],
967
+ [Bignum, :even?, :class],
968
+ [Array, :[], :singleton],
969
+ [Array, :try_convert, :singleton],
970
+ #[Array, :initialize, :class], #rb_ary_initialize => rb_block_given_p
971
+ [Array, :initialize_copy, :class],
972
+ #[Array, :inspect, :class], #rb_exec_recursive => recursive_list_access
973
+ [Array, :to_a, :class],
974
+ [Array, :to_ary, :class],
975
+ [Array, :frozen?, :class],
976
+ #[Array, :==, :class], #rb_exec_recursive => recursive_list_access
977
+ #[Array, :eql?, :class], #rb_exec_recursive => recursive_list_access
978
+ #[Array, :hash, :class], #rb_exec_recursive_outer => recursive_list_access
979
+ [Array, :[], :class],
980
+ [Array, :[]=, :class],
981
+ [Array, :at, :class],
982
+ #[Array, :fetch, :class], #rb_ary_fetch => rb_block_given_p
983
+ [Array, :first, :class],
984
+ [Array, :last, :class],
985
+ [Array, :concat, :class],
986
+ [Array, :<<, :class],
987
+ [Array, :push, :class],
988
+ [Array, :pop, :class],
989
+ [Array, :shift, :class],
990
+ [Array, :unshift, :class],
991
+ [Array, :insert, :class],
992
+ #[Array, :each, :class], #rb_ary_each
993
+ #[Array, :each_index, :class], #rb_ary_each_index
994
+ #[Array, :reverse_each, :class], #rb_ary_reverse_each
995
+ [Array, :length, :class],
996
+ [Array, :empty?, :class],
997
+ #[Array, :find_index, :class], #rb_ary_index => rb_block_given_p
998
+ #[Array, :index, :class], #rb_ary_index => rb_block_given_p
999
+ #[Array, :rindex, :class], #rb_ary_rindex => rb_block_given_p
1000
+ #[Array, :join, :class], #rb_exec_recursive => recursive_list_access
1001
+ [Array, :reverse, :class],
1002
+ [Array, :reverse!, :class],
1003
+ [Array, :rotate, :class],
1004
+ [Array, :rotate!, :class],
1005
+ #[Array, :sort, :class], #rb_ary_sort_bang => rb_block_given_p
1006
+ #[Array, :sort!, :class], #rb_ary_sort_bang => rb_block_given_p
1007
+ #[Array, :sort_by!, :class], #rb_ary_sort_by_bang
1008
+ #[Array, :collect, :class], #rb_ary_collect
1009
+ #[Array, :collect!, :class], #rb_ary_collect_bang
1010
+ #[Array, :map, :class], #rb_ary_collect
1011
+ #[Array, :map!, :class], #rb_ary_collect_bang
1012
+ #[Array, :select, :class], #rb_ary_select
1013
+ #[Array, :select!, :class], #rb_ary_select_bang
1014
+ #[Array, :keep_if, :class], #rb_ary_keep_if
1015
+ [Array, :values_at, :class],
1016
+ #[Array, :delete, :class], #rb_ary_delete => rb_block_given_p
1017
+ [Array, :delete_at, :class],
1018
+ #[Array, :delete_if, :class], #rb_ary_delete_if
1019
+ #[Array, :reject, :class], #rb_ary_reject
1020
+ #[Array, :reject!, :class], #rb_ary_reject_bang
1021
+ #[Array, :zip, :class], #rb_ary_zip => rb_block_given_p
1022
+ [Array, :transpose, :class],
1023
+ [Array, :replace, :class],
1024
+ [Array, :clear, :class],
1025
+ #[Array, :fill, :class], #rb_ary_fill => rb_block_given_p
1026
+ [Array, :include?, :class],
1027
+ #[Array, :<=>, :class], #rb_exec_recursive => recursive_list_access
1028
+ [Array, :slice, :class],
1029
+ [Array, :slice!, :class],
1030
+ [Array, :assoc, :class],
1031
+ [Array, :rassoc, :class],
1032
+ [Array, :+, :class],
1033
+ [Array, :*, :class],
1034
+ [Array, :-, :class],
1035
+ [Array, :&, :class],
1036
+ [Array, :|, :class],
1037
+ #[Array, :uniq, :class], #rb_ary_uniq => rb_block_given_p
1038
+ #[Array, :uniq!, :class], #rb_ary_uniq_bang => rb_block_given_p
1039
+ [Array, :compact, :class],
1040
+ [Array, :compact!, :class],
1041
+ [Array, :flatten, :class],
1042
+ [Array, :flatten!, :class],
1043
+ #[Array, :count, :class], #rb_ary_count => rb_block_given_p
1044
+ [Array, :shuffle!, :class],
1045
+ [Array, :shuffle, :class],
1046
+ [Array, :sample, :class],
1047
+ #[Array, :cycle, :class], #rb_ary_cycle
1048
+ #[Array, :permutation, :class], #rb_ary_permutation
1049
+ #[Array, :combination, :class], #rb_ary_combination
1050
+ #[Array, :repeated_permutation, :class], #rb_ary_repeated_permutation
1051
+ #[Array, :repeated_combination, :class], #rb_ary_repeated_combination
1052
+ #[Array, :product, :class], #rb_ary_product => rb_block_given_p
1053
+ [Array, :take, :class],
1054
+ #[Array, :take_while, :class], #rb_ary_take_while
1055
+ [Array, :drop, :class],
1056
+ #[Array, :drop_while, :class], #rb_ary_drop_while
1057
+ [Hash, :[], :singleton],
1058
+ [Hash, :try_convert, :singleton],
1059
+ #[Hash, :initialize, :class], #rb_hash_initialize => rb_block_given_p
1060
+ [Hash, :initialize_copy, :class],
1061
+ [Hash, :rehash, :class],
1062
+ [Hash, :to_hash, :class],
1063
+ [Hash, :to_a, :class],
1064
+ #[Hash, :inspect, :class], #rb_exec_recursive => recursive_list_access
1065
+ #[Hash, :==, :class], #rb_exec_recursive_paired => recursive_list_access
1066
+ [Hash, :[], :class],
1067
+ #[Hash, :hash, :class], #rb_exec_recursive_outer => recursive_list_access
1068
+ #[Hash, :eql?, :class], #rb_exec_recursive_paired => recursive_list_access
1069
+ #[Hash, :fetch, :class], #rb_hash_fetch_m => rb_block_given_p
1070
+ [Hash, :[]=, :class],
1071
+ [Hash, :store, :class],
1072
+ [Hash, :default, :class],
1073
+ [Hash, :default=, :class],
1074
+ [Hash, :default_proc, :class],
1075
+ [Hash, :default_proc=, :class],
1076
+ [Hash, :key, :class],
1077
+ [Hash, :index, :class],
1078
+ [Hash, :size, :class],
1079
+ [Hash, :length, :class],
1080
+ [Hash, :empty?, :class],
1081
+ #[Hash, :each_value, :class], #rb_hash_each_value
1082
+ #[Hash, :each_key, :class], #rb_hash_each_key
1083
+ #[Hash, :each_pair, :class], #rb_hash_each_pair
1084
+ #[Hash, :each, :class], #rb_hash_each_pair
1085
+ [Hash, :keys, :class],
1086
+ [Hash, :values, :class],
1087
+ [Hash, :values_at, :class],
1088
+ [Hash, :shift, :class],
1089
+ #[Hash, :delete, :class], #rb_hash_delete => rb_block_given_p
1090
+ #[Hash, :delete_if, :class], #rb_hash_delete_if
1091
+ #[Hash, :keep_if, :class], #rb_hash_keep_if
1092
+ #[Hash, :select, :class], #rb_hash_select
1093
+ #[Hash, :select!, :class], #rb_hash_select_bang
1094
+ #[Hash, :reject, :class], #rb_hash_reject => rb_hash_delete_if
1095
+ #[Hash, :reject!, :class], #rb_hash_reject_bang
1096
+ [Hash, :clear, :class],
1097
+ [Hash, :invert, :class],
1098
+ #[Hash, :update, :class], #rb_hash_update => rb_block_given_p
1099
+ [Hash, :replace, :class],
1100
+ #[Hash, :merge!, :class], #rb_hash_update => rb_block_given_p
1101
+ #[Hash, :merge, :class], #rb_hash_merge => rb_hash_update => rb_block_given_p
1102
+ [Hash, :assoc, :class],
1103
+ [Hash, :rassoc, :class],
1104
+ [Hash, :flatten, :class],
1105
+ [Hash, :include?, :class],
1106
+ [Hash, :member?, :class],
1107
+ [Hash, :has_key?, :class],
1108
+ [Hash, :has_value?, :class],
1109
+ [Hash, :key?, :class],
1110
+ [Hash, :value?, :class],
1111
+ [Hash, :compare_by_identity, :class],
1112
+ [Hash, :compare_by_identity?, :class],
1113
+ #[Struct, :new, :singleton], #rb_struct_s_def => rb_block_given_p
1114
+ [Struct, :initialize, :class],
1115
+ [Struct, :initialize_copy, :class],
1116
+ #[Struct, :==, :class], #rb_exec_recursive_paired => recursive_list_access
1117
+ #[Struct, :eql?, :class], #rb_exec_recursive_paired => recursive_list_access
1118
+ #[Struct, :hash, :class], #rb_exec_recursive_outer => recursive_list_access
1119
+ #[Struct, :inspect, :class], #rb_exec_recursive => recursive_list_access
1120
+ [Struct, :to_a, :class],
1121
+ [Struct, :values, :class],
1122
+ [Struct, :size, :class],
1123
+ [Struct, :length, :class],
1124
+ #[Struct, :each, :class], #rb_struct_each
1125
+ #[Struct, :each_pair, :class], #rb_struct_each_pair
1126
+ [Struct, :[], :class],
1127
+ [Struct, :[]=, :class],
1128
+ #[Struct, :select, :class], #rb_struct_select
1129
+ [Struct, :values_at, :class],
1130
+ [Struct, :members, :class],
1131
+ [Regexp, :compile, :singleton],
1132
+ [Regexp, :quote, :singleton],
1133
+ [Regexp, :escape, :singleton],
1134
+ [Regexp, :union, :singleton],
1135
+ [Regexp, :last_match, :singleton],
1136
+ [Regexp, :try_convert, :singleton],
1137
+ [Regexp, :initialize, :class],
1138
+ [Regexp, :initialize_copy, :class],
1139
+ [Regexp, :hash, :class],
1140
+ [Regexp, :eql?, :class],
1141
+ [Regexp, :==, :class],
1142
+ [Regexp, :=~, :class],
1143
+ [Regexp, :===, :class],
1144
+ [Regexp, :~, :class],
1145
+ #[Regexp, :match, :class], #rb_reg_match_m => rb_block_given_p
1146
+ [Regexp, :to_s, :class],
1147
+ [Regexp, :inspect, :class],
1148
+ [Regexp, :source, :class],
1149
+ [Regexp, :casefold?, :class],
1150
+ [Regexp, :options, :class],
1151
+ [Regexp, :encoding, :class],
1152
+ [Regexp, :fixed_encoding?, :class],
1153
+ [Regexp, :names, :class],
1154
+ [Regexp, :named_captures, :class],
1155
+ [MatchData, :initialize_copy, :class],
1156
+ [MatchData, :regexp, :class],
1157
+ [MatchData, :names, :class],
1158
+ [MatchData, :size, :class],
1159
+ [MatchData, :length, :class],
1160
+ [MatchData, :offset, :class],
1161
+ [MatchData, :begin, :class],
1162
+ [MatchData, :end, :class],
1163
+ [MatchData, :to_a, :class],
1164
+ [MatchData, :[], :class],
1165
+ [MatchData, :captures, :class],
1166
+ [MatchData, :values_at, :class],
1167
+ [MatchData, :pre_match, :class],
1168
+ [MatchData, :post_match, :class],
1169
+ [MatchData, :to_s, :class],
1170
+ [MatchData, :inspect, :class],
1171
+ [MatchData, :string, :class],
1172
+ [MatchData, :hash, :class],
1173
+ [MatchData, :eql?, :class],
1174
+ [MatchData, :==, :class],
1175
+ [Array, :pack, :class],
1176
+ #[String, :unpack, :class], #pack_unpack => rb_block_given_p
1177
+ [String, :encode, :class],
1178
+ [String, :encode!, :class],
1179
+ [Encoding::Converter, :initialize, :class],
1180
+ [Encoding::Converter, :inspect, :class],
1181
+ [Encoding::Converter, :convpath, :class],
1182
+ [Encoding::Converter, :source_encoding, :class],
1183
+ [Encoding::Converter, :destination_encoding, :class],
1184
+ [Encoding::Converter, :primitive_convert, :class],
1185
+ [Encoding::Converter, :convert, :class],
1186
+ [Encoding::Converter, :finish, :class],
1187
+ [Encoding::Converter, :primitive_errinfo, :class],
1188
+ [Encoding::Converter, :insert_output, :class],
1189
+ [Encoding::Converter, :putback, :class],
1190
+ [Encoding::Converter, :last_error, :class],
1191
+ [Encoding::Converter, :replacement, :class],
1192
+ [Encoding::Converter, :replacement=, :class],
1193
+ [Encoding::UndefinedConversionError, :source_encoding_name, :class],
1194
+ [Encoding::UndefinedConversionError, :destination_encoding_name, :class],
1195
+ [Encoding::UndefinedConversionError, :source_encoding, :class],
1196
+ [Encoding::UndefinedConversionError, :destination_encoding, :class],
1197
+ [Encoding::UndefinedConversionError, :error_char, :class],
1198
+ [Encoding::InvalidByteSequenceError, :source_encoding_name, :class],
1199
+ [Encoding::InvalidByteSequenceError, :destination_encoding_name, :class],
1200
+ [Encoding::InvalidByteSequenceError, :source_encoding, :class],
1201
+ [Encoding::InvalidByteSequenceError, :destination_encoding, :class],
1202
+ [Encoding::InvalidByteSequenceError, :error_bytes, :class],
1203
+ [Encoding::InvalidByteSequenceError, :readagain_bytes, :class],
1204
+ [Encoding::InvalidByteSequenceError, :incomplete_input?, :class],
1205
+ [Marshal, :dump, :module],
1206
+ [Marshal, :dump, :singleton],
1207
+ [Marshal, :load, :module],
1208
+ [Marshal, :load, :singleton],
1209
+ [Marshal, :restore, :module],
1210
+ [Marshal, :restore, :singleton],
1211
+ [Range, :initialize, :class],
1212
+ [Range, :initialize_copy, :class],
1213
+ #[Range, :==, :class], #rb_exec_recursive_paired => recursive_list_access
1214
+ [Range, :===, :class],
1215
+ #[Range, :eql?, :class], #rb_exec_recursive_paired => recursive_list_access
1216
+ #[Range, :hash, :class], #rb_exec_recursive_outer => recursive_list_access
1217
+ #[Range, :each, :class], #range_each
1218
+ #[Range, :step, :class], #range_step
1219
+ [Range, :begin, :class],
1220
+ [Range, :end, :class],
1221
+ [Range, :first, :class],
1222
+ [Range, :last, :class],
1223
+ #[Range, :min, :class], #rb_call_super => vm_call_super, range_min => rb_block_given_p
1224
+ #[Range, :max, :class], #rb_call_super => vm_call_super, range_max => rb_block_given_p
1225
+ [Range, :to_s, :class],
1226
+ #[Range, :inspect, :class], #rb_exec_recursive => recursive_list_access
1227
+ [Range, :exclude_end?, :class],
1228
+ #[Range, :member?, :class], #rb_call_super => vm_call_super
1229
+ #[Range, :include?, :class], #rb_call_super => vm_call_super
1230
+ [Range, :cover?, :class],
1231
+ [Kernel, :syscall, :module],
1232
+ [Kernel, :syscall, :singleton],
1233
+ #[Kernel, :open, :module], #rb_f_open => rb_block_given_p
1234
+ #[Kernel, :open, :singleton], #rb_f_open => rb_block_given_p
1235
+ [Kernel, :printf, :module],
1236
+ [Kernel, :printf, :singleton],
1237
+ [Kernel, :print, :module],
1238
+ [Kernel, :print, :singleton],
1239
+ [Kernel, :putc, :module],
1240
+ [Kernel, :putc, :singleton],
1241
+ #[Kernel, :puts, :module], #rb_io_puts => rb_exec_recursive => recursive_list_access
1242
+ #[Kernel, :puts, :singleton], #rb_io_puts => rb_exec_recursive => recursive_list_access
1243
+ [Kernel, :gets, :module],
1244
+ [Kernel, :gets, :singleton],
1245
+ [Kernel, :readline, :module],
1246
+ [Kernel, :readline, :singleton],
1247
+ [Kernel, :select, :module],
1248
+ [Kernel, :select, :singleton],
1249
+ [Kernel, :readlines, :module],
1250
+ [Kernel, :readlines, :singleton],
1251
+ [Kernel, :`, :module],
1252
+ [Kernel, :`, :singleton],
1253
+ [Kernel, :p, :module],
1254
+ [Kernel, :p, :singleton],
1255
+ [Kernel, :display, :module],
1256
+ #[IO, :new, :singleton], #rb_io_s_new => rb_block_given_p
1257
+ #[IO, :open, :singleton], #rb_io_s_open => rb_block_given_p
1258
+ [IO, :sysopen, :singleton],
1259
+ [IO, :for_fd, :singleton],
1260
+ #[IO, :popen, :singleton], #rb_io_s_popen => rb_block_given_p
1261
+ #[IO, :foreach, :singleton], #rb_io_s_foreach
1262
+ [IO, :readlines, :singleton],
1263
+ [IO, :read, :singleton],
1264
+ [IO, :binread, :singleton],
1265
+ [IO, :write, :singleton],
1266
+ [IO, :binwrite, :singleton],
1267
+ [IO, :select, :singleton],
1268
+ #[IO, :pipe, :singleton], #rb_io_s_pipe => rb_block_given_p
1269
+ [IO, :try_convert, :singleton],
1270
+ [IO, :copy_stream, :singleton],
1271
+ [IO, :initialize, :class],
1272
+ [IO, :initialize_copy, :class],
1273
+ [IO, :reopen, :class],
1274
+ [IO, :print, :class],
1275
+ [IO, :putc, :class],
1276
+ #[IO, :puts, :class], #rb_exec_recursive => recursive_list_access
1277
+ [IO, :printf, :class],
1278
+ #[IO, :each, :class], #rb_io_each_line
1279
+ #[IO, :each_line, :class], #rb_io_each_line
1280
+ #[IO, :each_byte, :class], #rb_io_each_byte
1281
+ #[IO, :each_char, :class], #rb_io_each_char
1282
+ #[IO, :each_codepoint, :class], #rb_io_each_codepoint
1283
+ #[IO, :lines, :class], #rb_io_each_line
1284
+ #[IO, :bytes, :class], #rb_io_each_byte
1285
+ #[IO, :chars, :class], #rb_io_each_char
1286
+ #[IO, :codepoints, :class], #rb_io_each_codepoint
1287
+ [IO, :syswrite, :class],
1288
+ [IO, :sysread, :class],
1289
+ [IO, :fileno, :class],
1290
+ [IO, :to_io, :class],
1291
+ [IO, :fsync, :class],
1292
+ [IO, :fdatasync, :class],
1293
+ [IO, :sync, :class],
1294
+ [IO, :sync=, :class],
1295
+ [IO, :lineno, :class],
1296
+ [IO, :lineno=, :class],
1297
+ [IO, :readlines, :class],
1298
+ [IO, :read_nonblock, :class],
1299
+ [IO, :write_nonblock, :class],
1300
+ [IO, :readpartial, :class],
1301
+ [IO, :read, :class],
1302
+ [IO, :write, :class],
1303
+ [IO, :gets, :class],
1304
+ [IO, :readline, :class],
1305
+ [IO, :getc, :class],
1306
+ [IO, :getbyte, :class],
1307
+ [IO, :readchar, :class],
1308
+ [IO, :readbyte, :class],
1309
+ [IO, :ungetbyte, :class],
1310
+ [IO, :ungetc, :class],
1311
+ [IO, :<<, :class],
1312
+ [IO, :flush, :class],
1313
+ [IO, :tell, :class],
1314
+ [IO, :seek, :class],
1315
+ [IO, :rewind, :class],
1316
+ [IO, :pos, :class],
1317
+ [IO, :pos=, :class],
1318
+ [IO, :eof, :class],
1319
+ [IO, :eof?, :class],
1320
+ [IO, :close_on_exec?, :class],
1321
+ [IO, :close_on_exec=, :class],
1322
+ [IO, :close, :class],
1323
+ [IO, :closed?, :class],
1324
+ [IO, :close_read, :class],
1325
+ [IO, :close_write, :class],
1326
+ [IO, :isatty, :class],
1327
+ [IO, :tty?, :class],
1328
+ [IO, :binmode, :class],
1329
+ [IO, :binmode?, :class],
1330
+ [IO, :sysseek, :class],
1331
+ [IO, :advise, :class],
1332
+ [IO, :ioctl, :class],
1333
+ [IO, :fcntl, :class],
1334
+ [IO, :pid, :class],
1335
+ [IO, :inspect, :class],
1336
+ [IO, :external_encoding, :class],
1337
+ [IO, :internal_encoding, :class],
1338
+ [IO, :set_encoding, :class],
1339
+ [IO, :autoclose?, :class],
1340
+ [IO, :autoclose=, :class],
1341
+ #[ARGF, :initialize, :class],
1342
+ #[ARGF, :initialize_copy, :class],
1343
+ #[ARGF, :to_s, :class],
1344
+ #[ARGF, :argv, :class],
1345
+ #[ARGF, :fileno, :class], #argf_fileno
1346
+ #[ARGF, :to_i, :class],
1347
+ #[ARGF, :to_io, :class], #argf_to_io
1348
+ #[ARGF, :to_write_io, :class],
1349
+ #[ARGF, :each, :class], #argf_each_line
1350
+ #[ARGF, :each_line, :class], #argf_each_line
1351
+ #[ARGF, :each_byte, :class], #argf_each_byte
1352
+ #[ARGF, :each_char, :class], #argf_each_char
1353
+ #[ARGF, :lines, :class], #argf_each_line
1354
+ #[ARGF, :bytes, :class], #argf_each_byte
1355
+ #[ARGF, :chars, :class], #argf_each_char
1356
+ #[ARGF, :read, :class], #argf_read
1357
+ #[ARGF, :readpartial, :class], #argf_readpartial
1358
+ #[ARGF, :read_nonblock, :class], #argf_read_nonblock
1359
+ #[ARGF, :readlines, :class],
1360
+ #[ARGF, :to_a, :class],
1361
+ #[ARGF, :gets, :class],
1362
+ #[ARGF, :readline, :class], #argf_readline
1363
+ #[ARGF, :getc, :class],
1364
+ #[ARGF, :getbyte, :class],
1365
+ #[ARGF, :readchar, :class],
1366
+ #[ARGF, :readbyte, :class], #argf_readbyte
1367
+ #[ARGF, :tell, :class], #argf_tell
1368
+ #[ARGF, :seek, :class], #argf_seek_m
1369
+ #[ARGF, :rewind, :class], #argf_rewind
1370
+ #[ARGF, :pos, :class], #argf_tell
1371
+ #[ARGF, :pos=, :class], #argf_set_pos
1372
+ #[ARGF, :eof, :class], #argf_eof
1373
+ #[ARGF, :eof?, :class], #argf_eof
1374
+ #[ARGF, :binmode, :class], #argf_binmode_m
1375
+ #[ARGF, :binmode?, :class],
1376
+ #[ARGF, :write, :class],
1377
+ #[ARGF, :print, :class],
1378
+ #[ARGF, :putc, :class],
1379
+ #[ARGF, :puts, :class], #rb_exec_recursive => recursive_list_access
1380
+ #[ARGF, :printf, :class],
1381
+ #[ARGF, :filename, :class],
1382
+ #[ARGF, :path, :class],
1383
+ #[ARGF, :file, :class],
1384
+ #[ARGF, :skip, :class],
1385
+ #[ARGF, :close, :class],
1386
+ #[ARGF, :closed?, :class], #argf_closed
1387
+ #[ARGF, :lineno, :class],
1388
+ #[ARGF, :lineno=, :class],
1389
+ #[ARGF, :inplace_mode, :class],
1390
+ #[ARGF, :inplace_mode=, :class],
1391
+ #[ARGF, :external_encoding, :class],
1392
+ #[ARGF, :internal_encoding, :class],
1393
+ #[ARGF, :set_encoding, :class],
1394
+ [FileTest, :directory?, :module],
1395
+ [FileTest, :directory?, :singleton],
1396
+ [File, :directory?, :singleton],
1397
+ [FileTest, :exist?, :module],
1398
+ [FileTest, :exist?, :singleton],
1399
+ [File, :exist?, :singleton],
1400
+ [FileTest, :exists?, :module],
1401
+ [FileTest, :exists?, :singleton],
1402
+ [File, :exists?, :singleton],
1403
+ [FileTest, :readable?, :module],
1404
+ [FileTest, :readable?, :singleton],
1405
+ [File, :readable?, :singleton],
1406
+ [FileTest, :readable_real?, :module],
1407
+ [FileTest, :readable_real?, :singleton],
1408
+ [File, :readable_real?, :singleton],
1409
+ [FileTest, :world_readable?, :module],
1410
+ [FileTest, :world_readable?, :singleton],
1411
+ [File, :world_readable?, :singleton],
1412
+ [FileTest, :writable?, :module],
1413
+ [FileTest, :writable?, :singleton],
1414
+ [File, :writable?, :singleton],
1415
+ [FileTest, :writable_real?, :module],
1416
+ [FileTest, :writable_real?, :singleton],
1417
+ [File, :writable_real?, :singleton],
1418
+ [FileTest, :world_writable?, :module],
1419
+ [FileTest, :world_writable?, :singleton],
1420
+ [File, :world_writable?, :singleton],
1421
+ [FileTest, :executable?, :module],
1422
+ [FileTest, :executable?, :singleton],
1423
+ [File, :executable?, :singleton],
1424
+ [FileTest, :executable_real?, :module],
1425
+ [FileTest, :executable_real?, :singleton],
1426
+ [File, :executable_real?, :singleton],
1427
+ [FileTest, :file?, :module],
1428
+ [FileTest, :file?, :singleton],
1429
+ [File, :file?, :singleton],
1430
+ [FileTest, :zero?, :module],
1431
+ [FileTest, :zero?, :singleton],
1432
+ [File, :zero?, :singleton],
1433
+ [FileTest, :size?, :module],
1434
+ [FileTest, :size?, :singleton],
1435
+ [File, :size?, :singleton],
1436
+ [FileTest, :size, :module],
1437
+ [FileTest, :size, :singleton],
1438
+ [File, :size, :singleton],
1439
+ [FileTest, :owned?, :module],
1440
+ [FileTest, :owned?, :singleton],
1441
+ [File, :owned?, :singleton],
1442
+ [FileTest, :grpowned?, :module],
1443
+ [FileTest, :grpowned?, :singleton],
1444
+ [File, :grpowned?, :singleton],
1445
+ [FileTest, :pipe?, :module],
1446
+ [FileTest, :pipe?, :singleton],
1447
+ [File, :pipe?, :singleton],
1448
+ [FileTest, :symlink?, :module],
1449
+ [FileTest, :symlink?, :singleton],
1450
+ [File, :symlink?, :singleton],
1451
+ [FileTest, :socket?, :module],
1452
+ [FileTest, :socket?, :singleton],
1453
+ [File, :socket?, :singleton],
1454
+ [FileTest, :blockdev?, :module],
1455
+ [FileTest, :blockdev?, :singleton],
1456
+ [File, :blockdev?, :singleton],
1457
+ [FileTest, :chardev?, :module],
1458
+ [FileTest, :chardev?, :singleton],
1459
+ [File, :chardev?, :singleton],
1460
+ [FileTest, :setuid?, :module],
1461
+ [FileTest, :setuid?, :singleton],
1462
+ [File, :setuid?, :singleton],
1463
+ [FileTest, :setgid?, :module],
1464
+ [FileTest, :setgid?, :singleton],
1465
+ [File, :setgid?, :singleton],
1466
+ [FileTest, :sticky?, :module],
1467
+ [FileTest, :sticky?, :singleton],
1468
+ [File, :sticky?, :singleton],
1469
+ [FileTest, :identical?, :module],
1470
+ [FileTest, :identical?, :singleton],
1471
+ [File, :identical?, :singleton],
1472
+ [File, :stat, :singleton],
1473
+ [File, :lstat, :singleton],
1474
+ [File, :ftype, :singleton],
1475
+ [File, :atime, :singleton],
1476
+ [File, :mtime, :singleton],
1477
+ [File, :ctime, :singleton],
1478
+ [File, :utime, :singleton],
1479
+ [File, :chmod, :singleton],
1480
+ [File, :chown, :singleton],
1481
+ [File, :lchmod, :singleton],
1482
+ [File, :lchown, :singleton],
1483
+ [File, :link, :singleton],
1484
+ [File, :symlink, :singleton],
1485
+ [File, :readlink, :singleton],
1486
+ [File, :unlink, :singleton],
1487
+ [File, :delete, :singleton],
1488
+ [File, :rename, :singleton],
1489
+ [File, :umask, :singleton],
1490
+ [File, :truncate, :singleton],
1491
+ [File, :expand_path, :singleton],
1492
+ [File, :absolute_path, :singleton],
1493
+ [File, :realpath, :singleton],
1494
+ [File, :realdirpath, :singleton],
1495
+ [File, :basename, :singleton],
1496
+ [File, :dirname, :singleton],
1497
+ [File, :extname, :singleton],
1498
+ [File, :path, :singleton],
1499
+ [File, :split, :singleton],
1500
+ #[File, :join, :singleton], #rb_exec_recursive => recursive_list_access
1501
+ [IO, :stat, :class],
1502
+ [File, :lstat, :class],
1503
+ [File, :atime, :class],
1504
+ [File, :mtime, :class],
1505
+ [File, :ctime, :class],
1506
+ [File, :size, :class],
1507
+ [File, :chmod, :class],
1508
+ [File, :chown, :class],
1509
+ [File, :truncate, :class],
1510
+ [File, :flock, :class],
1511
+ [File, :path, :class],
1512
+ [File, :to_path, :class],
1513
+ [Kernel, :test, :module],
1514
+ [Kernel, :test, :singleton],
1515
+ [File::Stat, :initialize, :class],
1516
+ [File::Stat, :initialize_copy, :class],
1517
+ [File::Stat, :<=>, :class],
1518
+ [File::Stat, :dev, :class],
1519
+ [File::Stat, :dev_major, :class],
1520
+ [File::Stat, :dev_minor, :class],
1521
+ [File::Stat, :ino, :class],
1522
+ [File::Stat, :mode, :class],
1523
+ [File::Stat, :nlink, :class],
1524
+ [File::Stat, :uid, :class],
1525
+ [File::Stat, :gid, :class],
1526
+ [File::Stat, :rdev, :class],
1527
+ [File::Stat, :rdev_major, :class],
1528
+ [File::Stat, :rdev_minor, :class],
1529
+ [File::Stat, :size, :class],
1530
+ [File::Stat, :blksize, :class],
1531
+ [File::Stat, :blocks, :class],
1532
+ [File::Stat, :atime, :class],
1533
+ [File::Stat, :mtime, :class],
1534
+ [File::Stat, :ctime, :class],
1535
+ [File::Stat, :inspect, :class],
1536
+ [File::Stat, :ftype, :class],
1537
+ [File::Stat, :directory?, :class],
1538
+ [File::Stat, :readable?, :class],
1539
+ [File::Stat, :readable_real?, :class],
1540
+ [File::Stat, :world_readable?, :class],
1541
+ [File::Stat, :writable?, :class],
1542
+ [File::Stat, :writable_real?, :class],
1543
+ [File::Stat, :world_writable?, :class],
1544
+ [File::Stat, :executable?, :class],
1545
+ [File::Stat, :executable_real?, :class],
1546
+ [File::Stat, :file?, :class],
1547
+ [File::Stat, :zero?, :class],
1548
+ [File::Stat, :size?, :class],
1549
+ [File::Stat, :owned?, :class],
1550
+ [File::Stat, :grpowned?, :class],
1551
+ [File::Stat, :pipe?, :class],
1552
+ [File::Stat, :symlink?, :class],
1553
+ [File::Stat, :socket?, :class],
1554
+ [File::Stat, :blockdev?, :class],
1555
+ [File::Stat, :chardev?, :class],
1556
+ [File::Stat, :setuid?, :class],
1557
+ [File::Stat, :setgid?, :class],
1558
+ [File::Stat, :sticky?, :class],
1559
+ [File, :initialize, :class],
1560
+ #[Dir, :open, :singleton], #dir_s_open => rb_block_given_p
1561
+ #[Dir, :foreach, :singleton], #dir_foreach
1562
+ [Dir, :entries, :singleton],
1563
+ [Dir, :initialize, :class],
1564
+ [Dir, :path, :class],
1565
+ [Dir, :to_path, :class],
1566
+ [Dir, :inspect, :class],
1567
+ [Dir, :read, :class],
1568
+ #[Dir, :each, :class], #dir_each
1569
+ [Dir, :rewind, :class],
1570
+ [Dir, :tell, :class],
1571
+ [Dir, :seek, :class],
1572
+ [Dir, :pos, :class],
1573
+ [Dir, :pos=, :class],
1574
+ [Dir, :close, :class],
1575
+ #[Dir, :chdir, :singleton], #dir_s_chdir => rb_block_given_p
1576
+ [Dir, :getwd, :singleton],
1577
+ [Dir, :pwd, :singleton],
1578
+ [Dir, :chroot, :singleton],
1579
+ [Dir, :mkdir, :singleton],
1580
+ [Dir, :rmdir, :singleton],
1581
+ [Dir, :delete, :singleton],
1582
+ [Dir, :unlink, :singleton],
1583
+ [Dir, :home, :singleton],
1584
+ #[Dir, :glob, :singleton], #dir_s_glob => rb_block_given_p
1585
+ [Dir, :[], :singleton],
1586
+ [Dir, :exist?, :singleton],
1587
+ [Dir, :exists?, :singleton],
1588
+ [File, :fnmatch, :singleton],
1589
+ [File, :fnmatch?, :singleton],
1590
+ [Time, :now, :singleton],
1591
+ [Time, :at, :singleton],
1592
+ [Time, :utc, :singleton],
1593
+ [Time, :gm, :singleton],
1594
+ [Time, :local, :singleton],
1595
+ [Time, :mktime, :singleton],
1596
+ [Time, :to_i, :class],
1597
+ [Time, :to_f, :class],
1598
+ [Time, :to_r, :class],
1599
+ [Time, :<=>, :class],
1600
+ [Time, :eql?, :class],
1601
+ [Time, :hash, :class],
1602
+ [Time, :initialize, :class],
1603
+ [Time, :initialize_copy, :class],
1604
+ [Time, :localtime, :class],
1605
+ [Time, :gmtime, :class],
1606
+ [Time, :utc, :class],
1607
+ [Time, :getlocal, :class],
1608
+ [Time, :getgm, :class],
1609
+ [Time, :getutc, :class],
1610
+ [Time, :ctime, :class],
1611
+ [Time, :asctime, :class],
1612
+ [Time, :to_s, :class],
1613
+ [Time, :inspect, :class],
1614
+ [Time, :to_a, :class],
1615
+ [Time, :+, :class],
1616
+ [Time, :-, :class],
1617
+ [Time, :succ, :class],
1618
+ [Time, :round, :class],
1619
+ [Time, :sec, :class],
1620
+ [Time, :min, :class],
1621
+ [Time, :hour, :class],
1622
+ [Time, :mday, :class],
1623
+ [Time, :day, :class],
1624
+ [Time, :mon, :class],
1625
+ [Time, :month, :class],
1626
+ [Time, :year, :class],
1627
+ [Time, :wday, :class],
1628
+ [Time, :yday, :class],
1629
+ [Time, :isdst, :class],
1630
+ [Time, :dst?, :class],
1631
+ [Time, :zone, :class],
1632
+ [Time, :gmtoff, :class],
1633
+ [Time, :gmt_offset, :class],
1634
+ [Time, :utc_offset, :class],
1635
+ [Time, :utc?, :class],
1636
+ [Time, :gmt?, :class],
1637
+ [Time, :sunday?, :class],
1638
+ [Time, :monday?, :class],
1639
+ [Time, :tuesday?, :class],
1640
+ [Time, :wednesday?, :class],
1641
+ [Time, :thursday?, :class],
1642
+ [Time, :friday?, :class],
1643
+ [Time, :saturday?, :class],
1644
+ [Time, :tv_sec, :class],
1645
+ [Time, :tv_usec, :class],
1646
+ [Time, :usec, :class],
1647
+ [Time, :tv_nsec, :class],
1648
+ [Time, :nsec, :class],
1649
+ [Time, :subsec, :class],
1650
+ [Time, :strftime, :class],
1651
+ [Time, :_dump, :class],
1652
+ [Time, :_load, :singleton],
1653
+ [Kernel, :srand, :module],
1654
+ [Kernel, :srand, :singleton],
1655
+ [Kernel, :rand, :module],
1656
+ [Kernel, :rand, :singleton],
1657
+ [Random, :initialize, :class],
1658
+ [Random, :rand, :class],
1659
+ [Random, :bytes, :class],
1660
+ [Random, :seed, :class],
1661
+ [Random, :initialize_copy, :class],
1662
+ [Random, :marshal_dump, :class],
1663
+ [Random, :marshal_load, :class],
1664
+ [Random, :state, :class],
1665
+ [Random, :left, :class],
1666
+ [Random, :==, :class],
1667
+ [Random, :srand, :singleton],
1668
+ [Random, :rand, :singleton],
1669
+ [Random, :new_seed, :singleton],
1670
+ [Random, :state, :singleton],
1671
+ [Random, :left, :singleton],
1672
+ [Kernel, :trap, :module],
1673
+ [Kernel, :trap, :singleton],
1674
+ [Signal, :trap, :module],
1675
+ [Signal, :trap, :singleton],
1676
+ [Signal, :list, :module],
1677
+ [Signal, :list, :singleton],
1678
+ #[SignalException, :initialize, :class], #rb_call_super => vm_call_super
1679
+ [SignalException, :signo, :class],
1680
+ #[Interrupt, :initialize, :class], #rb_call_super => vm_call_super
1681
+ [Kernel, :exec, :module],
1682
+ [Kernel, :exec, :singleton],
1683
+ #[Kernel, :fork, :module], #rb_f_fork => rb_block_given_p
1684
+ #[Kernel, :fork, :singleton], #rb_f_fork => rb_block_given_p
1685
+ [Kernel, :exit!, :module],
1686
+ [Kernel, :exit!, :singleton],
1687
+ [Kernel, :system, :module],
1688
+ [Kernel, :system, :singleton],
1689
+ [Kernel, :spawn, :module],
1690
+ [Kernel, :spawn, :singleton],
1691
+ [Kernel, :sleep, :module],
1692
+ [Kernel, :sleep, :singleton],
1693
+ [Kernel, :exit, :module],
1694
+ [Kernel, :exit, :singleton],
1695
+ [Kernel, :abort, :module],
1696
+ [Kernel, :abort, :singleton],
1697
+ [Process, :exec, :singleton],
1698
+ #[Process, :fork, :singleton], #rb_f_fork => rb_block_given_p
1699
+ [Process, :spawn, :singleton],
1700
+ [Process, :exit!, :singleton],
1701
+ [Process, :exit, :singleton],
1702
+ [Process, :abort, :singleton],
1703
+ [Process, :kill, :module],
1704
+ [Process, :kill, :singleton],
1705
+ [Process, :wait, :module],
1706
+ [Process, :wait, :singleton],
1707
+ [Process, :wait2, :module],
1708
+ [Process, :wait2, :singleton],
1709
+ [Process, :waitpid, :module],
1710
+ [Process, :waitpid, :singleton],
1711
+ [Process, :waitpid2, :module],
1712
+ [Process, :waitpid2, :singleton],
1713
+ [Process, :waitall, :module],
1714
+ [Process, :waitall, :singleton],
1715
+ [Process, :detach, :module],
1716
+ [Process, :detach, :singleton],
1717
+ [Process::Status, :==, :class],
1718
+ [Process::Status, :&, :class],
1719
+ [Process::Status, :>>, :class],
1720
+ [Process::Status, :to_i, :class],
1721
+ [Process::Status, :to_s, :class],
1722
+ [Process::Status, :inspect, :class],
1723
+ [Process::Status, :pid, :class],
1724
+ [Process::Status, :stopped?, :class],
1725
+ [Process::Status, :stopsig, :class],
1726
+ [Process::Status, :signaled?, :class],
1727
+ [Process::Status, :termsig, :class],
1728
+ [Process::Status, :exited?, :class],
1729
+ [Process::Status, :exitstatus, :class],
1730
+ [Process::Status, :success?, :class],
1731
+ [Process::Status, :coredump?, :class],
1732
+ [Process, :pid, :module],
1733
+ [Process, :pid, :singleton],
1734
+ [Process, :ppid, :module],
1735
+ [Process, :ppid, :singleton],
1736
+ [Process, :getpgrp, :module],
1737
+ [Process, :getpgrp, :singleton],
1738
+ [Process, :setpgrp, :module],
1739
+ [Process, :setpgrp, :singleton],
1740
+ [Process, :getpgid, :module],
1741
+ [Process, :getpgid, :singleton],
1742
+ [Process, :setpgid, :module],
1743
+ [Process, :setpgid, :singleton],
1744
+ [Process, :setsid, :module],
1745
+ [Process, :setsid, :singleton],
1746
+ [Process, :getpriority, :module],
1747
+ [Process, :getpriority, :singleton],
1748
+ [Process, :setpriority, :module],
1749
+ [Process, :setpriority, :singleton],
1750
+ [Process, :getrlimit, :module],
1751
+ [Process, :getrlimit, :singleton],
1752
+ [Process, :setrlimit, :module],
1753
+ [Process, :setrlimit, :singleton],
1754
+ [Process, :uid, :module],
1755
+ [Process, :uid, :singleton],
1756
+ [Process, :uid=, :module],
1757
+ [Process, :uid=, :singleton],
1758
+ [Process, :gid, :module],
1759
+ [Process, :gid, :singleton],
1760
+ [Process, :gid=, :module],
1761
+ [Process, :gid=, :singleton],
1762
+ [Process, :euid, :module],
1763
+ [Process, :euid, :singleton],
1764
+ [Process, :euid=, :module],
1765
+ [Process, :euid=, :singleton],
1766
+ [Process, :egid, :module],
1767
+ [Process, :egid, :singleton],
1768
+ [Process, :egid=, :module],
1769
+ [Process, :egid=, :singleton],
1770
+ [Process, :initgroups, :module],
1771
+ [Process, :initgroups, :singleton],
1772
+ [Process, :groups, :module],
1773
+ [Process, :groups, :singleton],
1774
+ [Process, :groups=, :module],
1775
+ [Process, :groups=, :singleton],
1776
+ [Process, :maxgroups, :module],
1777
+ [Process, :maxgroups, :singleton],
1778
+ [Process, :maxgroups=, :module],
1779
+ [Process, :maxgroups=, :singleton],
1780
+ [Process, :daemon, :module],
1781
+ [Process, :daemon, :singleton],
1782
+ [Process, :times, :module],
1783
+ [Process, :times, :singleton],
1784
+ [Struct::Tms, :utime, :class],
1785
+ [Struct::Tms, :utime=, :class],
1786
+ [Struct::Tms, :stime, :class],
1787
+ [Struct::Tms, :stime=, :class],
1788
+ [Struct::Tms, :cutime, :class],
1789
+ [Struct::Tms, :cutime=, :class],
1790
+ [Struct::Tms, :cstime, :class],
1791
+ [Struct::Tms, :cstime=, :class],
1792
+ [Process::UID, :rid, :module],
1793
+ [Process::GID, :rid, :module],
1794
+ [Process::UID, :eid, :module],
1795
+ [Process::GID, :eid, :module],
1796
+ [Process::UID, :change_privilege, :module],
1797
+ [Process::GID, :change_privilege, :module],
1798
+ [Process::UID, :grant_privilege, :module],
1799
+ [Process::GID, :grant_privilege, :module],
1800
+ [Process::UID, :re_exchange, :module],
1801
+ [Process::GID, :re_exchange, :module],
1802
+ [Process::UID, :re_exchangeable?, :module],
1803
+ [Process::GID, :re_exchangeable?, :module],
1804
+ [Process::UID, :sid_available?, :module],
1805
+ [Process::GID, :sid_available?, :module],
1806
+ #[Process::UID, :switch, :module], #p_uid_switch => rb_block_given_p
1807
+ #[Process::GID, :switch, :module], #p_gid_switch => rb_block_given_p
1808
+ [Process::Sys, :getuid, :module],
1809
+ [Process::Sys, :geteuid, :module],
1810
+ [Process::Sys, :getgid, :module],
1811
+ [Process::Sys, :getegid, :module],
1812
+ [Process::Sys, :setuid, :module],
1813
+ [Process::Sys, :setgid, :module],
1814
+ [Process::Sys, :setruid, :module],
1815
+ [Process::Sys, :setrgid, :module],
1816
+ [Process::Sys, :seteuid, :module],
1817
+ [Process::Sys, :setegid, :module],
1818
+ [Process::Sys, :setreuid, :module],
1819
+ [Process::Sys, :setregid, :module],
1820
+ [Process::Sys, :setresuid, :module],
1821
+ [Process::Sys, :setresgid, :module],
1822
+ [Process::Sys, :issetugid, :module],
1823
+ [Kernel, :load, :module],
1824
+ [Kernel, :load, :singleton],
1825
+ [Kernel, :require, :module],
1826
+ [Kernel, :require, :singleton],
1827
+ [Kernel, :require_relative, :module],
1828
+ [Kernel, :require_relative, :singleton],
1829
+ [Module, :autoload, :class],
1830
+ [Module, :autoload?, :class],
1831
+ [Kernel, :autoload, :module],
1832
+ [Kernel, :autoload, :singleton],
1833
+ [Kernel, :autoload?, :module],
1834
+ [Kernel, :autoload?, :singleton],
1835
+ [Proc, :new, :singleton],
1836
+ #[Proc, :call, :class], #proc_call => rb_block_given_p
1837
+ #[Proc, :[], :class], #proc_call => rb_block_given_p
1838
+ #[Proc, :===, :class], #proc_call => rb_block_given_p
1839
+ #[Proc, :yield, :class], #proc_call => rb_block_given_p
1840
+ [Proc, :to_proc, :class],
1841
+ [Proc, :arity, :class],
1842
+ [Proc, :clone, :class],
1843
+ [Proc, :dup, :class],
1844
+ [Proc, :==, :class],
1845
+ [Proc, :eql?, :class],
1846
+ [Proc, :hash, :class],
1847
+ [Proc, :to_s, :class],
1848
+ [Proc, :lambda?, :class],
1849
+ [Proc, :binding, :class],
1850
+ [Proc, :curry, :class],
1851
+ [Proc, :source_location, :class],
1852
+ [Proc, :parameters, :class],
1853
+ [LocalJumpError, :exit_value, :class],
1854
+ [LocalJumpError, :reason, :class],
1855
+ [Kernel, :proc, :module],
1856
+ [Kernel, :proc, :singleton],
1857
+ [Kernel, :lambda, :module],
1858
+ [Kernel, :lambda, :singleton],
1859
+ [Method, :==, :class],
1860
+ [Method, :eql?, :class],
1861
+ [Method, :hash, :class],
1862
+ [Method, :clone, :class],
1863
+ [Method, :call, :class],
1864
+ [Method, :[], :class],
1865
+ [Method, :arity, :class],
1866
+ [Method, :inspect, :class],
1867
+ [Method, :to_s, :class],
1868
+ [Method, :to_proc, :class],
1869
+ [Method, :receiver, :class],
1870
+ [Method, :name, :class],
1871
+ [Method, :owner, :class],
1872
+ [Method, :unbind, :class],
1873
+ [Method, :source_location, :class],
1874
+ [Method, :parameters, :class],
1875
+ [Kernel, :method, :module],
1876
+ [Kernel, :public_method, :module],
1877
+ [UnboundMethod, :==, :class],
1878
+ [UnboundMethod, :eql?, :class],
1879
+ [UnboundMethod, :hash, :class],
1880
+ [UnboundMethod, :clone, :class],
1881
+ [UnboundMethod, :arity, :class],
1882
+ [UnboundMethod, :inspect, :class],
1883
+ [UnboundMethod, :to_s, :class],
1884
+ [UnboundMethod, :name, :class],
1885
+ [UnboundMethod, :owner, :class],
1886
+ [UnboundMethod, :bind, :class],
1887
+ [UnboundMethod, :source_location, :class],
1888
+ [UnboundMethod, :parameters, :class],
1889
+ [Module, :instance_method, :class],
1890
+ [Module, :public_instance_method, :class],
1891
+ [Module, :define_method, :class],
1892
+ [Kernel, :define_singleton_method, :module],
1893
+ [Binding, :clone, :class],
1894
+ [Binding, :dup, :class],
1895
+ [Binding, :eval, :class],
1896
+ [Kernel, :binding, :module],
1897
+ [Kernel, :binding, :singleton],
1898
+ [Math, :atan2, :module],
1899
+ [Math, :atan2, :singleton],
1900
+ [Math, :cos, :module],
1901
+ [Math, :cos, :singleton],
1902
+ [Math, :sin, :module],
1903
+ [Math, :sin, :singleton],
1904
+ [Math, :tan, :module],
1905
+ [Math, :tan, :singleton],
1906
+ [Math, :acos, :module],
1907
+ [Math, :acos, :singleton],
1908
+ [Math, :asin, :module],
1909
+ [Math, :asin, :singleton],
1910
+ [Math, :atan, :module],
1911
+ [Math, :atan, :singleton],
1912
+ [Math, :cosh, :module],
1913
+ [Math, :cosh, :singleton],
1914
+ [Math, :sinh, :module],
1915
+ [Math, :sinh, :singleton],
1916
+ [Math, :tanh, :module],
1917
+ [Math, :tanh, :singleton],
1918
+ [Math, :acosh, :module],
1919
+ [Math, :acosh, :singleton],
1920
+ [Math, :asinh, :module],
1921
+ [Math, :asinh, :singleton],
1922
+ [Math, :atanh, :module],
1923
+ [Math, :atanh, :singleton],
1924
+ [Math, :exp, :module],
1925
+ [Math, :exp, :singleton],
1926
+ [Math, :log, :module],
1927
+ [Math, :log, :singleton],
1928
+ [Math, :log2, :module],
1929
+ [Math, :log2, :singleton],
1930
+ [Math, :log10, :module],
1931
+ [Math, :log10, :singleton],
1932
+ [Math, :sqrt, :module],
1933
+ [Math, :sqrt, :singleton],
1934
+ [Math, :cbrt, :module],
1935
+ [Math, :cbrt, :singleton],
1936
+ [Math, :frexp, :module],
1937
+ [Math, :frexp, :singleton],
1938
+ [Math, :ldexp, :module],
1939
+ [Math, :ldexp, :singleton],
1940
+ [Math, :hypot, :module],
1941
+ [Math, :hypot, :singleton],
1942
+ [Math, :erf, :module],
1943
+ [Math, :erf, :singleton],
1944
+ [Math, :erfc, :module],
1945
+ [Math, :erfc, :singleton],
1946
+ [Math, :gamma, :module],
1947
+ [Math, :gamma, :singleton],
1948
+ [Math, :lgamma, :module],
1949
+ [Math, :lgamma, :singleton],
1950
+ [GC, :start, :singleton],
1951
+ [GC, :enable, :singleton],
1952
+ [GC, :disable, :singleton],
1953
+ [GC, :stress, :singleton],
1954
+ [GC, :stress=, :singleton],
1955
+ [GC, :count, :singleton],
1956
+ [GC, :stat, :singleton],
1957
+ [GC, :garbage_collect, :module],
1958
+ #[ObjectSpace, :each_object, :module], #os_each_obj
1959
+ #[ObjectSpace, :each_object, :singleton], #os_each_obj
1960
+ [ObjectSpace, :garbage_collect, :module],
1961
+ [ObjectSpace, :garbage_collect, :singleton],
1962
+ [ObjectSpace, :define_finalizer, :module],
1963
+ [ObjectSpace, :define_finalizer, :singleton],
1964
+ [ObjectSpace, :undefine_finalizer, :module],
1965
+ [ObjectSpace, :undefine_finalizer, :singleton],
1966
+ [ObjectSpace, :_id2ref, :module],
1967
+ [ObjectSpace, :_id2ref, :singleton],
1968
+ [BasicObject, :__id__, :class],
1969
+ [Kernel, :object_id, :module],
1970
+ [ObjectSpace, :count_objects, :module],
1971
+ [ObjectSpace, :count_objects, :singleton],
1972
+ [Kernel, :to_enum, :module],
1973
+ [Kernel, :enum_for, :module],
1974
+ #[Enumerator, :initialize, :class], #enumerator_initialize => rb_block_given_p
1975
+ [Enumerator, :initialize_copy, :class],
1976
+ #[Enumerator, :each, :class], #enumerator_each => rb_block_given_p
1977
+ #[Enumerator, :each_with_index, :class], #enumerator_each_with_index => enumerator_with_index
1978
+ #[Enumerator, :each_with_object, :class], #enumerator_with_object
1979
+ #[Enumerator, :with_index, :class], #enumerator_with_index
1980
+ #[Enumerator, :with_object, :class], #enumerator_with_object
1981
+ [Enumerator, :next_values, :class],
1982
+ [Enumerator, :peek_values, :class],
1983
+ [Enumerator, :next, :class],
1984
+ [Enumerator, :peek, :class],
1985
+ [Enumerator, :feed, :class],
1986
+ [Enumerator, :rewind, :class],
1987
+ #[Enumerator, :inspect, :class], #rb_exec_recursive => recursive_list_access
1988
+ [StopIteration, :result, :class],
1989
+ #[Enumerator::Generator, :initialize, :class], #generator_initialize => rb_block_given_p
1990
+ [Enumerator::Generator, :initialize_copy, :class],
1991
+ [Enumerator::Generator, :each, :class],
1992
+ [Enumerator::Yielder, :initialize, :class],
1993
+ [Enumerator::Yielder, :yield, :class],
1994
+ [Enumerator::Yielder, :<<, :class],
1995
+ [RubyVM::InstructionSequence, :inspect, :class],
1996
+ [RubyVM::InstructionSequence, :disasm, :class],
1997
+ [RubyVM::InstructionSequence, :disassemble, :class],
1998
+ [RubyVM::InstructionSequence, :to_a, :class],
1999
+ [RubyVM::InstructionSequence, :eval, :class],
2000
+ [Thread, :new, :singleton],
2001
+ [Thread, :start, :singleton],
2002
+ [Thread, :fork, :singleton],
2003
+ [Thread, :main, :singleton],
2004
+ [Thread, :current, :singleton],
2005
+ [Thread, :stop, :singleton],
2006
+ [Thread, :kill, :singleton],
2007
+ [Thread, :exit, :singleton],
2008
+ [Thread, :pass, :singleton],
2009
+ [Thread, :list, :singleton],
2010
+ [Thread, :abort_on_exception, :singleton],
2011
+ [Thread, :abort_on_exception=, :singleton],
2012
+ #[Thread, :initialize, :class], #thread_initialize => rb_block_given_p
2013
+ [Thread, :raise, :class],
2014
+ [Thread, :join, :class],
2015
+ [Thread, :value, :class],
2016
+ [Thread, :kill, :class],
2017
+ [Thread, :terminate, :class],
2018
+ [Thread, :exit, :class],
2019
+ [Thread, :run, :class],
2020
+ [Thread, :wakeup, :class],
2021
+ [Thread, :[], :class],
2022
+ [Thread, :[]=, :class],
2023
+ [Thread, :key?, :class],
2024
+ [Thread, :keys, :class],
2025
+ [Thread, :priority, :class],
2026
+ [Thread, :priority=, :class],
2027
+ [Thread, :status, :class],
2028
+ [Thread, :alive?, :class],
2029
+ [Thread, :stop?, :class],
2030
+ [Thread, :abort_on_exception, :class],
2031
+ [Thread, :abort_on_exception=, :class],
2032
+ [Thread, :safe_level, :class],
2033
+ [Thread, :group, :class],
2034
+ [Thread, :backtrace, :class],
2035
+ [Thread, :inspect, :class],
2036
+ [ThreadGroup, :list, :class],
2037
+ [ThreadGroup, :enclose, :class],
2038
+ [ThreadGroup, :enclosed?, :class],
2039
+ [ThreadGroup, :add, :class],
2040
+ [Mutex, :initialize, :class],
2041
+ [Mutex, :locked?, :class],
2042
+ [Mutex, :try_lock, :class],
2043
+ [Mutex, :lock, :class],
2044
+ [Mutex, :unlock, :class],
2045
+ [Mutex, :sleep, :class],
2046
+ [Kernel, :set_trace_func, :module],
2047
+ [Kernel, :set_trace_func, :singleton],
2048
+ [Thread, :set_trace_func, :class],
2049
+ [Thread, :add_trace_func, :class],
2050
+ [Fiber, :yield, :singleton],
2051
+ [Fiber, :initialize, :class],
2052
+ [Fiber, :resume, :class],
2053
+ [Kernel, :Rational, :module],
2054
+ [Kernel, :Rational, :singleton],
2055
+ [Rational, :numerator, :class],
2056
+ [Rational, :denominator, :class],
2057
+ [Rational, :+, :class],
2058
+ [Rational, :-, :class],
2059
+ [Rational, :*, :class],
2060
+ [Rational, :/, :class],
2061
+ [Rational, :quo, :class],
2062
+ [Rational, :fdiv, :class],
2063
+ [Rational, :**, :class],
2064
+ [Rational, :<=>, :class],
2065
+ [Rational, :==, :class],
2066
+ [Rational, :coerce, :class],
2067
+ [Rational, :floor, :class],
2068
+ [Rational, :ceil, :class],
2069
+ [Rational, :truncate, :class],
2070
+ [Rational, :round, :class],
2071
+ [Rational, :to_i, :class],
2072
+ [Rational, :to_f, :class],
2073
+ [Rational, :to_r, :class],
2074
+ [Rational, :rationalize, :class],
2075
+ [Rational, :hash, :class],
2076
+ [Rational, :to_s, :class],
2077
+ [Rational, :inspect, :class],
2078
+ [Rational, :marshal_dump, :class],
2079
+ [Rational, :marshal_load, :class],
2080
+ [Integer, :gcd, :class],
2081
+ [Integer, :lcm, :class],
2082
+ [Integer, :gcdlcm, :class],
2083
+ [Numeric, :numerator, :class],
2084
+ [Numeric, :denominator, :class],
2085
+ [Integer, :numerator, :class],
2086
+ [Integer, :denominator, :class],
2087
+ #[Float, :numerator, :class], #rb_call_super => vm_call_super
2088
+ #[Float, :denominator, :class], #rb_call_super => vm_call_super
2089
+ [NilClass, :to_r, :class],
2090
+ [NilClass, :rationalize, :class],
2091
+ [Integer, :to_r, :class],
2092
+ [Integer, :rationalize, :class],
2093
+ [Float, :to_r, :class],
2094
+ [Float, :rationalize, :class],
2095
+ [String, :to_r, :class],
2096
+ [Rational, :convert, :singleton],
2097
+ [Complex, :rectangular, :singleton],
2098
+ [Complex, :rect, :singleton],
2099
+ [Complex, :polar, :singleton],
2100
+ [Kernel, :Complex, :module],
2101
+ [Kernel, :Complex, :singleton],
2102
+ [Complex, :real, :class],
2103
+ [Complex, :imaginary, :class],
2104
+ [Complex, :imag, :class],
2105
+ [Complex, :-@, :class],
2106
+ [Complex, :+, :class],
2107
+ [Complex, :-, :class],
2108
+ [Complex, :*, :class],
2109
+ [Complex, :/, :class],
2110
+ [Complex, :quo, :class],
2111
+ [Complex, :fdiv, :class],
2112
+ [Complex, :**, :class],
2113
+ [Complex, :==, :class],
2114
+ [Complex, :coerce, :class],
2115
+ [Complex, :abs, :class],
2116
+ [Complex, :magnitude, :class],
2117
+ [Complex, :abs2, :class],
2118
+ [Complex, :arg, :class],
2119
+ [Complex, :angle, :class],
2120
+ [Complex, :phase, :class],
2121
+ [Complex, :rectangular, :class],
2122
+ [Complex, :rect, :class],
2123
+ [Complex, :polar, :class],
2124
+ [Complex, :conjugate, :class],
2125
+ [Complex, :conj, :class],
2126
+ [Complex, :real?, :class],
2127
+ [Complex, :numerator, :class],
2128
+ [Complex, :denominator, :class],
2129
+ [Complex, :hash, :class],
2130
+ [Complex, :eql?, :class],
2131
+ [Complex, :to_s, :class],
2132
+ [Complex, :inspect, :class],
2133
+ [Complex, :marshal_dump, :class],
2134
+ [Complex, :marshal_load, :class],
2135
+ [Complex, :to_i, :class],
2136
+ [Complex, :to_f, :class],
2137
+ [Complex, :to_r, :class],
2138
+ [Complex, :rationalize, :class],
2139
+ [NilClass, :to_c, :class],
2140
+ [Numeric, :to_c, :class],
2141
+ [String, :to_c, :class],
2142
+ [Complex, :convert, :singleton],
2143
+ [Numeric, :real, :class],
2144
+ [Numeric, :imaginary, :class],
2145
+ [Numeric, :imag, :class],
2146
+ [Numeric, :abs2, :class],
2147
+ [Numeric, :arg, :class],
2148
+ [Numeric, :angle, :class],
2149
+ [Numeric, :phase, :class],
2150
+ [Numeric, :rectangular, :class],
2151
+ [Numeric, :rect, :class],
2152
+ [Numeric, :polar, :class],
2153
+ [Numeric, :conjugate, :class],
2154
+ [Numeric, :conj, :class],
2155
+ [Float, :arg, :class],
2156
+ [Float, :angle, :class],
2157
+ [Float, :phase, :class],
2158
+ ]
2159
+ DIRECT_CALL_TARGETS.map! do |(obj, mid, t)|
2160
+ case t
2161
+ when :class
2162
+ bug() unless obj.instance_of?(Class)
2163
+ MethodWrapper.new(ClassWrapper.new(obj, true), mid)
2164
+ when :module
2165
+ bug() unless obj.instance_of?(Module)
2166
+ MethodWrapper.new(ModuleWrapper.new(obj), mid)
2167
+ when :singleton
2168
+ MethodWrapper.new(ClassWrapper.new(obj, false), mid)
2169
+ else
2170
+ bug()
2171
+ end
2172
+ end
2173
+
2174
+ def should_be_call_directly?(klass, mid)
2175
+ bug() unless klass.is_a?(ClassWrapper)
2176
+ DIRECT_CALL_TARGETS.include?(MethodWrapper.new(klass, mid))
2177
+ end
2178
+
2179
+ CastOff::Compiler.class_eval do
2180
+ def should_be_call_directly(obj, mid, type)
2181
+ case type
2182
+ when :class
2183
+ bug() unless obj.instance_of?(Class)
2184
+ w = ClassWrapper.new(obj, true)
2185
+ when :module
2186
+ bug() unless obj.instance_of?(Module)
2187
+ w = ModuleWrapper.new(obj)
2188
+ when :singleton
2189
+ w = ClassWrapper.new(obj, false)
2190
+ else
2191
+ bug()
2192
+ end
2193
+ DIRECT_CALL_TARGETS.push(MethodWrapper.new(w, mid))
2194
+ end
2195
+ end
2196
+
2197
+ def side_effect?(klass, mid)
2198
+ # TODO override check
2199
+ bug() unless klass.is_a?(ClassWrapper)
2200
+ bug() unless mid.is_a?(Symbol)
2201
+ begin
2202
+ me = MethodWrapper.new(klass, mid)
2203
+ rescue CompileError
2204
+ return true
2205
+ end
2206
+ me = MethodInformations[me]
2207
+ return true unless me
2208
+ bug() unless me.instance_of?(MethodInformation)
2209
+ return true if me.side_effect?
2210
+ bug() if me.destroy_reciever? || me.destroy_arguments?
2211
+ false
2212
+ end
2213
+
2214
+ def harmless?(klass, mid, recv_p)
2215
+ bug() unless klass.is_a?(ClassWrapper)
2216
+ bug() unless mid.is_a?(Symbol)
2217
+ begin
2218
+ me = MethodWrapper.new(klass, mid)
2219
+ rescue CompileError
2220
+ return false
2221
+ end
2222
+ me = MethodInformations[me]
2223
+ return false unless me
2224
+ bug() unless me.instance_of?(MethodInformation)
2225
+ if recv_p
2226
+ return false if me.destroy_reciever?
2227
+ return false if me.escape_reciever?
2228
+ else
2229
+ return false if me.destroy_arguments?
2230
+ return false if me.escape_arguments?
2231
+ end
2232
+ true
2233
+ end
2234
+
2235
+ OPTION_TABLE = {
2236
+ # class_variable => [default_value, compare_target, define_extra_reader]
2237
+ :@@enable_inline_api => [true, true, false],
2238
+ :@@inject_guard => [true, true, false],
2239
+ :@@array_conservative => [true, true, false],
2240
+ :@@reuse_compiled_binary => [true, false, true],
2241
+ :@@allow_builtin_variable_incompatibility => [false, true, false],
2242
+ :@@prefetch_constant => [true, true, false],
2243
+ :@@deoptimize => [false, true, false],
2244
+ :@@development => [false, true, true],
2245
+ :@@alert_override => [true, true, false],
2246
+ :@@skip_configuration_check => [false, false, true],
2247
+
2248
+ # For base configuration
2249
+ :@@use_base_configuration => [true, false, true],
2250
+
2251
+ # For experiment
2252
+ :@@force_dispatch_method => [false, true, false],
2253
+ :@@force_duplicate_literal => [false, true, false],
2254
+ :@@force_inline_block => [false, true, false],
2255
+
2256
+ # Not implemented
2257
+ :@@enable_trace => [false, true, false],
2258
+ }
2259
+ OPTION_TABLE.dup.each do |(cvar, val)|
2260
+ OPTION_TABLE[cvar] = {
2261
+ :default_value => val[0],
2262
+ :compare_target => val[1],
2263
+ :define_extra_reader => val[2],
2264
+ }
2265
+ end
2266
+ OPTION_TABLE.freeze()
2267
+
2268
+ def same_option?(other_option)
2269
+ return false unless @option_table_configuration.size == other_option.size
2270
+ @option_table_configuration.each do |(cvar, val)|
2271
+ return false unless OPTION_TABLE.include?(cvar)
2272
+ return false unless other_option.include?(cvar)
2273
+ compare_target = OPTION_TABLE[cvar][:compare_target]
2274
+ bug() if compare_target.nil?
2275
+ next unless compare_target
2276
+ return false unless val == other_option[cvar]
2277
+ end
2278
+ true
2279
+ end
2280
+
2281
+ CastOff::Compiler.__send__(:define_method, :clear_settings) do
2282
+ OPTION_TABLE.each do |(cvar, val)|
2283
+ CastOff::Compiler::Configuration.class_variable_set(cvar, val[:default_value])
2284
+ end
2285
+ end
2286
+
2287
+ OPTION_TABLE.each do|(cvar, val)|
2288
+ mid = cvar.slice(2, cvar.size - 2)
2289
+ CastOff::Compiler.__send__(:define_method, mid) do |bool|
2290
+ CastOff::Compiler::Configuration.class_variable_set(cvar, bool)
2291
+ end
2292
+
2293
+ define_method(mid) do |val|
2294
+ @option_table_configuration[cvar] = val
2295
+ end
2296
+
2297
+ define_method("#{mid}?") do
2298
+ @option_table_configuration[cvar]
2299
+ end
2300
+
2301
+ next unless val[:define_extra_reader]
2302
+
2303
+ CastOff::Compiler.__send__(:define_method, "#{mid}?") do
2304
+ CastOff::Compiler::Configuration.class_variable_get(cvar)
2305
+ end
2306
+ end
2307
+
2308
+ MethodInformations = {}
2309
+ CastOff::Compiler.module_eval do
2310
+ def use_default_configuration()
2311
+ MethodInformation.use_builtin_library_information()
2312
+ end
2313
+
2314
+ def set_method_information(km, mid, type, info)
2315
+ case type
2316
+ when :class
2317
+ raise(ArgumentError.new("invalid first argument #{km}")) unless km.is_a?(Class)
2318
+ w = ClassWrapper.new(km, true)
2319
+ when :module
2320
+ raise(ArgumentError.new("invalid first argument #{km}")) unless km.is_a?(Module)
2321
+ w = ModuleWrapper.new(km)
2322
+ when :singleton
2323
+ w = ClassWrapper.new(km, false)
2324
+ else
2325
+ raise(ArgumentError.new("invalid argument"))
2326
+ end
2327
+ begin
2328
+ me = MethodWrapper.new(w, mid)
2329
+ rescue CompileError => e
2330
+ raise(ArgumentError.new(e.message))
2331
+ end
2332
+ MethodInformations[me] = MethodInformation.new(me, info)
2333
+ end
2334
+ end
2335
+
2336
+ def check_method_information_usage()
2337
+ @method_information_usage.each do |me0|
2338
+ me1 = MethodInformations[me0.method]
2339
+ return false unless me1
2340
+ return false unless me0 == me1
2341
+ end
2342
+ true
2343
+ end
2344
+
2345
+ def use_method_information(klass, mid)
2346
+ bug() unless klass.is_a?(ClassWrapper)
2347
+ bug() unless mid.is_a?(Symbol)
2348
+ begin
2349
+ me = MethodWrapper.new(klass, mid)
2350
+ rescue CompileError
2351
+ return false
2352
+ end
2353
+ me = MethodInformations[me]
2354
+ return false unless me
2355
+ bug() unless me.instance_of?(MethodInformation)
2356
+ @method_information_usage |= [me]
2357
+ true
2358
+ end
2359
+
2360
+ private
2361
+
2362
+ def invalid_configuration(message = "Invalid configuration")
2363
+ raise(InvalidConfigurationError, message)
2364
+ end
2365
+ end
2366
+ end
2367
+ end
2368
+