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
@@ -130,7 +130,7 @@ Call site is (#{insn}).
130
130
 
131
131
  if fcall
132
132
  stack.pop();
133
- irs << SubIR.new(Self.new(translator), TmpVariable.new(stack.push()), InsnInfo.new([:putself], insn.iseq, -1, -1, true), cfg)
133
+ irs << SubIR.new(Self.new(translator, insn.iseq), TmpVariable.new(stack.push()), InsnInfo.new([:putself], insn.iseq, -1, -1, true), cfg)
134
134
  end
135
135
  recv = TmpVariable.new(stack.pop())
136
136
  recv.is_also(insn.ic_class) if insn.ic_class
@@ -160,7 +160,7 @@ Call site is (#{insn}).
160
160
  when :putnil
161
161
  irs << SubIR.new(Literal.new(nil, translator), TmpVariable.new(stack.push()), insn, cfg)
162
162
  when :putself
163
- irs << SubIR.new(Self.new(translator), TmpVariable.new(stack.push()), insn, cfg)
163
+ irs << SubIR.new(Self.new(translator, insn.iseq), TmpVariable.new(stack.push()), insn, cfg)
164
164
  when :putstring
165
165
  obj = argv[0]
166
166
  param = []
@@ -468,7 +468,7 @@ Call site is (#{insn}).
468
468
 
469
469
  if fcall
470
470
  stack.pop();
471
- irs << SubIR.new(Self.new(translator), TmpVariable.new(stack.push()), InsnInfo.new([:putself], insn.iseq, -1, -1, true), cfg)
471
+ irs << SubIR.new(Self.new(translator, insn.iseq), TmpVariable.new(stack.push()), InsnInfo.new([:putself], insn.iseq, -1, -1, true), cfg)
472
472
  end
473
473
  recv = TmpVariable.new(stack.pop())
474
474
  param = []
@@ -543,14 +543,12 @@ Call site is (#{insn}).
543
543
  when :defined
544
544
  t = argv[0]
545
545
  case t
546
- when DEFINED_IVAR, DEFINED_GVAR, DEFINED_FUNC
546
+ when DEFINED_IVAR, DEFINED_GVAR, DEFINED_FUNC, DEFINED_CONST
547
547
  # ok
548
548
  when DEFINED_IVAR2
549
549
  bug("unexpected defined instruction")
550
550
  when DEFINED_CVAR
551
551
  raise(UnsupportedError.new("Currently, CastOff cannot handle defined instruction for class variable"))
552
- when DEFINED_CONST
553
- raise(UnsupportedError.new("Currently, CastOff cannot handle defined instruction for constant"))
554
552
  when DEFINED_METHOD
555
553
  raise(UnsupportedError.new("Currently, CastOff cannot handle defined instruction for methods"))
556
554
  when DEFINED_YIELD
@@ -744,7 +742,7 @@ Call site is (#{insn}).
744
742
 
745
743
  def get_definition(target)
746
744
  case target
747
- when Self, Literal
745
+ when Literal
748
746
  return [target]
749
747
  when Variable
750
748
  ds = @information.variable_definition_of(target)
@@ -776,7 +774,7 @@ Call site is (#{insn}).
776
774
  ary = get_definition(target)
777
775
  ary.map {|d|
778
776
  case d
779
- when Self, Literal
777
+ when Literal
780
778
  d.source
781
779
  when SubIR
782
780
  d.src.source
@@ -8,6 +8,15 @@ module CastOff
8
8
  include Converter
9
9
 
10
10
  Template = ERB.new(<<-'end', 0, '%-', 'io')
11
+ %case RUBY_VERSION
12
+ %when "1.9.3"
13
+ #define RUBY_1_9_3 1
14
+ %when "1.9.2"
15
+ #define RUBY_1_9_2 1
16
+ %else
17
+ % raise(UnsupportedError.new("Unsupported ruby version #{RUBY_VERSION}"))
18
+ %end
19
+
11
20
  #include <ruby.h>
12
21
  #include <ruby/encoding.h>
13
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cast_off
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-07 00:00:00.000000000 Z
12
+ date: 2011-11-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'CastOff is a performance improvement tool for Ruby1.9.3
15
15
 
@@ -55,27 +55,43 @@ files:
55
55
  - ext/cast_off/generated_c_include/iter_api.h
56
56
  - ext/cast_off/generated_c_include/unbox_api.h.rb
57
57
  - ext/cast_off/generated_c_include/inline_api.h
58
- - ext/cast_off/cast_off.h
59
- - ext/cast_off/ruby_source/method.h
60
- - ext/cast_off/ruby_source/atomic.h
61
- - ext/cast_off/ruby_source/vm_insnhelper.h
62
- - ext/cast_off/ruby_source/constant.h
63
- - ext/cast_off/ruby_source/id.h
64
- - ext/cast_off/ruby_source/iseq.h
65
- - ext/cast_off/ruby_source/debug.h
66
- - ext/cast_off/ruby_source/insns.inc
67
- - ext/cast_off/ruby_source/node.h
68
- - ext/cast_off/ruby_source/internal.h
69
- - ext/cast_off/ruby_source/manual_update.h
70
- - ext/cast_off/ruby_source/insns_info.inc
71
- - ext/cast_off/ruby_source/gc.h
72
- - ext/cast_off/ruby_source/thread_win32.h
73
- - ext/cast_off/ruby_source/vm_exec.h
74
- - ext/cast_off/ruby_source/thread_pthread.h
75
- - ext/cast_off/ruby_source/vm_opts.h
76
- - ext/cast_off/ruby_source/vm_insnhelper.c
77
- - ext/cast_off/ruby_source/vm_core.h
78
- - ext/cast_off/ruby_source/eval_intern.h
58
+ - ext/cast_off/ruby_source/1.9.3/method.h
59
+ - ext/cast_off/ruby_source/1.9.3/atomic.h
60
+ - ext/cast_off/ruby_source/1.9.3/vm_insnhelper.h
61
+ - ext/cast_off/ruby_source/1.9.3/constant.h
62
+ - ext/cast_off/ruby_source/1.9.3/id.h
63
+ - ext/cast_off/ruby_source/1.9.3/iseq.h
64
+ - ext/cast_off/ruby_source/1.9.3/debug.h
65
+ - ext/cast_off/ruby_source/1.9.3/insns.inc
66
+ - ext/cast_off/ruby_source/1.9.3/node.h
67
+ - ext/cast_off/ruby_source/1.9.3/internal.h
68
+ - ext/cast_off/ruby_source/1.9.3/manual_update.h
69
+ - ext/cast_off/ruby_source/1.9.3/insns_info.inc
70
+ - ext/cast_off/ruby_source/1.9.3/gc.h
71
+ - ext/cast_off/ruby_source/1.9.3/thread_win32.h
72
+ - ext/cast_off/ruby_source/1.9.3/vm_exec.h
73
+ - ext/cast_off/ruby_source/1.9.3/thread_pthread.h
74
+ - ext/cast_off/ruby_source/1.9.3/vm_opts.h
75
+ - ext/cast_off/ruby_source/1.9.3/vm_insnhelper.c
76
+ - ext/cast_off/ruby_source/1.9.3/vm_core.h
77
+ - ext/cast_off/ruby_source/1.9.3/eval_intern.h
78
+ - ext/cast_off/ruby_source/1.9.2/method.h
79
+ - ext/cast_off/ruby_source/1.9.2/vm_insnhelper.h
80
+ - ext/cast_off/ruby_source/1.9.2/id.h
81
+ - ext/cast_off/ruby_source/1.9.2/iseq.h
82
+ - ext/cast_off/ruby_source/1.9.2/debug.h
83
+ - ext/cast_off/ruby_source/1.9.2/insns.inc
84
+ - ext/cast_off/ruby_source/1.9.2/node.h
85
+ - ext/cast_off/ruby_source/1.9.2/manual_update.h
86
+ - ext/cast_off/ruby_source/1.9.2/insns_info.inc
87
+ - ext/cast_off/ruby_source/1.9.2/gc.h
88
+ - ext/cast_off/ruby_source/1.9.2/thread_win32.h
89
+ - ext/cast_off/ruby_source/1.9.2/vm_exec.h
90
+ - ext/cast_off/ruby_source/1.9.2/thread_pthread.h
91
+ - ext/cast_off/ruby_source/1.9.2/vm_opts.h
92
+ - ext/cast_off/ruby_source/1.9.2/vm_insnhelper.c
93
+ - ext/cast_off/ruby_source/1.9.2/vm_core.h
94
+ - ext/cast_off/ruby_source/1.9.2/eval_intern.h
79
95
  - cast_off.gemspec
80
96
  - README
81
97
  - README.en
@@ -89,9 +105,9 @@ require_paths:
89
105
  required_ruby_version: !ruby/object:Gem::Requirement
90
106
  none: false
91
107
  requirements:
92
- - - =
108
+ - - ! '>='
93
109
  - !ruby/object:Gem::Version
94
- version: 1.9.3
110
+ version: 1.9.2
95
111
  required_rubygems_version: !ruby/object:Gem::Requirement
96
112
  none: false
97
113
  requirements:
@@ -1,24 +0,0 @@
1
- #include <ruby.h>
2
-
3
- #include "vm_core.h"
4
- #include "eval_intern.h"
5
- #include "iseq.h"
6
- #include "gc.h"
7
- #include <ruby/vm.h>
8
- #include <ruby/encoding.h>
9
- #include "vm_insnhelper.h"
10
- #include "vm_insnhelper.c"
11
- #include "vm_exec.h"
12
-
13
- #ifdef USE_INSN_STACK_INCREASE
14
- #undef USE_INSN_STACK_INCREASE
15
- #endif
16
- #define USE_INSN_STACK_INCREASE 1
17
-
18
- #ifdef USE_INSN_RET_NUM
19
- #undef USE_INSN_RET_NUM
20
- #endif
21
- #define USE_INSN_RET_NUM 1
22
-
23
- #include "insns_info.inc"
24
- #include "manual_update.h"