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
data/spec/defs_spec.rb DELETED
@@ -1,113 +0,0 @@
1
- describe "A Defs node" do
2
- relates <<-ruby do
3
- def self.x(y)
4
- (y + 1)
5
- end
6
- ruby
7
-
8
- compile do |g|
9
- in_singleton_method :x, [:push, :self] do |d|
10
- d.push_local 0
11
- d.push 1
12
- d.send :+, 1, false
13
- end
14
- end
15
- end
16
-
17
- relates <<-ruby do
18
- def self.setup(ctx)
19
- bind = allocate
20
- bind.context = ctx
21
- return bind
22
- end
23
- ruby
24
-
25
- compile do |g|
26
- g.in_singleton_method :setup, [:push, :self] do |d|
27
- d.push :self
28
- d.send :allocate, 0, true
29
- d.set_local 1
30
- d.pop
31
-
32
- d.push_local 1
33
- d.push_local 0
34
- d.dup
35
- d.move_down 2
36
- d.send :context=, 1, false
37
- d.pop
38
- d.pop
39
-
40
- d.push_local 1
41
- d.ret # TODO: why extra return?
42
- end
43
- end
44
- end
45
-
46
- relates <<-ruby do
47
- def self.empty(*)
48
- end
49
- ruby
50
-
51
- compile do |g|
52
- in_singleton_method :empty, [:push, :self] do |d|
53
- d.push :nil
54
- end
55
- end
56
- end
57
-
58
- relates <<-ruby do
59
- def self.empty
60
- end
61
- ruby
62
-
63
- compile do |g|
64
- in_singleton_method :empty, [:push, :self] do |d|
65
- d.push :nil
66
- end
67
- end
68
- end
69
-
70
- relates <<-ruby do
71
- def (a.b).empty(*)
72
- end
73
- ruby
74
-
75
- compile do |g|
76
- g.push_rubinius
77
-
78
- g.push_literal :empty
79
-
80
- d = new_generator(g, name)
81
- d.push :nil
82
- d.ret
83
-
84
- g.push_literal(d)
85
- g.push_scope
86
-
87
- g.push :self
88
- g.send :a, 0, true
89
- g.send :b, 0, false
90
-
91
- g.send :attach_method, 4
92
- end
93
- end
94
-
95
- relates <<-ruby do
96
- x = "a"
97
- def x.m(a)
98
- a
99
- end
100
- ruby
101
-
102
- compile do |g|
103
- g.push_literal "a"
104
- g.string_dup
105
- g.set_local 0
106
- g.pop
107
-
108
- in_singleton_method :m, [:push_local, 0] do |d|
109
- d.push_local 0
110
- end
111
- end
112
- end
113
- end
data/spec/dot2_spec.rb DELETED
@@ -1,16 +0,0 @@
1
- describe "A Dot2 node" do
2
- relates "(a..b)" do
3
- compile do |g|
4
- g.push_cpath_top
5
- g.find_const :Range
6
- g.send :allocate, 0, true
7
- g.dup
8
- g.push :self
9
- g.send :a, 0, true
10
- g.push :self
11
- g.send :b, 0, true
12
- g.send :initialize, 2, true
13
- g.pop
14
- end
15
- end
16
- end
data/spec/dot3_spec.rb DELETED
@@ -1,17 +0,0 @@
1
- describe "A Dot3 node" do
2
- relates "(a...b)" do
3
- compile do |g|
4
- g.push_cpath_top
5
- g.find_const :Range
6
- g.send :allocate, 0, true
7
- g.dup
8
- g.push :self
9
- g.send :a, 0, true
10
- g.push :self
11
- g.send :b, 0, true
12
- g.push :true
13
- g.send :initialize, 3, true
14
- g.pop
15
- end
16
- end
17
- end
data/spec/dregx_spec.rb DELETED
@@ -1,160 +0,0 @@
1
- describe "A Dregx node" do
2
- ruby_version_is ""..."1.9" do
3
- # TODO: Fix 1.8 parser
4
- relates <<-ruby do
5
- /(\#{})/
6
- ruby
7
-
8
- compile do |g|
9
- g.push_cpath_top
10
- g.find_const :Regexp
11
- g.push_literal "("
12
- g.push_literal ")"
13
- g.string_build 2
14
- g.push 0
15
- g.send :new, 2
16
- end
17
- end
18
-
19
- relates "/a\#{}b/" do
20
- compile do |g|
21
- g.push_cpath_top
22
- g.find_const :Regexp
23
-
24
- g.push_literal "a"
25
- g.push_literal "b"
26
- g.string_build 2
27
-
28
- g.push 0
29
- g.send :new, 2
30
- end
31
- end
32
- end
33
-
34
- ruby_version_is "1.9" do
35
- relates <<-ruby do
36
- /(\#{})/
37
- ruby
38
-
39
- compile do |g|
40
- g.push_cpath_top
41
- g.find_const :Regexp
42
- g.push_literal "("
43
- g.push :nil
44
- g.meta_to_s
45
- g.push_literal ")"
46
- g.string_build 3
47
- g.push 0
48
- g.send :new, 2
49
- end
50
- end
51
-
52
- relates "/a\#{}b/" do
53
- compile do |g|
54
- g.push_cpath_top
55
- g.find_const :Regexp
56
-
57
- g.push_literal "a"
58
- g.push :nil
59
- g.meta_to_s
60
- g.push_literal "b"
61
- g.string_build 3
62
-
63
- g.push 0
64
- g.send :new, 2
65
- end
66
- end
67
- end
68
-
69
- relates "/x\#{(1 + 1)}y/" do
70
- compile do |g|
71
- g.push_cpath_top
72
- g.find_const :Regexp
73
-
74
- g.push_literal "x" # 1
75
-
76
- g.push 1 # 2
77
- g.push 1
78
- g.send :+, 1, false
79
- g.meta_to_s
80
-
81
- g.push_literal "y" # 3
82
-
83
- g.string_build 3
84
-
85
- g.push 0
86
- g.send :new, 2
87
- end
88
- end
89
-
90
- relates "/\#{@rakefile}/" do
91
- compile do |g|
92
- g.push_cpath_top
93
- g.find_const :Regexp
94
-
95
- g.push_ivar :@rakefile
96
- g.meta_to_s
97
- g.string_build 1
98
-
99
- g.push 0
100
- g.send :new, 2
101
- end
102
- end
103
-
104
- relates "/\#{1}/n" do
105
- compile do |g|
106
- g.push_cpath_top
107
- g.find_const :Regexp
108
-
109
- g.push 1
110
- g.meta_to_s
111
- g.string_build 1
112
-
113
- g.push 512
114
- g.send :new, 2
115
- end
116
- end
117
-
118
- relates "/\#{IAC}\#{SB}/no" do
119
- compile do |g|
120
- memoize do
121
- g.push_cpath_top
122
- g.find_const :Regexp
123
-
124
- g.push_const :IAC # 1
125
- g.meta_to_s
126
-
127
- g.push_const :SB # 2
128
- g.meta_to_s
129
-
130
- g.string_build 2
131
-
132
- g.push 512
133
- g.send :new, 2
134
- end
135
- end
136
- end
137
-
138
- relates "/x\#{(1 + 1)}y/o" do
139
- compile do |g|
140
- memoize do
141
- g.push_cpath_top
142
- g.find_const :Regexp
143
-
144
- g.push_literal "x" # 1
145
-
146
- g.push 1 # 2
147
- g.push 1
148
- g.send :+, 1, false
149
- g.meta_to_s
150
-
151
- g.push_literal "y" # 3
152
-
153
- g.string_build 3
154
-
155
- g.push 0
156
- g.send :new, 2
157
- end
158
- end
159
- end
160
- end
data/spec/dstr_spec.rb DELETED
@@ -1,424 +0,0 @@
1
- describe "A Dstr node" do
2
- ruby_version_is ""..."1.9" do
3
- relates <<-ruby do
4
- "\#{}"
5
- ruby
6
-
7
- compile do |g|
8
- g.push_literal ""
9
- g.string_dup
10
- end
11
- end
12
-
13
- relates <<-ruby do
14
- "\#{}\#{}"
15
- ruby
16
-
17
- compile do |g|
18
- g.push_literal ""
19
- g.string_dup
20
- end
21
- end
22
-
23
- relates <<-ruby do
24
- "\#{}hello\#{}"
25
- ruby
26
-
27
- compile do |g|
28
- g.push_literal "hello"
29
- g.string_build 1
30
- end
31
- end
32
-
33
- relates <<-ruby do
34
- "hello \#{}"
35
- ruby
36
-
37
- compile do |g|
38
- g.push_literal "hello "
39
- g.string_dup
40
- end
41
- end
42
-
43
- relates <<-ruby do
44
- "\#{} hello"
45
- ruby
46
-
47
- compile do |g|
48
- g.push_literal " hello"
49
- g.string_build 1
50
- end
51
- end
52
- end
53
-
54
- ruby_version_is "1.9" do
55
- relates <<-ruby do
56
- "\#{}"
57
- ruby
58
-
59
- compile do |g|
60
- g.push :nil
61
- g.meta_to_s
62
- g.string_build 1
63
- end
64
- end
65
-
66
- relates <<-ruby do
67
- "\#{}\#{}"
68
- ruby
69
-
70
- compile do |g|
71
- g.push :nil
72
- g.meta_to_s
73
- g.push :nil
74
- g.meta_to_s
75
- g.string_build 2
76
- end
77
- end
78
-
79
- relates <<-ruby do
80
- "\#{}hello\#{}"
81
- ruby
82
-
83
- compile do |g|
84
- g.push :nil
85
- g.meta_to_s
86
- g.push_literal "hello"
87
- g.push :nil
88
- g.meta_to_s
89
- g.string_build 3
90
- end
91
- end
92
-
93
- relates <<-ruby do
94
- "hello \#{}"
95
- ruby
96
-
97
- compile do |g|
98
- g.push_literal "hello "
99
- g.push :nil
100
- g.meta_to_s
101
- g.string_build 2
102
- end
103
- end
104
-
105
- relates <<-ruby do
106
- "\#{} hello"
107
- ruby
108
-
109
- compile do |g|
110
- g.push :nil
111
- g.meta_to_s
112
- g.push_literal " hello"
113
- g.string_build 2
114
- end
115
- end
116
- end
117
-
118
- relates <<-ruby do
119
- "\#{a}"
120
- ruby
121
-
122
- compile do |g|
123
- g.push :self
124
- g.send :a, 0, true
125
- g.meta_to_s
126
- g.string_build 1
127
- end
128
- end
129
-
130
- relates <<-ruby do
131
- "hello \#{a}"
132
- ruby
133
-
134
- compile do |g|
135
- g.push_literal "hello "
136
- g.push :self
137
- g.send :a, 0, true
138
- g.meta_to_s
139
- g.string_build 2
140
- end
141
- end
142
-
143
- relates <<-ruby do
144
- "\#{a} hello"
145
- ruby
146
-
147
- compile do |g|
148
- g.push :self
149
- g.send :a, 0, true
150
- g.meta_to_s
151
- g.push_literal " hello"
152
- g.string_build 2
153
- end
154
- end
155
-
156
- relates <<-ruby do
157
- argl = 1
158
- "x\#{argl}y"
159
- ruby
160
-
161
- compile do |g|
162
- g.push 1
163
- g.set_local 0
164
- g.pop
165
-
166
- g.push_literal "x" # 1
167
-
168
- g.push_local 0 # 2
169
- g.meta_to_s
170
-
171
- g.push_literal "y" # 3
172
-
173
- g.string_build 3
174
- end
175
- end
176
-
177
- relates <<-ruby do
178
- argl = 1
179
- "x\#{("%.2f" % 3.14159)}y"
180
- ruby
181
-
182
- compile do |g|
183
- g.push 1
184
- g.set_local 0
185
- g.pop
186
-
187
- g.push_literal "x" # 1
188
-
189
- g.push_literal "%.2f" # 2
190
- g.string_dup
191
- g.push_literal 3.14159
192
- g.send :%, 1, false
193
- g.meta_to_s
194
-
195
- g.push_literal "y" # 3
196
-
197
- g.string_build 3
198
- end
199
- end
200
-
201
- relates <<-ruby do
202
- max = 2
203
- argl = 1
204
- "x\#{("%.\#{max}f" % 3.14159)}y" # "
205
- ruby
206
-
207
- compile do |g|
208
- g.push 2
209
- g.set_local 0
210
- g.pop
211
- g.push 1
212
- g.set_local 1
213
- g.pop
214
-
215
- g.push_literal "x" # - # 1
216
-
217
- g.push_literal "%." # 1
218
-
219
- g.push_local 0 # 2
220
- g.meta_to_s
221
-
222
- g.push_literal "f" # 3
223
-
224
- g.string_build 3
225
-
226
- g.push_literal 3.14159 # - # 2
227
- g.send :%, 1, false
228
- g.meta_to_s
229
-
230
- g.push_literal "y" # - # 3
231
-
232
- g.string_build 3
233
- end
234
- end
235
-
236
- relates '"#{22}aa" "cd#{44}" "55" "#{66}"' do
237
- compile do |g|
238
- g.push 22 # 1
239
- g.meta_to_s
240
-
241
- g.push_literal "aa" # 2
242
- g.push_literal "cd" # 3
243
-
244
- g.push 44 # 4
245
- g.meta_to_s
246
-
247
- g.push_literal "55" # 5
248
-
249
- g.push 66 # 6
250
- g.meta_to_s
251
-
252
- g.string_build 6
253
- end
254
- end
255
-
256
- relates '"a #$global b #@ivar c #@@cvar d"' do
257
- compile do |g|
258
- g.push_literal "a " # 1
259
-
260
- g.push_rubinius # 2
261
- g.find_const :Globals
262
- g.push_literal :$global
263
- g.send :[], 1
264
- g.meta_to_s
265
-
266
- g.push_literal " b " # 3
267
-
268
- g.push_ivar :@ivar # 4
269
- g.meta_to_s
270
-
271
- g.push_literal " c " # 5
272
-
273
- g.push_scope # 6
274
- g.push_literal :@@cvar
275
- g.send :class_variable_get, 1
276
- g.meta_to_s
277
-
278
- g.push_literal " d" # 7
279
-
280
- g.string_build 7
281
- end
282
- end
283
-
284
- relates <<-ruby do
285
- <<EOM
286
- foo
287
- \#{1 + 1}blah
288
- EOM
289
- ruby
290
-
291
- compile do |g|
292
- g.push_literal " foo\n" # 1
293
-
294
- g.push 1 # 2
295
- g.push 1
296
- g.send :+, 1, false
297
- g.meta_to_s
298
-
299
- g.push_literal "blah\n" # 3
300
-
301
- g.string_build 3
302
- end
303
- end
304
-
305
- relates <<-ruby do
306
- <<-EOF
307
- def test_\#{action}_valid_feed
308
- EOF
309
- ruby
310
-
311
- compile do |g|
312
- g.push_literal "def test_" # 1
313
-
314
- g.push :self # 2
315
- g.send :action, 0, true
316
- g.meta_to_s
317
-
318
- g.push_literal "_valid_feed\n" # 1
319
-
320
- g.string_build 3
321
- end
322
- end
323
-
324
- relates <<-ruby do
325
- <<-EOF
326
- s1 '\#{RUBY_PLATFORM}' s2
327
- \#{__FILE__}
328
- EOF
329
- ruby
330
-
331
- compile do |g|
332
- g.push_literal "s1 '" # 1
333
-
334
- g.push_const :RUBY_PLATFORM # 2
335
- g.meta_to_s
336
-
337
- g.push_literal "' s2\n" # 3
338
-
339
- g.push_scope # 4
340
- g.send :active_path, 0
341
- g.meta_to_s
342
-
343
- g.push_literal "\n" # 5
344
-
345
- g.string_build 5
346
- end
347
- end
348
-
349
- relates "%Q[before [\#{nest}] after]" do
350
- compile do |g|
351
- g.push_literal "before [" # 1
352
-
353
- g.push :self # 2
354
- g.send :nest, 0, true
355
- g.meta_to_s
356
-
357
- g.push_literal "] after" # 3
358
-
359
- g.string_build 3
360
- end
361
- end
362
-
363
- relates '"#{"blah"}#{__FILE__}:#{__LINE__}: warning: #{$!.message} (#{$!.class})"' do
364
- compile do |g|
365
- g.push_literal "blah" # 1
366
-
367
- g.push_scope # 2
368
- g.send :active_path, 0
369
- g.meta_to_s
370
-
371
- g.push_literal ":" # 3
372
-
373
- g.push 1 # 4
374
- g.meta_to_s
375
-
376
- g.push_literal ": warning: " # 5
377
-
378
- g.push_current_exception # 6
379
- g.send :message, 0, false
380
- g.meta_to_s
381
-
382
- g.push_literal " (" # 7
383
-
384
- g.push_current_exception # 8
385
- g.send :class, 0, false
386
- g.meta_to_s
387
-
388
- g.push_literal ")" # 9
389
-
390
- g.string_build 9
391
- end
392
- end
393
-
394
- relates '"before #{from} middle #{to} (#{__FILE__}:#{__LINE__})"' do
395
- compile do |g|
396
- g.push_literal "before " # 1
397
-
398
- g.push :self # 2
399
- g.send :from, 0, true
400
- g.meta_to_s
401
-
402
- g.push_literal " middle " # 3
403
-
404
- g.push :self # 4
405
- g.send :to, 0, true
406
- g.meta_to_s
407
-
408
- g.push_literal " (" # 5
409
-
410
- g.push_scope # 6
411
- g.send :active_path, 0
412
- g.meta_to_s
413
-
414
- g.push_literal ":" # 7
415
-
416
- g.push 1 # 8
417
- g.meta_to_s
418
-
419
- g.push_literal ")" # 9
420
-
421
- g.string_build 9
422
- end
423
- end
424
- end