rubinius-compiler 2.3.1 → 3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubinius/code/compiler.rb +10 -0
  3. data/lib/rubinius/{compiler → code/compiler}/compiled_file.rb +0 -0
  4. data/lib/rubinius/{compiler → code/compiler}/compiler.rb +0 -0
  5. data/lib/rubinius/{compiler → code/compiler}/evaluator.rb +0 -0
  6. data/lib/rubinius/{compiler → code/compiler}/generator.rb +0 -0
  7. data/lib/rubinius/{compiler → code/compiler}/generator_methods.rb +0 -0
  8. data/lib/rubinius/{compiler → code/compiler}/iseq.rb +0 -0
  9. data/lib/rubinius/{compiler → code/compiler}/locals.rb +0 -0
  10. data/lib/rubinius/{compiler → code/compiler}/opcodes.rb +0 -0
  11. data/lib/rubinius/{compiler → code/compiler}/printers.rb +0 -0
  12. data/lib/rubinius/{compiler → code/compiler}/stages.rb +0 -0
  13. data/lib/rubinius/{compiler → code/compiler}/version.rb +1 -1
  14. metadata +23 -271
  15. data/.gitignore +0 -17
  16. data/.travis.yml +0 -8
  17. data/Gemfile +0 -4
  18. data/LICENSE +0 -25
  19. data/README.md +0 -29
  20. data/Rakefile +0 -1
  21. data/lib/rubinius/compiler.rb +0 -10
  22. data/rubinius-compiler.gemspec +0 -28
  23. data/spec/alias_spec.rb +0 -39
  24. data/spec/and_spec.rb +0 -44
  25. data/spec/array_spec.rb +0 -110
  26. data/spec/attrasgn_spec.rb +0 -186
  27. data/spec/back_ref_spec.rb +0 -11
  28. data/spec/call_spec.rb +0 -580
  29. data/spec/case_spec.rb +0 -576
  30. data/spec/cdecl_spec.rb +0 -70
  31. data/spec/class_spec.rb +0 -120
  32. data/spec/colon2_spec.rb +0 -8
  33. data/spec/colon3_spec.rb +0 -8
  34. data/spec/const_spec.rb +0 -7
  35. data/spec/custom/guards/profiler.rb +0 -18
  36. data/spec/custom/helpers/generator.rb +0 -828
  37. data/spec/custom/matchers/compile_as.rb +0 -46
  38. data/spec/custom/mspec.rb +0 -15
  39. data/spec/custom/runner/actions/debug.rb +0 -10
  40. data/spec/custom/runner/actions/gcstats.rb +0 -17
  41. data/spec/custom/runner/actions/memory.rb +0 -11
  42. data/spec/custom/runner/actions/parser.rb +0 -14
  43. data/spec/custom/runner/actions/profiler.rb +0 -19
  44. data/spec/custom/runner/relates.rb +0 -86
  45. data/spec/custom/utils/options.rb +0 -40
  46. data/spec/custom/utils/script.rb +0 -50
  47. data/spec/cvar_spec.rb +0 -39
  48. data/spec/cvasgn_spec.rb +0 -33
  49. data/spec/cvdecl_spec.rb +0 -17
  50. data/spec/defined_spec.rb +0 -616
  51. data/spec/defn_spec.rb +0 -732
  52. data/spec/defs_spec.rb +0 -113
  53. data/spec/dot2_spec.rb +0 -16
  54. data/spec/dot3_spec.rb +0 -17
  55. data/spec/dregx_spec.rb +0 -160
  56. data/spec/dstr_spec.rb +0 -424
  57. data/spec/dsym_spec.rb +0 -18
  58. data/spec/dxstr_spec.rb +0 -24
  59. data/spec/ensure_spec.rb +0 -196
  60. data/spec/false_spec.rb +0 -7
  61. data/spec/flip2_spec.rb +0 -21
  62. data/spec/flip3_spec.rb +0 -12
  63. data/spec/for_spec.rb +0 -228
  64. data/spec/gasgn_spec.rb +0 -15
  65. data/spec/generator/encode_spec.rb +0 -34
  66. data/spec/gvar_spec.rb +0 -37
  67. data/spec/hash_spec.rb +0 -108
  68. data/spec/iasgn_spec.rb +0 -26
  69. data/spec/if_spec.rb +0 -415
  70. data/spec/iter_spec.rb +0 -1011
  71. data/spec/lasgn_spec.rb +0 -561
  72. data/spec/lit_spec.rb +0 -61
  73. data/spec/masgn_spec.rb +0 -1558
  74. data/spec/match2_spec.rb +0 -42
  75. data/spec/match3_spec.rb +0 -54
  76. data/spec/match_spec.rb +0 -29
  77. data/spec/module_spec.rb +0 -73
  78. data/spec/nil_spec.rb +0 -7
  79. data/spec/not_spec.rb +0 -47
  80. data/spec/nth_ref_spec.rb +0 -7
  81. data/spec/op_asgn_spec.rb +0 -563
  82. data/spec/or_spec.rb +0 -126
  83. data/spec/postexe_spec.rb +0 -11
  84. data/spec/preexe_spec.rb +0 -21
  85. data/spec/regex_spec.rb +0 -54
  86. data/spec/rescue_spec.rb +0 -763
  87. data/spec/return_spec.rb +0 -152
  88. data/spec/sclass_spec.rb +0 -138
  89. data/spec/spec_helper.rb +0 -12
  90. data/spec/str_spec.rb +0 -118
  91. data/spec/super_spec.rb +0 -170
  92. data/spec/transforms/assembly_spec.rb +0 -195
  93. data/spec/transforms/block_given_spec.rb +0 -75
  94. data/spec/transforms/fast_coerce_spec.rb +0 -112
  95. data/spec/transforms/fast_new_spec.rb +0 -255
  96. data/spec/transforms/invoke_primitive_spec.rb +0 -14
  97. data/spec/transforms/kernel_methods_spec.rb +0 -29
  98. data/spec/transforms/primitive_spec.rb +0 -33
  99. data/spec/transforms/privately_spec.rb +0 -24
  100. data/spec/true_spec.rb +0 -7
  101. data/spec/undef_spec.rb +0 -133
  102. data/spec/until_spec.rb +0 -254
  103. data/spec/valias_spec.rb +0 -11
  104. data/spec/while_spec.rb +0 -494
  105. data/spec/xstr_spec.rb +0 -10
  106. data/spec/yield_spec.rb +0 -92
  107. data/spec/zsuper_spec.rb +0 -63
@@ -1,195 +0,0 @@
1
- describe "A Call node using InlineAssembly transform" do
2
- relates <<-ruby do
3
- Rubinius.asm(a) do |m|
4
- push 1
5
- end
6
- ruby
7
-
8
- compile do |g|
9
- g.push_const :Rubinius
10
- g.push :self
11
- g.send :a, 0, true
12
-
13
- g.in_block_send :asm, :single, nil, 1, false do |d|
14
- d.push :self
15
- d.push 1
16
- d.send :push, 1, true
17
- end
18
- end
19
-
20
- compile :assembly do |g|
21
- g.push 1
22
- end
23
- end
24
-
25
- relates <<-ruby do
26
- def new(*args)
27
- obj = allocate()
28
-
29
- Rubinius.asm(args, obj) do |x, y|
30
- run y
31
- run x
32
- push_block
33
- send_with_splat :initialize, 0, true
34
- end
35
-
36
- return obj
37
- end
38
- ruby
39
-
40
- compile do |g|
41
- in_method :new do |d|
42
- d.push :self
43
- d.send :allocate, 0, true
44
- d.set_local 1
45
- d.pop
46
-
47
- d.push_const :Rubinius
48
- d.push_local 0
49
- d.push_local 1
50
-
51
- e = new_block_generator(g)
52
-
53
- ruby_version_is ""..."1.9" do
54
- e.cast_for_multi_block_arg
55
- e.shift_array
56
-
57
- e.set_local 0
58
- e.pop
59
- e.shift_array
60
- e.set_local 1
61
- e.pop
62
- e.pop
63
- end
64
-
65
- e.push_modifiers
66
- e.new_label.set!
67
-
68
- e.push :self
69
- e.push_local 1
70
- e.send :run, 1, true
71
- e.pop
72
-
73
- e.push :self
74
- e.push_local 0
75
- e.send :run, 1, true
76
- e.pop
77
-
78
- e.push :self
79
- e.send :push_block, 0, true
80
- e.pop
81
- e.push :self
82
- e.push_literal :initialize
83
- e.push 0
84
- e.push :true
85
- e.send :send_with_splat, 3, true
86
-
87
- e.pop_modifiers
88
- e.ret
89
-
90
- d.create_block(e)
91
- d.send_with_block :asm, 2, false
92
- d.pop
93
- d.push_local 1
94
- d.ret
95
- end
96
- end
97
-
98
- compile :assembly do |g|
99
- in_method :new do |d|
100
- d.push :self
101
- d.send :allocate, 0, true
102
- d.set_local 1
103
- d.pop
104
-
105
- d.push_local 1
106
- d.push_local 0
107
- d.push_block
108
- d.send_with_splat :initialize, 0, true
109
- d.pop
110
- d.push_local 1
111
- d.ret
112
- end
113
- end
114
- end
115
-
116
- relates <<-ruby do
117
- def new(cnt)
118
- obj = allocate_sized cnt
119
- Rubinius.asm(obj) do |x|
120
- push_block
121
- run x
122
- send_with_block :initialize, 0, true
123
- end
124
-
125
- return obj
126
- end
127
- ruby
128
-
129
- compile do |g|
130
- in_method :new do |d|
131
- d.push :self
132
- d.push_local 0
133
- d.send :allocate_sized, 1, true
134
- d.set_local 1
135
- d.pop
136
-
137
- d.push_const :Rubinius
138
- d.push_local 1
139
-
140
- e = new_block_generator(g)
141
-
142
- ruby_version_is ""..."1.9" do
143
- e.cast_for_single_block_arg
144
-
145
- e.set_local 0
146
- e.pop
147
- end
148
-
149
- e.push_modifiers
150
- e.new_label.set!
151
-
152
- e.push :self
153
- e.send :push_block, 0, true
154
- e.pop
155
-
156
- e.push :self
157
- e.push_local 0
158
- e.send :run, 1, true
159
- e.pop
160
-
161
- e.push :self
162
- e.push_literal :initialize
163
- e.push 0
164
- e.push :true
165
- e.send :send_with_block, 3, true
166
-
167
- e.pop_modifiers
168
- e.ret
169
-
170
- d.create_block(e)
171
- d.send_with_block :asm, 1, false
172
- d.pop
173
- d.push_local 1
174
- d.ret
175
- end
176
- end
177
-
178
- compile :assembly do |g|
179
- in_method :new do |d|
180
- d.push :self
181
- d.push_local 0
182
- d.send :allocate_sized, 1, true
183
- d.set_local 1
184
- d.pop
185
-
186
- d.push_block
187
- d.push_local 1
188
- d.send_with_block :initialize, 0, true
189
- d.pop
190
- d.push_local 1
191
- d.ret
192
- end
193
- end
194
- end
195
- end
@@ -1,75 +0,0 @@
1
- describe "A Call node using BlockGiven transform" do
2
- block_given = lambda do |g|
3
- in_method :m do |d|
4
- no_blk = d.new_label
5
- done = d.new_label
6
-
7
- d.push_has_block
8
- d.gif no_blk
9
-
10
- d.push 1
11
- d.goto done
12
-
13
- no_blk.set!
14
- d.push :nil
15
-
16
- done.set!
17
- end
18
- end
19
-
20
- relates <<-ruby do
21
- def m
22
- 1 if block_given?
23
- end
24
- ruby
25
-
26
- compile do |g|
27
- in_method :m do |d|
28
- no_blk = d.new_label
29
- done = d.new_label
30
-
31
- d.push :self
32
- d.send :block_given?, 0, true
33
- d.gif no_blk
34
-
35
- d.push 1
36
- d.goto done
37
-
38
- no_blk.set!
39
- d.push :nil
40
-
41
- done.set!
42
- end
43
- end
44
-
45
- compile(:block_given, &block_given)
46
- end
47
-
48
- relates <<-ruby do
49
- def m
50
- 1 if iterator?
51
- end
52
- ruby
53
-
54
- compile do |g|
55
- in_method :m do |d|
56
- no_blk = d.new_label
57
- done = d.new_label
58
-
59
- d.push :self
60
- d.send :iterator?, 0, true
61
- d.gif no_blk
62
-
63
- d.push 1
64
- d.goto done
65
-
66
- no_blk.set!
67
- d.push :nil
68
-
69
- done.set!
70
- end
71
- end
72
-
73
- compile(:block_given, &block_given)
74
- end
75
- end
@@ -1,112 +0,0 @@
1
- describe "A Call node using SendFastCoerceTo transform" do
2
- relates <<-ruby do
3
- a = b
4
- Rubinius::Type.coerce_to a, Fixnum, :to_int
5
- ruby
6
-
7
- compile do |g|
8
- g.push :self
9
- g.send :b, 0, true
10
- g.set_local 0
11
- g.pop
12
-
13
- g.push_type
14
- g.push_local 0
15
- g.push_const :Fixnum
16
- g.push_literal :to_int
17
- g.send :coerce_to, 3, false
18
- end
19
-
20
- compile :fast_coerce do |g|
21
- done = g.new_label
22
-
23
- g.push :self
24
- g.send :b, 0, true
25
- g.set_local 0
26
- g.pop
27
-
28
- g.push_local 0
29
- g.dup
30
- g.push_const :Fixnum
31
- g.swap
32
- g.kind_of
33
- g.git done
34
-
35
- g.pop
36
- g.push_type
37
- g.push_local 0
38
- g.push_const :Fixnum
39
- g.push_literal :to_int
40
- g.send :coerce_to, 3, false
41
-
42
- done.set!
43
- end
44
- end
45
-
46
- relates <<-ruby do
47
- Rubinius::Type.coerce_to a, Fixnum, :to_int
48
- ruby
49
-
50
- compile do |g|
51
- g.push_type
52
- g.push :self
53
- g.send :a, 0, true
54
- g.push_const :Fixnum
55
- g.push_literal :to_int
56
- g.send :coerce_to, 3, false
57
- end
58
-
59
- compile :fast_coerce do |g|
60
- g.push_type
61
- g.push :self
62
- g.send :a, 0, true
63
- g.push_const :Fixnum
64
- g.push_literal :to_int
65
- g.send :coerce_to, 3, false
66
- end
67
- end
68
-
69
- relates <<-ruby do
70
- a = b
71
- Rubinius::Type.coerce_to a, String, :to_str
72
- ruby
73
-
74
- compile do |g|
75
- g.push :self
76
- g.send :b, 0, true
77
- g.set_local 0
78
- g.pop
79
-
80
- g.push_type
81
- g.push_local 0
82
- g.push_const :String
83
- g.push_literal :to_str
84
- g.send :coerce_to, 3, false
85
- end
86
-
87
- compile :fast_coerce do |g|
88
- done = g.new_label
89
-
90
- g.push :self
91
- g.send :b, 0, true
92
- g.set_local 0
93
- g.pop
94
-
95
- g.push_local 0
96
- g.dup
97
- g.push_const :String
98
- g.swap
99
- g.kind_of
100
- g.git done
101
-
102
- g.pop
103
- g.push_type
104
- g.push_local 0
105
- g.push_const :String
106
- g.push_literal :to_str
107
- g.send :coerce_to, 3, false
108
-
109
- done.set!
110
- end
111
- end
112
- end
@@ -1,255 +0,0 @@
1
- describe "A Call node using FastNew transform" do
2
- relates "new(a)" do
3
- compile do |g|
4
- g.push :self
5
- g.push :self
6
- g.send :a, 0, true
7
- g.send :new, 1, true
8
- end
9
-
10
- compile :fast_new do |g|
11
- slow = g.new_label
12
- done = g.new_label
13
-
14
- g.push :self
15
- g.dup
16
- g.check_serial_private :new, Rubinius::CompiledCode::KernelMethodSerial
17
- gif slow
18
-
19
- g.send :allocate, 0, true
20
- g.dup
21
- g.push :self
22
- g.send :a, 0, true
23
- g.send :initialize, 1, true
24
- g.pop
25
- g.goto done
26
-
27
- slow.set!
28
- g.push :self
29
- g.send :a, 0, true
30
- g.send :new, 1, true
31
-
32
- done.set!
33
- end
34
- end
35
-
36
- relates "new(&block)" do
37
- fast_new_with_block = lambda do |g|
38
- g.push :self
39
- g.push :self
40
- g.send :block, 0, true
41
- g.dup
42
- g.is_nil
43
-
44
- no_block = g.new_label
45
- g.git no_block
46
-
47
- g.push_cpath_top
48
- g.find_const :Proc
49
- g.swap
50
- g.send :__from_block__, 1
51
-
52
- no_block.set!
53
- g.send_with_block :new, 0, true
54
- end
55
-
56
- compile(&fast_new_with_block)
57
-
58
- compile(:fast_new, &fast_new_with_block)
59
- end
60
-
61
- relates "new(a, &block)" do
62
- fast_new_with_arg_block = lambda do |g|
63
- g.push :self
64
- g.push :self
65
- g.send :a, 0, true
66
-
67
- g.push :self
68
- g.send :block, 0, true
69
- g.dup
70
- g.is_nil
71
-
72
- no_block = g.new_label
73
- g.git no_block
74
-
75
- g.push_cpath_top
76
- g.find_const :Proc
77
- g.swap
78
- g.send :__from_block__, 1
79
-
80
- no_block.set!
81
- g.send_with_block :new, 1, true
82
- end
83
-
84
- compile(&fast_new_with_arg_block)
85
-
86
- compile(:fast_new, &fast_new_with_arg_block)
87
- end
88
-
89
- relates "A.new" do
90
- compile do |g|
91
- g.push_const :A
92
- g.send :new, 0, false
93
- end
94
-
95
- compile :fast_new do |g|
96
- slow = g.new_label
97
- done = g.new_label
98
-
99
- g.push_const :A
100
- g.dup
101
- g.check_serial :new, Rubinius::CompiledCode::KernelMethodSerial
102
- gif slow
103
-
104
- g.send :allocate, 0, true
105
- g.dup
106
- g.send :initialize, 0, true
107
- g.pop
108
- g.goto done
109
-
110
- slow.set!
111
- g.send :new, 0, false
112
-
113
- done.set!
114
- end
115
- end
116
-
117
- relates "A.new(a)" do
118
- compile do |g|
119
- g.push_const :A
120
- g.push :self
121
- g.send :a, 0, true
122
- g.send :new, 1, false
123
- end
124
-
125
- compile :fast_new do |g|
126
- slow = g.new_label
127
- done = g.new_label
128
-
129
- g.push_const :A
130
- g.dup
131
- g.check_serial :new, Rubinius::CompiledCode::KernelMethodSerial
132
- gif slow
133
-
134
- g.send :allocate, 0, true
135
- g.dup
136
- g.push :self
137
- g.send :a, 0, true
138
- g.send :initialize, 1, true
139
- g.pop
140
- g.goto done
141
-
142
- slow.set!
143
- g.push :self
144
- g.send :a, 0, true
145
- g.send :new, 1, false
146
-
147
- done.set!
148
- end
149
- end
150
-
151
- relates "A.new(&block)" do
152
- fast_new_with_block = lambda do |g|
153
- g.push_const :A
154
- g.push :self
155
- g.send :block, 0, true
156
- g.dup
157
- g.is_nil
158
-
159
- no_block = g.new_label
160
- g.git no_block
161
-
162
- g.push_cpath_top
163
- g.find_const :Proc
164
- g.swap
165
- g.send :__from_block__, 1
166
-
167
- no_block.set!
168
- g.send_with_block :new, 0, false
169
- end
170
-
171
- compile(&fast_new_with_block)
172
-
173
- compile(:fast_new, &fast_new_with_block)
174
- end
175
-
176
- relates "A.new(a, &block)" do
177
- fast_new_with_arg_block = lambda do |g|
178
- g.push_const :A
179
- g.push :self
180
- g.send :a, 0, true
181
-
182
- g.push :self
183
- g.send :block, 0, true
184
- g.dup
185
- g.is_nil
186
-
187
- no_block = g.new_label
188
- g.git no_block
189
-
190
- g.push_cpath_top
191
- g.find_const :Proc
192
- g.swap
193
- g.send :__from_block__, 1
194
-
195
- no_block.set!
196
- g.send_with_block :new, 1, false
197
- end
198
-
199
- compile(&fast_new_with_arg_block)
200
-
201
- compile(:fast_new, &fast_new_with_arg_block)
202
- end
203
-
204
- ruby_version_is "1.9" do
205
- relates "A.new(a { |(b, c)| })" do
206
- compile :fast_new do
207
- d = new_block_generator(g)
208
- d.push_local 0
209
- d.cast_array
210
- d.shift_array
211
- d.set_local 0
212
- d.pop
213
-
214
- d.shift_array
215
- d.set_local 1
216
- d.pop
217
- d.pop
218
-
219
- d.push_modifiers
220
- d.new_label.set!
221
- d.push :nil
222
- d.pop_modifiers
223
- d.ret
224
-
225
- slow = g.new_label
226
- done = g.new_label
227
-
228
- g.push_const :A
229
- g.dup
230
- g.check_serial :new, Rubinius::CompiledCode::KernelMethodSerial
231
- gif slow
232
-
233
- g.send :allocate, 0, true
234
- g.dup
235
-
236
- g.push :self
237
- g.create_block(d)
238
- g.send_with_block :a, 0, true
239
-
240
- g.send :initialize, 1, true
241
- g.pop
242
- g.goto done
243
-
244
- slow.set!
245
-
246
- g.push :self
247
- g.create_block(d)
248
- g.send_with_block :a, 0, true
249
- g.send :new, 1, false
250
-
251
- done.set!
252
- end
253
- end
254
- end
255
- end