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/case_spec.rb DELETED
@@ -1,576 +0,0 @@
1
- describe "A Case node" do
2
- relates <<-ruby do
3
- var = 2
4
- result = ""
5
- case var
6
- when 1 then
7
- puts("something")
8
- result = "red"
9
- when 2, 3 then
10
- result = "yellow"
11
- when 4 then
12
- # do nothing
13
- else
14
- result = "green"
15
- end
16
- case result
17
- when "red" then
18
- var = 1
19
- when "yellow" then
20
- var = 2
21
- when "green" then
22
- var = 3
23
- else
24
- # do nothing
25
- end
26
- ruby
27
-
28
- compile do |g|
29
- a1 = g.new_label
30
- a2 = g.new_label
31
- a3 = g.new_label
32
- a4 = g.new_label
33
- a_bottom = g.new_label
34
-
35
- g.push 2
36
- g.set_local 0
37
- g.pop
38
- g.push_literal ""
39
- g.string_dup
40
- g.set_local 1
41
- g.pop
42
-
43
- g.push_local 0
44
- g.dup
45
- g.push 1
46
- g.swap
47
- g.send :===, 1
48
- g.gif a1
49
-
50
- g.pop
51
- g.push :self
52
- g.push_literal "something"
53
- g.string_dup
54
- g.send :puts, 1, true
55
- g.pop
56
- g.push_literal "red"
57
- g.string_dup
58
- g.set_local 1
59
- g.goto a_bottom
60
-
61
- a1.set!
62
-
63
- g.dup
64
- g.push 2
65
- g.swap
66
- g.send :===, 1
67
- g.git a2
68
-
69
- g.dup
70
- g.push 3
71
- g.swap
72
- g.send :===, 1
73
- g.git a2
74
- g.goto a3
75
-
76
- a2.set!
77
-
78
- g.pop
79
- g.push_literal "yellow"
80
- g.string_dup
81
- g.set_local 1
82
- g.goto a_bottom
83
-
84
- a3.set!
85
-
86
- g.dup
87
- g.push 4
88
- g.swap
89
- g.send :===, 1
90
- g.gif a4
91
-
92
- g.pop
93
- g.push :nil
94
- g.goto a_bottom
95
-
96
- a4.set!
97
-
98
- g.pop
99
- g.push_literal "green"
100
- g.string_dup
101
- g.set_local 1
102
-
103
- a_bottom.set!
104
-
105
- b1 = g.new_label
106
- b2 = g.new_label
107
- b3 = g.new_label
108
- b_bottom = g.new_label
109
-
110
- g.pop
111
- g.push_local 1
112
- g.dup
113
- g.push_literal "red"
114
- g.string_dup
115
- g.swap
116
- g.send :===, 1
117
- g.gif b1
118
-
119
- g.pop
120
- g.push 1
121
- g.set_local 0
122
- g.goto b_bottom
123
-
124
- b1.set!
125
-
126
- g.dup
127
- g.push_literal "yellow"
128
- g.string_dup
129
- g.swap
130
- g.send :===, 1
131
- g.gif b2
132
-
133
- g.pop
134
- g.push 2
135
- g.set_local 0
136
- g.goto b_bottom
137
-
138
- b2.set!
139
-
140
- g.dup
141
- g.push_literal "green"
142
- g.string_dup
143
- g.swap
144
- g.send :===, 1
145
- g.gif b3
146
-
147
- g.pop
148
- g.push 3
149
- g.set_local 0
150
- g.goto b_bottom
151
-
152
- b3.set!
153
-
154
- g.pop
155
- g.push :nil
156
-
157
- b_bottom.set!
158
- end
159
- end
160
-
161
- relates <<-ruby do
162
- case a
163
- when b then
164
- case
165
- when (d and e) then
166
- f
167
- else
168
- # do nothing
169
- end
170
- else
171
- # do nothing
172
- end
173
- ruby
174
-
175
- compile do |g|
176
- c2, bottom = g.new_label, g.new_label
177
- i1, i2, ibottom = g.new_label, g.new_label, g.new_label
178
-
179
- g.push :self
180
- g.send :a, 0, true
181
- g.dup
182
- g.push :self
183
- g.send :b, 0, true
184
- g.swap
185
- g.send :===, 1
186
- g.gif c2
187
-
188
- g.pop
189
- g.push :self
190
- g.send :d, 0, true
191
- g.dup
192
- g.gif i1 # TODO: lamest jump ever - should be ibottom
193
-
194
- g.pop
195
- g.push :self
196
- g.send :e, 0, true
197
-
198
- i1.set!
199
-
200
- g.gif i2
201
- g.push :self
202
- g.send :f, 0, true
203
-
204
- g.goto ibottom
205
-
206
- i2.set!
207
-
208
- g.push :nil
209
-
210
- ibottom.set!
211
-
212
- g.goto bottom
213
-
214
- c2.set!
215
- g.pop
216
- g.push :nil
217
-
218
- bottom.set!
219
- end
220
- end
221
-
222
- relates <<-ruby do
223
- var1 = 1
224
- var2 = 2
225
- result = nil
226
- case var1
227
- when 1 then
228
- case var2
229
- when 1 then
230
- result = 1
231
- when 2 then
232
- result = 2
233
- else
234
- result = 3
235
- end
236
- when 2 then
237
- case var2
238
- when 1 then
239
- result = 4
240
- when 2 then
241
- result = 5
242
- else
243
- result = 6
244
- end
245
- else
246
- result = 7
247
- end
248
- ruby
249
-
250
- compile do |g|
251
- a2 = g.new_label
252
- a3 = g.new_label
253
- a_bottom = g.new_label
254
-
255
- g.push 1
256
- g.set_local 0
257
- g.pop
258
- g.push 2
259
- g.set_local 1
260
- g.pop
261
- g.push :nil
262
- g.set_local 2
263
- g.pop
264
-
265
- ########################################
266
- b2 = g.new_label
267
- b3 = g.new_label
268
- b_bottom = g.new_label
269
-
270
- g.push_local 0
271
- g.dup
272
- g.push 1
273
- g.swap
274
- g.send :===, 1
275
- g.gif a2
276
-
277
- g.pop
278
- g.push_local 1
279
- g.dup
280
- g.push 1
281
- g.swap
282
- g.send :===, 1
283
- g.gif b2
284
-
285
- g.pop
286
- g.push 1
287
- g.set_local 2
288
- g.goto b_bottom
289
-
290
- b2.set!
291
-
292
- g.dup
293
- g.push 2
294
- g.swap
295
- g.send :===, 1
296
- g.gif b3
297
-
298
- g.pop
299
- g.push 2
300
- g.set_local 2
301
- g.goto b_bottom
302
-
303
- b3.set!
304
-
305
- g.pop
306
- g.push 3
307
- g.set_local 2
308
-
309
- b_bottom.set!
310
-
311
- g.goto a_bottom
312
-
313
- a2.set!
314
-
315
- g.dup
316
- g.push 2
317
- g.swap
318
- g.send :===, 1
319
- g.gif a3
320
-
321
- ########################################
322
- c2 = g.new_label
323
- c3 = g.new_label
324
- c_bottom = g.new_label
325
-
326
- g.pop
327
- g.push_local 1
328
- g.dup
329
- g.push 1
330
- g.swap
331
- g.send :===, 1
332
- g.gif c2
333
-
334
- g.pop
335
- g.push 4
336
- g.set_local 2
337
- g.goto c_bottom
338
-
339
- c2.set!
340
-
341
- g.dup
342
- g.push 2
343
- g.swap
344
- g.send :===, 1
345
- g.gif c3
346
-
347
- g.pop
348
- g.push 5
349
- g.set_local 2
350
- g.goto c_bottom
351
-
352
- c3.set!
353
-
354
- g.pop
355
- g.push 6
356
- g.set_local 2
357
-
358
- c_bottom.set!
359
-
360
- g.goto a_bottom
361
-
362
- a3.set!
363
-
364
- g.pop
365
- g.push 7
366
- g.set_local 2
367
-
368
- a_bottom.set!
369
- end
370
- end
371
-
372
- relates <<-ruby do
373
- case
374
- when (a == 1) then
375
- :a
376
- when (a == 2) then
377
- :b
378
- else
379
- :c
380
- end
381
- ruby
382
-
383
- compile do |g|
384
- c2, c3, bottom = g.new_label, g.new_label, g.new_label
385
-
386
- g.push :self
387
- g.send :a, 0, true
388
- g.push 1
389
- g.send :==, 1, false
390
- g.gif c2
391
- g.push_literal :a
392
- g.goto bottom
393
-
394
- c2.set!
395
-
396
- g.push :self
397
- g.send :a, 0, true
398
- g.push 2
399
- g.send :==, 1, false
400
- g.gif c3
401
- g.push_literal :b
402
- g.goto bottom
403
-
404
- c3.set!
405
- g.push_literal :c
406
-
407
- bottom.set!
408
- end
409
- end
410
-
411
- relates <<-ruby do
412
- case a
413
- when :b, *c then
414
- d
415
- else
416
- e
417
- end
418
- ruby
419
-
420
- compile do |g|
421
- c1, c2, bottom = g.new_label, g.new_label, g.new_label
422
-
423
- g.push :self
424
- g.send :a, 0, true
425
-
426
- g.dup
427
- g.push_literal :b
428
- g.swap
429
- g.send :===, 1
430
- g.git c1
431
-
432
- g.dup
433
- g.push :self
434
- g.send :c, 0, true
435
- g.cast_array
436
- g.push_literal Rubinius::ToolSets::Spec::Compiler::Runtime
437
- g.rotate(3)
438
- g.send :matches_when, 2
439
- g.git c1
440
-
441
- g.goto c2
442
-
443
- c1.set!
444
-
445
- g.pop
446
- g.push :self
447
- g.send :d, 0, true
448
- g.goto bottom
449
-
450
- c2.set!
451
-
452
- g.pop
453
- g.push :self
454
- g.send :e, 0, true
455
-
456
- bottom.set!
457
- end
458
- end
459
-
460
- relates <<-ruby do
461
- case true
462
- when String, *%w(foo bar baz) then
463
- 12
464
- end
465
- ruby
466
-
467
- compile do |g|
468
- body = g.new_label
469
- nxt = g.new_label
470
- fin = g.new_label
471
-
472
- g.push :true
473
-
474
- g.dup
475
- g.push_const :String
476
- g.swap
477
- g.send :===, 1
478
- g.git body
479
-
480
- g.dup
481
- g.push_literal "foo"
482
- g.string_dup
483
- g.swap
484
- g.send :===, 1
485
- g.git body
486
-
487
- g.dup
488
- g.push_literal "bar"
489
- g.string_dup
490
- g.swap
491
- g.send :===, 1
492
- g.git body
493
-
494
- g.dup
495
- g.push_literal "baz"
496
- g.string_dup
497
- g.swap
498
- g.send :===, 1
499
- g.git body
500
-
501
- g.goto nxt
502
-
503
- body.set!
504
- g.pop
505
- g.push 12
506
- g.goto fin
507
-
508
- nxt.set!
509
- g.pop
510
- g.push :nil
511
- fin.set!
512
- end
513
- end
514
-
515
- relates <<-ruby do
516
- case ()
517
- when a
518
- 1
519
- end
520
- ruby
521
-
522
- compile do |g|
523
- no_match = g.new_label
524
- done = g.new_label
525
-
526
- g.push :nil
527
- g.dup
528
- g.push :self
529
- g.send :a, 0, true
530
- g.swap
531
- g.send :===, 1
532
- g.gif no_match
533
-
534
- g.pop
535
- g.push 1
536
- g.goto done
537
-
538
- no_match.set!
539
- g.pop
540
- g.push :nil
541
- done.set!
542
- end
543
- end
544
-
545
- relates <<-ruby do
546
- x = 1
547
- case a
548
- when x
549
- 2
550
- end
551
- ruby
552
-
553
- compile do |g|
554
- no_match = g.new_label
555
- done = g.new_label
556
-
557
- g.push 1
558
- g.set_local 0
559
- g.pop
560
- g.push :self
561
- g.send :a, 0, true
562
- g.dup
563
- g.push_local 0
564
- g.swap
565
- g.send :===, 1
566
- g.gif no_match
567
- g.pop
568
- g.push 2
569
- g.goto done
570
- no_match.set!
571
- g.pop
572
- g.push :nil
573
- done.set!
574
- end
575
- end
576
- end