cast_off 0.2.1 → 0.2.3

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 (59) hide show
  1. data/README +40 -19
  2. data/README.en +0 -1
  3. data/bin/CastOff +7 -6
  4. data/cast_off.gemspec +2 -2
  5. data/ext/cast_off/cast_off.c.rb +118 -21
  6. data/ext/cast_off/depend +68 -39
  7. data/ext/cast_off/generated_c_include/iter_api.h +1 -1
  8. data/ext/cast_off/generated_c_include/vm_api.h +90 -7
  9. data/ext/cast_off/ruby_source/1.9.2/debug.h +36 -0
  10. data/ext/cast_off/ruby_source/1.9.2/eval_intern.h +232 -0
  11. data/ext/cast_off/ruby_source/1.9.2/gc.h +77 -0
  12. data/ext/cast_off/ruby_source/1.9.2/id.h +170 -0
  13. data/ext/cast_off/ruby_source/{insns.inc → 1.9.2/insns.inc} +0 -0
  14. data/ext/cast_off/ruby_source/{insns_info.inc → 1.9.2/insns_info.inc} +0 -0
  15. data/ext/cast_off/ruby_source/1.9.2/iseq.h +104 -0
  16. data/ext/cast_off/ruby_source/{manual_update.h → 1.9.2/manual_update.h} +0 -0
  17. data/ext/cast_off/ruby_source/1.9.2/method.h +103 -0
  18. data/ext/cast_off/ruby_source/1.9.2/node.h +483 -0
  19. data/ext/cast_off/ruby_source/1.9.2/thread_pthread.h +27 -0
  20. data/ext/cast_off/ruby_source/1.9.2/thread_win32.h +33 -0
  21. data/ext/cast_off/ruby_source/1.9.2/vm_core.h +707 -0
  22. data/ext/cast_off/ruby_source/1.9.2/vm_exec.h +184 -0
  23. data/ext/cast_off/ruby_source/1.9.2/vm_insnhelper.c +1721 -0
  24. data/ext/cast_off/ruby_source/1.9.2/vm_insnhelper.h +208 -0
  25. data/ext/cast_off/ruby_source/1.9.2/vm_opts.h +51 -0
  26. data/ext/cast_off/ruby_source/{atomic.h → 1.9.3/atomic.h} +0 -0
  27. data/ext/cast_off/ruby_source/{constant.h → 1.9.3/constant.h} +0 -0
  28. data/ext/cast_off/ruby_source/{debug.h → 1.9.3/debug.h} +0 -0
  29. data/ext/cast_off/ruby_source/{eval_intern.h → 1.9.3/eval_intern.h} +0 -0
  30. data/ext/cast_off/ruby_source/{gc.h → 1.9.3/gc.h} +0 -0
  31. data/ext/cast_off/ruby_source/{id.h → 1.9.3/id.h} +0 -0
  32. data/ext/cast_off/ruby_source/1.9.3/insns.inc +179 -0
  33. data/ext/cast_off/ruby_source/1.9.3/insns_info.inc +695 -0
  34. data/ext/cast_off/ruby_source/{internal.h → 1.9.3/internal.h} +0 -0
  35. data/ext/cast_off/ruby_source/{iseq.h → 1.9.3/iseq.h} +0 -0
  36. data/ext/cast_off/ruby_source/1.9.3/manual_update.h +135 -0
  37. data/ext/cast_off/ruby_source/{method.h → 1.9.3/method.h} +0 -0
  38. data/ext/cast_off/ruby_source/{node.h → 1.9.3/node.h} +0 -0
  39. data/ext/cast_off/ruby_source/{thread_pthread.h → 1.9.3/thread_pthread.h} +0 -0
  40. data/ext/cast_off/ruby_source/{thread_win32.h → 1.9.3/thread_win32.h} +0 -0
  41. data/ext/cast_off/ruby_source/{vm_core.h → 1.9.3/vm_core.h} +0 -0
  42. data/ext/cast_off/ruby_source/{vm_exec.h → 1.9.3/vm_exec.h} +0 -0
  43. data/ext/cast_off/ruby_source/{vm_insnhelper.c → 1.9.3/vm_insnhelper.c} +0 -0
  44. data/ext/cast_off/ruby_source/{vm_insnhelper.h → 1.9.3/vm_insnhelper.h} +0 -0
  45. data/ext/cast_off/ruby_source/{vm_opts.h → 1.9.3/vm_opts.h} +0 -0
  46. data/lib/cast_off/compile.rb +118 -68
  47. data/lib/cast_off/compile/basicblock.rb +3 -1
  48. data/lib/cast_off/compile/cfg.rb +0 -2
  49. data/lib/cast_off/compile/code_manager.rb +36 -7
  50. data/lib/cast_off/compile/configuration.rb +18 -13
  51. data/lib/cast_off/compile/dependency.rb +32 -11
  52. data/lib/cast_off/compile/information.rb +10 -6
  53. data/lib/cast_off/compile/instruction.rb +0 -11
  54. data/lib/cast_off/compile/ir/call_ir.rb +27 -5
  55. data/lib/cast_off/compile/ir/operand.rb +54 -34
  56. data/lib/cast_off/compile/ir/simple_ir.rb +6 -8
  57. data/lib/cast_off/compile/translator.rb +9 -0
  58. metadata +41 -25
  59. data/ext/cast_off/cast_off.h +0 -24
data/README CHANGED
@@ -19,8 +19,11 @@ Ruby 処理系のライセンスに従います。
19
19
  * インストール方法
20
20
  $gem install cast_off
21
21
 
22
- 現時点での実装は Ruby1.9.3 VM の実装に強く依存しているため、Ruby1.9.3 のみ対応しています。
23
- 他のバージョンの Ruby 処理系では、動作しないため、ご注意ください。
22
+ CastOff Ruby 処理系に一切手をくわえることなく、Ruby 処理系の拡張ライブラリとして実装しています。
23
+ このため、gem コマンド経由で容易にインストールすることができます。
24
+ ただし、脱最適化などの処理が処理系の実装依存になっているため、Ruby 1.9.3 のみの対応となっています。
25
+ 一応 Ruby 1.9.2 でも動作はしますが、Ruby 1.9.3 よりも不安定かもしれません。
26
+ Ruby1.9.2 と Ruby1.9.3 以外のバージョンの Ruby 処理系では、動作しないため、ご注意ください。
24
27
 
25
28
 
26
29
 
@@ -79,27 +82,46 @@ CastOff は Ruby で実装しており、実装コストの兼ね合いから、
79
82
  CastOff がコンパイル済みコードを読み込むためには、コンパイルしたメソッドが定義されている必要があります。
80
83
  メソッドを定義し終わるまでは、コンパイル済みコードを読み込むことはできません。
81
84
 
82
- CastOff をコマンドラインから利用した場合、CastOff は、クラス定義文をフックし、
85
+ CastOff をコマンドラインから利用した場合、CastOff は、クラス定義とメソッド定義をフックし、
83
86
  コンパイルしたメソッドが定義済みかどうかを確認します。
84
87
  そして、コンパイルしたメソッドが定義済みだった場合、コンパイル済みコードを読み込みます。
85
- このため、次の bar メソッドのように、定義後にクラス定義文が無いようなメソッドは、
86
- 明示的に指定しない限りコンパイル済みコードは読み込まれません。
87
- このような場合には、メソッドの定義後に、明示的に CastOff.autoload もしくは CastOff.load を呼び出してください。
88
-
89
- -----------------------------------------------------
90
- class Foo # クラス定義文終了時に、Foo#foo のコンパイル済みコードが読み込まれる
91
- def foo
92
- ...
88
+ メソッド定義のフックには、BasicObject.method_added を使用しています。
89
+ コンパイル対象のスクリプト内で method_added を使用している場合、
90
+ (特に Ruby 1.9.2 では)コンパイル済みコードが正常に読み込まれない可能性があります。
91
+
92
+
93
+ ** 特異メソッドの取り扱い
94
+ CastOff は、インスタンスメソッドと特異メソッド両方のコンパイルを扱えますが、
95
+ 基本的にインスタンスメソッドのコンパイルの方が得意です。
96
+ なるべく特異メソッドに対しては CastOff を使用しないことをおすすめします。
97
+
98
+ 得意メソッドの取り扱いが苦手なのは、特異クラスが Marshal.dump に対応していないためです。
99
+ CastOff は、コンパイル時に扱った情報を Marshal.dump で保存し、ロード時に Marshal.load で読み込みます。
100
+ 特異クラスは Marshal で取り扱うことができないため、特異クラスの情報は、
101
+ 無かったものとして扱うことになります。このため、特異メソッドのコンパイルでは、
102
+ self に関する型情報を扱うことができず、(特異メソッドの self が内部的に参照するクラスは特異クラスであるため)
103
+ インスタンスメソッドのコンパイルと比較して遅くなってしまいます。
104
+
105
+ 例えば、次の2つのスクリプト A, B を CastOff でコンパイルし、実行時間を比較した場合、
106
+ 32bit GNU/Linux GCC4.4.1 の環境では、A の方が B よりも約3.5倍高速です。
107
+
108
+ ------------------------------------------------------
109
+ # スクリプト A
110
+ class Fib
111
+ def fib n
112
+ (n < 3) ? 1 : (fib(n-1) + fib(n-2))
93
113
  end
94
114
  end
115
+ Fib.new.fib(40)
116
+ ------------------------------------------------------
95
117
 
96
- def bar() # 以降、クラス定義文が無いので、bar のコンパイル済みコードは読み込まれない
97
- ...
118
+ ------------------------------------------------------
119
+ # スクリプト B
120
+ def fib n
121
+ (n < 3) ? 1 : (fib(n-1) + fib(n-2))
98
122
  end
99
-
100
- # 以下、クラス定義文は無し
101
- -----------------------------------------------------
102
-
123
+ fib(40)
124
+ ------------------------------------------------------
103
125
 
104
126
 
105
127
  * CastOff の利用方法
@@ -209,7 +231,6 @@ CastOff [options] [programfile] [arguments]
209
231
 
210
232
  --deoptimize
211
233
  脱最適化を有効にします。
212
- 現在、ブロックを用いたメソッドの脱最適化には対応していないので、ご注意ください。
213
234
 
214
235
  --clear
215
236
  プロファイル結果やコンパイル結果を削除します。
@@ -498,7 +519,7 @@ CastOff に与えるコンパイル条件が決定した場合は、このオプ
498
519
 
499
520
  --コンパイル済みコードの再利用
500
521
  ---指定方法
501
- CastOff.reuse_compiled_binary(true or false)
522
+ CastOff.reuse_compiled_code(true or false)
502
523
  ---デフォルト値
503
524
  true
504
525
  ---備考
data/README.en CHANGED
@@ -142,7 +142,6 @@ Show compilation progress and internal information.
142
142
 
143
143
  --deoptimize
144
144
  Enable deoptimization.
145
- (Currently, CastOff does not support deoptimization of methods which use block.)
146
145
 
147
146
  --clear
148
147
  Clear profile information and delete compiled methods.
@@ -103,30 +103,31 @@ CastOff.verbose(verbose)
103
103
 
104
104
  case step
105
105
  when nil
106
- STDERR.puts("-------------------------------- compilation start, threshold = #{threshold}, name = #{name}: #{args} --------------------------------")
106
+ STDERR.puts("-------------------------------- compilation start: threshold = #{threshold}, name = #{name}, profiling = ruby #{args} --------------------------------")
107
107
  2.times{|i| system("#{this} --step-#{i + 1} --threshold=#{threshold} --name=#{name} #{deoptimize ? '--deoptimize' : ''} #{verbose ? '--verbose' : ''} #{args}")}
108
108
  when '1'
109
- STDERR.puts("-------------------------------- step 1 --------------------------------")
109
+ STDERR.puts("-------------------------------- step 1 --------------------------------") if verbose
110
110
  CastOff.development(true)
111
111
  CastOff.use_base_configuration(false)
112
112
  CastOff.autocompile()
113
113
  when '2'
114
- STDERR.puts("-------------------------------- step 2 --------------------------------")
114
+ STDERR.puts("-------------------------------- step 2 --------------------------------") if verbose
115
115
  CastOff.development(true)
116
116
  CastOff.use_base_configuration(false)
117
117
  CastOff.autoload()
118
- #fin = Object.new
119
- #ObjectSpace.define_finalizer(fin){
120
118
  at_exit{
121
119
  CastOff.development(false)
122
120
  CastOff.use_base_configuration(true)
123
121
  # step 3
124
122
  CastOff.load(true)
123
+ }
124
+ fin = Object.new
125
+ ObjectSpace.define_finalizer(fin){
125
126
  msg = <<-EOS
126
127
 
127
128
  ----------------------------------------------------------------------------------------
128
129
  Compilation finished successfully.
129
- Please add following lines to #{script}.
130
+ Please add following lines to top of #{script}.
130
131
 
131
132
  require 'cast_off'
132
133
  #{configuration.chomp}
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "cast_off"
3
- spec.version = "0.2.1"
3
+ spec.version = "0.2.3"
4
4
  spec.platform = Gem::Platform::RUBY
5
5
  spec.summary = "Performance improvement tool for Ruby1.9.3"
6
6
  spec.description = <<-EOS
@@ -20,6 +20,6 @@ CastOff is a performance improvement tool for Ruby1.9.3
20
20
  spec.email = 'shiba@rvm.jp'
21
21
  spec.homepage = 'http://github.com/soba1104/CastOff'
22
22
  #spec.rubyforge_project = 'cast_off'
23
- spec.required_ruby_version = '= 1.9.3'
23
+ spec.required_ruby_version = '>= 1.9.2'
24
24
  end
25
25
 
@@ -1,8 +1,8 @@
1
1
  #if 1
2
2
  #define __END__ /* void */
3
3
  #else
4
- ruby_srcdir = ARGV[0];
5
- generated_c_include = ARGV[1];
4
+ ruby_srcdir = ARGV[0].dup;
5
+ generated_c_include = ARGV[1].dup;
6
6
  srcdir = File.dirname(__FILE__)
7
7
  require("erb");
8
8
  require('rbconfig');
@@ -12,7 +12,40 @@ ERB.new(DATA.read(), 0, "%-").run();
12
12
  #endif
13
13
  __END__
14
14
 
15
- #include <cast_off.h>
15
+ % case RUBY_VERSION
16
+ % when "1.9.2"
17
+ % ruby_srcdir_prefix = "1.9.2"
18
+ % when "1.9.3"
19
+ % ruby_srcdir_prefix = "1.9.3"
20
+ % else
21
+ % raise("Unsupported ruby version #{RUBY_VERSION}")
22
+ % end
23
+ % ruby_srcdir.concat("/#{ruby_srcdir_prefix}")
24
+
25
+ #include <ruby.h>
26
+
27
+ #include "<%= ruby_srcdir_prefix %>/vm_core.h"
28
+ #include "<%= ruby_srcdir_prefix %>/eval_intern.h"
29
+ #include "<%= ruby_srcdir_prefix %>/iseq.h"
30
+ #include "<%= ruby_srcdir_prefix %>/gc.h"
31
+ #include <ruby/vm.h>
32
+ #include <ruby/encoding.h>
33
+ #include "<%= ruby_srcdir_prefix %>/vm_insnhelper.h"
34
+ #include "<%= ruby_srcdir_prefix %>/vm_insnhelper.c"
35
+ #include "<%= ruby_srcdir_prefix %>/vm_exec.h"
36
+
37
+ #ifdef USE_INSN_STACK_INCREASE
38
+ #undef USE_INSN_STACK_INCREASE
39
+ #endif
40
+ #define USE_INSN_STACK_INCREASE 1
41
+
42
+ #ifdef USE_INSN_RET_NUM
43
+ #undef USE_INSN_RET_NUM
44
+ #endif
45
+ #define USE_INSN_RET_NUM 1
46
+
47
+ #include "<%= ruby_srcdir_prefix %>/insns_info.inc"
48
+ #include "<%= ruby_srcdir_prefix %>/manual_update.h"
16
49
 
17
50
  VALUE rb_eCastOffCompileError;
18
51
  VALUE rb_eCastOffExecutionError;
@@ -49,10 +82,8 @@ gen_headers(void)
49
82
  % vm_opts.h
50
83
  % insns_info.inc
51
84
  % insns.inc
52
- % atomic.h
53
- % internal.h
54
85
  % manual_update.h
55
- % ].map{|f| [ruby_srcdir, f ]} + %w[
86
+ % ].map{|f| [ruby_srcdir, f]} + %w[
56
87
  % iter_api.h
57
88
  % vm_api.h
58
89
  % inline_api.h
@@ -61,10 +92,12 @@ gen_headers(void)
61
92
  % case RUBY_VERSION
62
93
  % when "1.9.2"
63
94
  % # nothing to do
64
- % when "1.9.3", "1.9.4"
95
+ % when "1.9.3"
65
96
  % files << [ruby_srcdir, "constant.h"]
97
+ % files << [ruby_srcdir, "atomic.h"]
98
+ % files << [ruby_srcdir, "internal.h"]
66
99
  % else
67
- % raise("unsupported ruby version #{RUBY_VERSION}")
100
+ % raise("Unsupported ruby version #{RUBY_VERSION}")
68
101
  % end
69
102
  %data = Marshal.dump files.inject({}){|r, i|
70
103
  % dir, file = i
@@ -278,6 +311,18 @@ cast_off_instruction_class_information_in_ic(VALUE self, VALUE iseqval)
278
311
  }
279
312
  }
280
313
 
314
+ static void method_not_found(VALUE km, ID mid, int class_p)
315
+ {
316
+ VALUE name;
317
+
318
+ if (class_p) {
319
+ name = rb_class_path(km);
320
+ } else {
321
+ name = rb_mod_name(km);
322
+ }
323
+ rb_raise(rb_eCastOffCompileError, "method not found (%s#%s)", RSTRING_PTR(name), rb_id2name(mid));
324
+ }
325
+
281
326
  static VALUE cast_off_override_target(VALUE self, VALUE km, VALUE msym)
282
327
  {
283
328
  ID mid;
@@ -302,14 +347,7 @@ static VALUE cast_off_override_target(VALUE self, VALUE km, VALUE msym)
302
347
  me = search_method(km, mid);
303
348
 
304
349
  if (!me) {
305
- VALUE name;
306
-
307
- if (class) {
308
- name = rb_class_path(km);
309
- } else {
310
- name = rb_mod_name(km);
311
- }
312
- rb_raise(rb_eCastOffCompileError, "method not found (%s#%s)", RSTRING_PTR(name), rb_id2name(mid));
350
+ method_not_found(km, mid, class);
313
351
  }
314
352
 
315
353
  target = me->klass;
@@ -332,7 +370,7 @@ static VALUE cast_off_get_iseq(VALUE self, VALUE obj, VALUE mid, VALUE singleton
332
370
  rb_method_definition_t *def;
333
371
  VALUE km;
334
372
  int class;
335
- char *msg = NULL;
373
+ const char *msg = NULL;
336
374
  VALUE name;
337
375
 
338
376
  if (singleton_p == Qtrue) {
@@ -479,7 +517,9 @@ static size_t cast_off_class_wrapper_memsize(const void *wrapper)
479
517
 
480
518
  static const rb_data_type_t cast_off_class_wrapper_data_type = {
481
519
  "cast_off_class_wrapper",
482
- {cast_off_class_wrapper_mark, cast_off_class_wrapper_free, cast_off_class_wrapper_memsize},
520
+ cast_off_class_wrapper_mark,
521
+ cast_off_class_wrapper_free,
522
+ cast_off_class_wrapper_memsize,
483
523
  };
484
524
 
485
525
  static VALUE cast_off_allocate_class_wrapper(VALUE klass)
@@ -747,6 +787,45 @@ static VALUE cast_off_class_wrapper_contain_object(VALUE self)
747
787
  }
748
788
  }
749
789
 
790
+ static VALUE cast_off_class_wrapper_each_method_search_target(VALUE self, VALUE midsym)
791
+ {
792
+ class_wrapper_t *wrapper = cast_off_class_wrapper_get_wrapper(self);
793
+ VALUE klass = wrapper->klass;
794
+ ID mid = SYM2ID(midsym);
795
+
796
+ if (rb_obj_class(midsym) != rb_cSymbol || rb_obj_class(klass) != rb_cClass) {
797
+ rb_bug("cast_off_class_wrapper_each_method_search_target: should not be reached(0)");
798
+ }
799
+
800
+ while (1) {
801
+ st_data_t body;
802
+
803
+ if (!klass) {
804
+ method_not_found(wrapper->klass, mid, 1);
805
+ }
806
+ if (TYPE(klass) == T_ICLASS) {
807
+ VALUE module = RBASIC(klass)->klass;
808
+ if (TYPE(module) != T_MODULE) {
809
+ rb_bug("cast_off_class_wrapper_each_method_search_target: should not be reached(1)");
810
+ }
811
+ rb_yield(module);
812
+ } else if (TYPE(klass) == T_CLASS) {
813
+ if (FL_TEST(klass, FL_SINGLETON)) {
814
+ rb_bug("cast_off_class_wrapper_each_method_search_target: should not be reached(2)");
815
+ }
816
+ rb_yield(klass);
817
+ } else {
818
+ rb_bug("cast_off_class_wrapper_each_method_search_target: should not be reached(3)");
819
+ }
820
+ if(st_lookup(RCLASS_M_TBL(klass), mid, &body)) {
821
+ break;
822
+ }
823
+ klass = RCLASS_SUPER(klass);
824
+ }
825
+
826
+ return Qtrue;
827
+ }
828
+
750
829
  #define define_type_checker(klass) \
751
830
  static VALUE cast_off_class_wrapper_##klass##_p(VALUE self) \
752
831
  { \
@@ -786,7 +865,9 @@ static size_t cast_off_module_wrapper_memsize(const void *wrapper)
786
865
 
787
866
  static const rb_data_type_t cast_off_module_wrapper_data_type = {
788
867
  "cast_off_module_wrapper",
789
- {cast_off_module_wrapper_mark, cast_off_module_wrapper_free, cast_off_module_wrapper_memsize},
868
+ cast_off_module_wrapper_mark,
869
+ cast_off_module_wrapper_free,
870
+ cast_off_module_wrapper_memsize,
790
871
  };
791
872
 
792
873
  static VALUE cast_off_allocate_module_wrapper(VALUE klass)
@@ -911,7 +992,9 @@ static size_t cast_off_method_wrapper_memsize(const void *wrapper)
911
992
 
912
993
  static const rb_data_type_t cast_off_method_wrapper_data_type = {
913
994
  "cast_off_method_wrapper",
914
- {cast_off_method_wrapper_mark, cast_off_method_wrapper_free, cast_off_method_wrapper_memsize},
995
+ cast_off_method_wrapper_mark,
996
+ cast_off_method_wrapper_free,
997
+ cast_off_method_wrapper_memsize,
915
998
  };
916
999
 
917
1000
  static VALUE cast_off_allocate_method_wrapper(VALUE klass)
@@ -1193,7 +1276,9 @@ static void cast_off_method_invocation_handler(rb_event_flag_t event, VALUE proc
1193
1276
  argv[5] = klass ? klass : Qnil;
1194
1277
  argv[6] = caller_info(th);
1195
1278
 
1196
- return rb_proc_call_with_block(proc, 7, argv, Qnil);
1279
+ rb_proc_call_with_block(proc, 7, argv, Qnil);
1280
+
1281
+ return;
1197
1282
  }
1198
1283
 
1199
1284
  static VALUE cast_off_hook_method_invocation(VALUE self, VALUE proc)
@@ -1318,6 +1403,17 @@ void Init_cast_off(void)
1318
1403
  rb_define_const(rb_mCastOffCompilerInstruction, "THROW_TAG_RAISE", LONG2FIX(TAG_RAISE));
1319
1404
  rb_define_const(rb_mCastOffCompilerInstruction, "THROW_TAG_THROW", LONG2FIX(TAG_THROW));
1320
1405
  rb_define_const(rb_mCastOffCompilerInstruction, "THROW_TAG_FATAL", LONG2FIX(TAG_FATAL));
1406
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_IVAR", LONG2FIX(DEFINED_IVAR));
1407
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_IVAR2", LONG2FIX(DEFINED_IVAR2));
1408
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_GVAR", LONG2FIX(DEFINED_GVAR));
1409
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_CVAR", LONG2FIX(DEFINED_CVAR));
1410
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_CONST", LONG2FIX(DEFINED_CONST));
1411
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_METHOD", LONG2FIX(DEFINED_METHOD));
1412
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_YIELD", LONG2FIX(DEFINED_YIELD));
1413
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_REF", LONG2FIX(DEFINED_REF));
1414
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_ZSUPER", LONG2FIX(DEFINED_ZSUPER));
1415
+ rb_define_const(rb_mCastOffCompilerInstruction, "DEFINED_FUNC", LONG2FIX(DEFINED_FUNC));
1416
+
1321
1417
  rb_define_method(rb_cCastOffInsnInfo, "instruction_pushnum", cast_off_instruction_pushnum, 1);
1322
1418
  rb_define_method(rb_cCastOffInsnInfo, "instruction_popnum", cast_off_instruction_popnum, 1);
1323
1419
  rb_define_method(rb_cCastOffInsnInfo, "instruction_stack_usage", cast_off_instruction_stack_usage, 1);
@@ -1339,6 +1435,7 @@ void Init_cast_off(void)
1339
1435
  rb_define_method(rb_cCastOffClassWrapper, "instance_method_exist?", cast_off_class_wrapper_instance_method_exist_p, 1);
1340
1436
  rb_define_method(rb_cCastOffClassWrapper, "contain_class", cast_off_class_wrapper_contain_class, 0);
1341
1437
  rb_define_method(rb_cCastOffClassWrapper, "contain_object", cast_off_class_wrapper_contain_object, 0);
1438
+ rb_define_method(rb_cCastOffClassWrapper, "each_method_search_target", cast_off_class_wrapper_each_method_search_target, 1);
1342
1439
  //#define register_type_checker(klass) rb_define_method(rb_cCastOffClassWrapper, "##klass##?", cast_off_class_wrapper_##klass##_p, 0)
1343
1440
  //register_type_checker(String);
1344
1441
  //register_type_checker(Array);
@@ -4,33 +4,49 @@ $(srcdir)/generated_c_include/unbox_api.h: \
4
4
 
5
5
 
6
6
  cast_off.c: \
7
- $(srcdir)/ruby_source/debug.h \
8
- $(srcdir)/ruby_source/gc.h \
9
- $(srcdir)/ruby_source/id.h \
10
- $(srcdir)/ruby_source/eval_intern.h \
11
- $(srcdir)/ruby_source/iseq.h \
12
- $(srcdir)/ruby_source/method.h \
13
- $(srcdir)/ruby_source/node.h \
14
- $(srcdir)/ruby_source/thread_pthread.h \
15
- $(srcdir)/ruby_source/thread_win32.h \
16
- $(srcdir)/ruby_source/vm_core.h \
17
- $(srcdir)/ruby_source/vm_exec.h \
18
- $(srcdir)/ruby_source/vm_insnhelper.c \
19
- $(srcdir)/ruby_source/vm_insnhelper.h \
20
- $(srcdir)/ruby_source/vm_opts.h \
21
- $(srcdir)/ruby_source/insns_info.inc \
22
- $(srcdir)/ruby_source/insns.inc \
23
- $(srcdir)/ruby_source/constant.h \
24
- $(srcdir)/ruby_source/atomic.h \
25
- $(srcdir)/ruby_source/internal.h \
26
- $(srcdir)/ruby_source/manual_update.h \
7
+ $(srcdir)/ruby_source/1.9.3/debug.h \
8
+ $(srcdir)/ruby_source/1.9.3/gc.h \
9
+ $(srcdir)/ruby_source/1.9.3/id.h \
10
+ $(srcdir)/ruby_source/1.9.3/eval_intern.h \
11
+ $(srcdir)/ruby_source/1.9.3/iseq.h \
12
+ $(srcdir)/ruby_source/1.9.3/method.h \
13
+ $(srcdir)/ruby_source/1.9.3/node.h \
14
+ $(srcdir)/ruby_source/1.9.3/thread_pthread.h \
15
+ $(srcdir)/ruby_source/1.9.3/thread_win32.h \
16
+ $(srcdir)/ruby_source/1.9.3/vm_core.h \
17
+ $(srcdir)/ruby_source/1.9.3/vm_exec.h \
18
+ $(srcdir)/ruby_source/1.9.3/vm_insnhelper.c \
19
+ $(srcdir)/ruby_source/1.9.3/vm_insnhelper.h \
20
+ $(srcdir)/ruby_source/1.9.3/vm_opts.h \
21
+ $(srcdir)/ruby_source/1.9.3/insns_info.inc \
22
+ $(srcdir)/ruby_source/1.9.3/insns.inc \
23
+ $(srcdir)/ruby_source/1.9.3/constant.h \
24
+ $(srcdir)/ruby_source/1.9.3/atomic.h \
25
+ $(srcdir)/ruby_source/1.9.3/internal.h \
26
+ $(srcdir)/ruby_source/1.9.3/manual_update.h \
27
+ $(srcdir)/ruby_source/1.9.2/debug.h \
28
+ $(srcdir)/ruby_source/1.9.2/gc.h \
29
+ $(srcdir)/ruby_source/1.9.2/id.h \
30
+ $(srcdir)/ruby_source/1.9.2/eval_intern.h \
31
+ $(srcdir)/ruby_source/1.9.2/iseq.h \
32
+ $(srcdir)/ruby_source/1.9.2/method.h \
33
+ $(srcdir)/ruby_source/1.9.2/node.h \
34
+ $(srcdir)/ruby_source/1.9.2/thread_pthread.h \
35
+ $(srcdir)/ruby_source/1.9.2/thread_win32.h \
36
+ $(srcdir)/ruby_source/1.9.2/vm_core.h \
37
+ $(srcdir)/ruby_source/1.9.2/vm_exec.h \
38
+ $(srcdir)/ruby_source/1.9.2/vm_insnhelper.c \
39
+ $(srcdir)/ruby_source/1.9.2/vm_insnhelper.h \
40
+ $(srcdir)/ruby_source/1.9.2/vm_opts.h \
41
+ $(srcdir)/ruby_source/1.9.2/insns_info.inc \
42
+ $(srcdir)/ruby_source/1.9.2/insns.inc \
43
+ $(srcdir)/ruby_source/1.9.2/manual_update.h \
27
44
  $(srcdir)/generated_c_include/iter_api.h \
28
45
  $(srcdir)/generated_c_include/vm_api.h \
29
46
  $(srcdir)/generated_c_include/inline_api.h \
30
47
  $(srcdir)/generated_c_include/unbox_api.h \
31
48
  $(srcdir)/generated_c_include/unbox_api.h.rb \
32
49
  $(srcdir)/extconf.h \
33
- $(srcdir)/cast_off.h \
34
50
  $(srcdir)/cast_off.c.rb
35
51
  $(RUBY) -- $(srcdir)/cast_off.c.rb $(srcdir)/ruby_source $(srcdir)/generated_c_include > $@
36
52
 
@@ -42,29 +58,42 @@ cast_off.o: \
42
58
  $(hdrdir)/ruby/missing.h \
43
59
  $(hdrdir)/ruby/ruby.h \
44
60
  $(hdrdir)/ruby/st.h \
45
- $(srcdir)/ruby_source/eval_intern.h \
46
- $(srcdir)/ruby_source/iseq.h \
47
- $(srcdir)/ruby_source/method.h \
48
- $(srcdir)/ruby_source/node.h \
49
- $(srcdir)/ruby_source/thread_pthread.h \
50
- $(srcdir)/ruby_source/thread_win32.h \
51
- $(srcdir)/ruby_source/vm_core.h \
52
- $(srcdir)/ruby_source/vm_exec.h \
53
- $(srcdir)/ruby_source/vm_insnhelper.c \
54
- $(srcdir)/ruby_source/vm_insnhelper.h \
55
- $(srcdir)/ruby_source/vm_opts.h \
56
- $(srcdir)/ruby_source/insns_info.inc \
57
- $(srcdir)/ruby_source/insns.inc \
58
- $(srcdir)/ruby_source/constant.h \
59
- $(srcdir)/ruby_source/atomic.h \
60
- $(srcdir)/ruby_source/internal.h \
61
- $(srcdir)/ruby_source/manual_update.h \
61
+ $(srcdir)/ruby_source/1.9.3/eval_intern.h \
62
+ $(srcdir)/ruby_source/1.9.3/iseq.h \
63
+ $(srcdir)/ruby_source/1.9.3/method.h \
64
+ $(srcdir)/ruby_source/1.9.3/node.h \
65
+ $(srcdir)/ruby_source/1.9.3/thread_pthread.h \
66
+ $(srcdir)/ruby_source/1.9.3/thread_win32.h \
67
+ $(srcdir)/ruby_source/1.9.3/vm_core.h \
68
+ $(srcdir)/ruby_source/1.9.3/vm_exec.h \
69
+ $(srcdir)/ruby_source/1.9.3/vm_insnhelper.c \
70
+ $(srcdir)/ruby_source/1.9.3/vm_insnhelper.h \
71
+ $(srcdir)/ruby_source/1.9.3/vm_opts.h \
72
+ $(srcdir)/ruby_source/1.9.3/insns_info.inc \
73
+ $(srcdir)/ruby_source/1.9.3/insns.inc \
74
+ $(srcdir)/ruby_source/1.9.3/constant.h \
75
+ $(srcdir)/ruby_source/1.9.3/atomic.h \
76
+ $(srcdir)/ruby_source/1.9.3/internal.h \
77
+ $(srcdir)/ruby_source/1.9.3/manual_update.h \
78
+ $(srcdir)/ruby_source/1.9.2/eval_intern.h \
79
+ $(srcdir)/ruby_source/1.9.2/iseq.h \
80
+ $(srcdir)/ruby_source/1.9.2/method.h \
81
+ $(srcdir)/ruby_source/1.9.2/node.h \
82
+ $(srcdir)/ruby_source/1.9.2/thread_pthread.h \
83
+ $(srcdir)/ruby_source/1.9.2/thread_win32.h \
84
+ $(srcdir)/ruby_source/1.9.2/vm_core.h \
85
+ $(srcdir)/ruby_source/1.9.2/vm_exec.h \
86
+ $(srcdir)/ruby_source/1.9.2/vm_insnhelper.c \
87
+ $(srcdir)/ruby_source/1.9.2/vm_insnhelper.h \
88
+ $(srcdir)/ruby_source/1.9.2/vm_opts.h \
89
+ $(srcdir)/ruby_source/1.9.2/insns_info.inc \
90
+ $(srcdir)/ruby_source/1.9.2/insns.inc \
91
+ $(srcdir)/ruby_source/1.9.2/manual_update.h \
62
92
  $(srcdir)/generated_c_include/iter_api.h \
63
93
  $(srcdir)/generated_c_include/vm_api.h \
64
94
  $(srcdir)/generated_c_include/inline_api.h \
65
95
  $(srcdir)/generated_c_include/unbox_api.h \
66
96
  $(srcdir)/generated_c_include/unbox_api.h.rb \
67
97
  $(srcdir)/extconf.h \
68
- $(srcdir)/cast_off.h \
69
98
  $(srcdir)/cast_off.c
70
99