rubinius-compiler 2.3.1 → 3.0

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 (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/iter_spec.rb DELETED
@@ -1,1011 +0,0 @@
1
- describe "An Iter node" do
2
- empty_block = lambda do |g|
3
- g.push :self
4
-
5
- g.in_block_send :m, :none do |d|
6
- d.push :nil
7
- end
8
- end
9
-
10
- relates "m { }" do
11
- compile(&empty_block)
12
- end
13
-
14
- relates "m do end" do
15
- compile(&empty_block)
16
- end
17
-
18
- relates "m { x }" do
19
- compile do |g|
20
- g.push :self
21
-
22
- g.in_block_send :m, :none do |d|
23
- d.push :self
24
- d.send :x, 0, true
25
- end
26
- end
27
- end
28
-
29
- relates "m { || x }" do
30
- compile do |g|
31
- g.push :self
32
-
33
- g.in_block_send :m, :empty do |d|
34
- d.push :self
35
- d.send :x, 0, true
36
- end
37
- end
38
- end
39
-
40
- single_arg_block = lambda do |g|
41
- g.push :self
42
-
43
- g.in_block_send :m, :single do |d|
44
- d.push_local 0
45
- d.push :self
46
- d.send :x, 0, true
47
- d.send :+, 1, false
48
- end
49
- end
50
-
51
- relates "m { |a| a + x }" do
52
- compile(&single_arg_block)
53
- end
54
-
55
- relates "m { |*| x }" do
56
- compile do |g|
57
- g.push :self
58
-
59
- g.in_block_send :m, :blank do |d|
60
- d.push :self
61
- d.send :x, 0, true
62
- end
63
- end
64
- end
65
-
66
- relates "m { |*c| x; c }" do
67
- compile do |g|
68
- g.push :self
69
-
70
- g.in_block_send :m, :splat do |d|
71
- d.push :self
72
- d.send :x, 0, true
73
- d.pop
74
- d.push_local 0
75
- end
76
- end
77
- end
78
-
79
- masgn_single_arg_block = lambda do |g|
80
- g.push :self
81
-
82
- g.in_block_send :m, :multi, 1 do |d|
83
- d.push_local 0
84
- d.push :self
85
- d.send :x, 0, true
86
- d.send :+, 1, false
87
- end
88
- end
89
-
90
- relates "m { |a, | a + x }" do
91
- compile(&masgn_single_arg_block)
92
- end
93
-
94
- relates "m { |a, *| a + x }" do
95
- compile(&masgn_single_arg_block)
96
- end
97
-
98
- relates "m { |a, *c| a + x; c }" do
99
- compile do |g|
100
- g.push :self
101
-
102
- g.in_block_send :m, :rest, -2 do |d|
103
- d.push_local 0
104
- d.push :self
105
- d.send :x, 0, true
106
- d.send :+, 1, false
107
- d.pop
108
- d.push_local 1
109
- end
110
- end
111
- end
112
-
113
- relates "m { |a, b| a + x; b }" do
114
- compile do |g|
115
- g.push :self
116
-
117
- g.in_block_send :m, :multi, 2 do |d|
118
- d.push_local 0
119
- d.push :self
120
- d.send :x, 0, true
121
- d.send :+, 1, false
122
- d.pop
123
- d.push_local 1
124
- end
125
- end
126
- end
127
-
128
- masgn_multi_arg_block = lambda do |g|
129
- g.push :self
130
-
131
- g.in_block_send :m, :multi, -2 do |d|
132
- d.push_local 0
133
- d.push :self
134
- d.send :x, 0, true
135
- d.send :+, 1, false
136
- d.pop
137
- d.push_local 1
138
- end
139
- end
140
-
141
- relates "m { |a, b, | a + x; b }" do
142
- compile(&masgn_multi_arg_block)
143
- end
144
-
145
- relates "m { |a, b, *| a + x; b }" do
146
- compile(&masgn_multi_arg_block)
147
- end
148
-
149
- masgn_rest_arg_block = lambda do |g|
150
- g.push :self
151
-
152
- g.in_block_send :m, :rest, -3 do |d|
153
- d.push_local 0
154
- d.push :self
155
- d.send :x, 0, true
156
- d.send :+, 1, false
157
- d.pop
158
- d.push_local 1
159
- d.pop
160
- d.push_local 2
161
- end
162
- end
163
-
164
- relates "m { |a, b, *c| a + x; b; c }" do
165
- compile(&masgn_rest_arg_block)
166
- end
167
-
168
- relates "m do |a, b, *c| a + x; b; c end" do
169
- compile(&masgn_rest_arg_block)
170
- end
171
-
172
- relates "m { n = 1; n }" do
173
- compile do |g|
174
- g.push :self
175
-
176
- g.in_block_send :m, :none do |d|
177
- d.push 1
178
- d.set_local 0
179
- d.pop
180
- d.push_local 0
181
- end
182
- end
183
- end
184
-
185
- relates "m { n = 1; m { n } }" do
186
- compile do |g|
187
- d = new_block_generator(g)
188
-
189
- d.push_modifiers
190
- d.new_label.set! # redo
191
- d.push 1
192
- d.set_local 0
193
- d.pop
194
-
195
- e = new_block_generator(g)
196
-
197
- e.push_modifiers
198
- e.new_label.set! # redo
199
- e.push_local_depth 1, 0
200
- e.pop_modifiers
201
- e.ret
202
-
203
- d.push :self
204
- d.create_block(e)
205
- d.send_with_block :m, 0, true
206
-
207
- d.pop_modifiers
208
- d.ret
209
-
210
- g.push :self
211
- g.create_block(d)
212
- g.send_with_block :m, 0, true
213
- end
214
- end
215
-
216
- relates "n = 1; m { n = 2 }; n" do
217
- compile do |g|
218
- g.push 1
219
- g.set_local 0
220
- g.pop
221
-
222
- g.push :self
223
-
224
- g.in_block_send :m, :none do |d|
225
- d.push 2
226
- d.set_local_depth 1, 0
227
- end
228
-
229
- g.pop
230
- g.push_local 0
231
- end
232
- end
233
-
234
- relates "m(a) { |b| a + x }" do
235
- compile do |g|
236
- g.push :self
237
- g.push :self
238
- g.send :a, 0, true
239
-
240
- g.in_block_send :m, :single, nil, 1 do |d|
241
- d.push :self
242
- d.send :a, 0, true
243
- d.push :self
244
- d.send :x, 0, true
245
- d.send :+, 1, false
246
- end
247
- end
248
- end
249
-
250
- relates <<-ruby do
251
- m { |a|
252
- a + x
253
- }
254
- ruby
255
-
256
- compile(&single_arg_block)
257
- end
258
-
259
- relates <<-ruby do
260
- m do |a|
261
- a + x
262
- end
263
- ruby
264
-
265
- compile(&single_arg_block)
266
- end
267
-
268
- relates "obj.m { |a| a + x }" do
269
- compile do |g|
270
- g.push :self
271
- g.send :obj, 0, true
272
-
273
- g.in_block_send :m, :single, nil, 0, false do |d|
274
- d.push_local 0
275
- d.push :self
276
- d.send :x, 0, true
277
- d.send :+, 1, false
278
- end
279
- end
280
- end
281
-
282
- relates "obj.m(x) { |a| a + x }" do
283
- compile do |g|
284
- g.push :self
285
- g.send :obj, 0, true
286
- g.push :self
287
- g.send :x, 0, true
288
-
289
- g.in_block_send :m, :single, nil, 1, false do |d|
290
- d.push_local 0
291
- d.push :self
292
- d.send :x, 0, true
293
- d.send :+, 1, false
294
- end
295
- end
296
- end
297
-
298
- relates "obj.m(a) { |a| a + x }" do
299
- compile do |g|
300
- g.push :self
301
- g.send :obj, 0, true
302
- g.push :self
303
- g.send :a, 0, true
304
-
305
- g.in_block_send :m, :single, nil, 1, false do |d|
306
- d.push_local 0
307
- d.push :self
308
- d.send :x, 0, true
309
- d.send :+, 1, false
310
- end
311
- end
312
- end
313
-
314
- relates "a = 1; m { |a| a + x }" do
315
- ruby_version_is ""..."1.9" do
316
- compile do |g|
317
- g.push 1
318
- g.set_local 0
319
- g.pop
320
-
321
- g.push :self
322
-
323
- d = new_block_generator(g)
324
-
325
- d.cast_for_single_block_arg
326
- d.set_local_depth 1, 0
327
- d.pop
328
-
329
- d.push_modifiers
330
- d.new_label.set!
331
-
332
- d.push_local_depth 1, 0
333
- d.push :self
334
- d.send :x, 0, true
335
- d.send :+, 1, false
336
-
337
- d.pop_modifiers
338
- d.ret
339
-
340
- g.create_block(d)
341
-
342
- g.send_with_block :m, 0, true
343
- end
344
- end
345
-
346
- ruby_version_is "1.9" do
347
- compile do |g|
348
- g.push 1
349
- g.set_local 0
350
- g.pop
351
-
352
- g.push :self
353
-
354
- d = new_block_generator(g)
355
-
356
- d.push_modifiers
357
- d.new_label.set!
358
-
359
- d.push_local 0
360
- d.push :self
361
- d.send :x, 0, true
362
- d.send :+, 1, false
363
-
364
- d.pop_modifiers
365
- d.ret
366
-
367
- g.create_block(d)
368
-
369
- g.send_with_block :m, 0, true
370
- end
371
- end
372
- end
373
-
374
- relates <<-ruby do
375
- x = nil
376
- m do |a|
377
- begin
378
- x
379
- rescue Exception => x
380
- break
381
- ensure
382
- x = a
383
- end
384
- end
385
- ruby
386
-
387
- compile do |g|
388
- g.push :nil
389
- g.set_local 0
390
- g.pop
391
- g.push :self
392
-
393
- d = new_block_generator(g)
394
-
395
- ruby_version_is ""..."1.9" do
396
- d.cast_for_single_block_arg
397
- d.set_local 0
398
- d.pop
399
- end
400
-
401
- d.push_modifiers
402
-
403
- redo_lbl = d.new_label
404
- redo_lbl.set!
405
-
406
- d.for_ensure do |eb|
407
- eb.body do
408
- d.for_rescue do |rb|
409
- rb.body do
410
- d.push_local_depth 1, 0
411
- end
412
-
413
- rb.condition :Exception do
414
- d.push_current_exception
415
- d.set_local_depth 1, 0
416
- d.pop
417
- d.push :nil
418
-
419
- rb.break
420
- end
421
- end
422
- end
423
-
424
- eb.handler do
425
- d.push_local 0
426
- d.set_local_depth 1, 0
427
- d.pop
428
- end
429
- end
430
-
431
- d.pop_modifiers
432
- d.ret
433
-
434
- g.create_block(d)
435
-
436
- g.send_with_block :m, 0, true
437
- end
438
- end
439
-
440
- relates "m { next }" do
441
- compile do |g|
442
- g.push :self
443
-
444
- g.in_block_send :m, :none do |d|
445
- d.push :nil
446
- d.ret
447
- end
448
- end
449
- end
450
-
451
- relates "m { next if x }" do
452
- compile do |g|
453
- g.push :self
454
-
455
- g.in_block_send :m, :none do |d|
456
- f = d.new_label
457
- done = d.new_label
458
-
459
- d.push :self
460
- d.send :x, 0, true
461
- d.gif f
462
-
463
- d.push :nil
464
- d.ret
465
- d.goto done
466
-
467
- f.set!
468
- d.push :nil
469
-
470
- done.set!
471
- end
472
- end
473
- end
474
-
475
- relates "m { next x }" do
476
- compile do |g|
477
- g.push :self
478
-
479
- g.in_block_send :m, :none do |d|
480
- d.push :self
481
- d.send :x, 0, true
482
- d.ret
483
- end
484
- end
485
- end
486
-
487
- relates "m { x = 1; next x }" do
488
- compile do |g|
489
- g.push :self
490
-
491
- g.in_block_send :m, :none do |d|
492
- d.push 1
493
- d.set_local 0
494
- d.pop
495
- d.push_local 0
496
- d.ret
497
- end
498
- end
499
- end
500
-
501
- relates "m { next [1] }" do
502
- compile do |g|
503
- g.push :self
504
-
505
- g.in_block_send :m, :none do |d|
506
- d.push 1
507
- d.make_array 1
508
- d.ret
509
- end
510
- end
511
- end
512
-
513
- relates "m { next [*[1]] }" do
514
- compile do |g|
515
- g.push :self
516
-
517
- g.in_block_send :m, :none do |d|
518
- d.push 1
519
- d.make_array 1
520
- d.ret
521
- end
522
- end
523
- end
524
-
525
- relates "m { next [*[1, 2]] }" do
526
- compile do |g|
527
- g.push :self
528
-
529
- g.in_block_send :m, :none do |d|
530
- d.push 1
531
- d.push 2
532
- d.make_array 2
533
- d.ret
534
- end
535
- end
536
- end
537
-
538
- ruby_version_is ""..."1.9" do
539
- relates "m { next *[1] }" do
540
- compile do |g|
541
- g.push :self
542
-
543
- g.in_block_send :m, :none do |d|
544
- d.splatted_array
545
- d.ret
546
- end
547
- end
548
- end
549
-
550
- relates "m { next *[1, 2] }" do
551
- compile do |g|
552
- g.push :self
553
-
554
- g.in_block_send :m, :none do |d|
555
- d.splatted_array 2 do
556
- d.push 1
557
- d.push 2
558
- end
559
- d.ret
560
- end
561
- end
562
- end
563
- end
564
-
565
- ruby_version_is "1.9" do
566
- relates "m { next *[1] }" do
567
- compile do |g|
568
- g.push :self
569
-
570
- g.in_block_send :m, :none do |d|
571
- d.push 1
572
- d.make_array 1
573
- d.ret
574
- end
575
- end
576
- end
577
-
578
- relates "m { next *[1, 2] }" do
579
- compile do |g|
580
- g.push :self
581
-
582
- g.in_block_send :m, :none do |d|
583
- d.push 1
584
- d.push 2
585
- d.make_array 2
586
- d.ret
587
- end
588
- end
589
- end
590
- end
591
-
592
- relates "m { break }" do
593
- compile do |g|
594
- g.push :self
595
-
596
- g.in_block_send :m, :none do |d|
597
- d.push :nil
598
- d.raise_break
599
- end
600
- end
601
- end
602
-
603
- relates "m { break if x }" do
604
- compile do |g|
605
- g.push :self
606
-
607
- g.in_block_send :m, :none do |d|
608
- f = d.new_label
609
- done = d.new_label
610
-
611
- d.push :self
612
- d.send :x, 0, true
613
- d.gif f
614
-
615
- d.push :nil
616
- d.raise_break
617
- d.goto done
618
-
619
- f.set!
620
- d.push :nil
621
-
622
- done.set!
623
- end
624
- end
625
- end
626
-
627
- relates "m { break x }" do
628
- compile do |g|
629
- g.push :self
630
-
631
- g.in_block_send :m, :none do |d|
632
- d.push :self
633
- d.send :x, 0, true
634
- d.raise_break
635
- end
636
- end
637
- end
638
-
639
- relates "m { x = 1; break x }" do
640
- compile do |g|
641
- g.push :self
642
-
643
- g.in_block_send :m, :none do |d|
644
- d.push 1
645
- d.set_local 0
646
- d.pop
647
- d.push_local 0
648
- d.raise_break
649
- end
650
- end
651
- end
652
-
653
- relates "m { break [1] }" do
654
- compile do |g|
655
- g.push :self
656
-
657
- g.in_block_send :m, :none do |d|
658
- d.push 1
659
- d.make_array 1
660
- d.raise_break
661
- end
662
- end
663
- end
664
-
665
- ruby_version_is ""..."1.9" do
666
- relates "m { break *[1] }" do
667
- compile do |g|
668
- g.push :self
669
-
670
- g.in_block_send :m, :none do |d|
671
- d.splatted_array
672
- d.raise_break
673
- end
674
- end
675
- end
676
-
677
- relates "m { break *[1, 2] }" do
678
- compile do |g|
679
- g.push :self
680
-
681
- g.in_block_send :m, :none do |d|
682
- d.splatted_array 2 do
683
- d.push 1
684
- d.push 2
685
- end
686
- d.raise_break
687
- end
688
- end
689
- end
690
- end
691
-
692
- ruby_version_is "1.9" do
693
- relates "m { break *[1] }" do
694
- compile do |g|
695
- g.push :self
696
-
697
- g.in_block_send :m, :none do |d|
698
- d.push 1
699
- d.make_array 1
700
- d.raise_break
701
- end
702
- end
703
- end
704
-
705
- relates "m { break *[1, 2] }" do
706
- compile do |g|
707
- g.push :self
708
-
709
- g.in_block_send :m, :none do |d|
710
- d.push 1
711
- d.push 2
712
- d.make_array 2
713
- d.raise_break
714
- end
715
- end
716
- end
717
- end
718
-
719
- relates "m { break [*[1]] }" do
720
- compile do |g|
721
- g.push :self
722
-
723
- g.in_block_send :m, :none do |d|
724
- d.push 1
725
- d.make_array 1
726
- d.raise_break
727
- end
728
- end
729
- end
730
-
731
- relates "m { break [*[1, 2]] }" do
732
- compile do |g|
733
- g.push :self
734
-
735
- g.in_block_send :m, :none do |d|
736
- d.push 1
737
- d.push 2
738
- d.make_array 2
739
- d.raise_break
740
- end
741
- end
742
- end
743
-
744
- relates "m { return }" do
745
- compile do |g|
746
- g.push :self
747
-
748
- g.in_block_send :m, :none do |d|
749
- d.push :nil
750
- d.raise_return
751
- end
752
- end
753
- end
754
-
755
- relates "m { return if x }" do
756
- compile do |g|
757
- g.push :self
758
-
759
- g.in_block_send :m, :none do |d|
760
- f = d.new_label
761
- done = d.new_label
762
-
763
- d.push :self
764
- d.send :x, 0, true
765
- d.gif f
766
-
767
- d.push :nil
768
- d.raise_return
769
- d.goto done
770
-
771
- f.set!
772
- d.push :nil
773
-
774
- done.set!
775
- end
776
- end
777
- end
778
-
779
- relates "m { return x }" do
780
- compile do |g|
781
- g.push :self
782
-
783
- g.in_block_send :m, :none do |d|
784
- d.push :self
785
- d.send :x, 0, true
786
- d.raise_return
787
- end
788
- end
789
- end
790
-
791
- relates "m { x = 1; return x }" do
792
- compile do |g|
793
- g.push :self
794
-
795
- g.in_block_send :m, :none do |d|
796
- d.push 1
797
- d.set_local 0
798
- d.pop
799
- d.push_local 0
800
- d.raise_return
801
- end
802
- end
803
- end
804
-
805
- relates "m { return [1] }" do
806
- compile do |g|
807
- g.push :self
808
-
809
- g.in_block_send :m, :none do |d|
810
- d.push 1
811
- d.make_array 1
812
- d.raise_return
813
- end
814
- end
815
- end
816
-
817
- ruby_version_is ""..."1.9" do
818
- relates "m { return *[1] }" do
819
- compile do |g|
820
- g.push :self
821
-
822
- g.in_block_send :m, :none do |d|
823
- d.splatted_array
824
- d.raise_return
825
- end
826
- end
827
- end
828
-
829
- relates "m { return *[1, 2] }" do
830
- compile do |g|
831
- g.push :self
832
-
833
- g.in_block_send :m, :none do |d|
834
- d.splatted_array 2 do
835
- d.push 1
836
- d.push 2
837
- end
838
- d.raise_return
839
- end
840
- end
841
- end
842
- end
843
-
844
- ruby_version_is "1.9" do
845
- relates "m { return *[1] }" do
846
- compile do |g|
847
- g.push :self
848
-
849
- g.in_block_send :m, :none do |d|
850
- d.push 1
851
- d.make_array 1
852
- d.raise_return
853
- end
854
- end
855
- end
856
-
857
- relates "m { return *[1, 2] }" do
858
- compile do |g|
859
- g.push :self
860
-
861
- g.in_block_send :m, :none do |d|
862
- d.push 1
863
- d.push 2
864
- d.make_array 2
865
- d.raise_return
866
- end
867
- end
868
- end
869
- end
870
-
871
- relates "m { return [*[1]] }" do
872
- compile do |g|
873
- g.push :self
874
-
875
- g.in_block_send :m, :none do |d|
876
- d.push 1
877
- d.make_array 1
878
- d.raise_return
879
- end
880
- end
881
- end
882
-
883
- relates "m { return [*[1, 2]] }" do
884
- compile do |g|
885
- g.push :self
886
-
887
- g.in_block_send :m, :none do |d|
888
- d.push 1
889
- d.push 2
890
- d.make_array 2
891
- d.raise_return
892
- end
893
- end
894
- end
895
-
896
- relates "m { redo }" do
897
- compile do |g|
898
- g.push :self
899
-
900
- d = new_block_generator(g)
901
-
902
- redo_lbl = d.new_label
903
- d.push_modifiers
904
- redo_lbl.set!
905
- d.check_interrupts
906
- d.goto redo_lbl
907
- d.pop_modifiers
908
- d.ret
909
-
910
- g.create_block(d)
911
-
912
- g.send_with_block :m, 0, true
913
- end
914
- end
915
-
916
- relates "m { redo if x }" do
917
- compile do |g|
918
- g.push :self
919
-
920
- d = new_block_generator(g)
921
-
922
- redo_lbl = d.new_label
923
- f = d.new_label
924
- done = d.new_label
925
-
926
- d.push_modifiers
927
- redo_lbl.set!
928
-
929
- d.push :self
930
- d.send :x, 0, true
931
- d.gif f
932
-
933
- d.check_interrupts
934
- d.goto redo_lbl
935
- d.goto done
936
-
937
- f.set!
938
- d.push :nil
939
-
940
- done.set!
941
- d.pop_modifiers
942
- d.ret
943
-
944
- g.create_block(d)
945
-
946
- g.send_with_block :m, 0, true
947
- end
948
- end
949
-
950
- relates "m(a) { retry }" do
951
- # TODO
952
- end
953
-
954
- relates "m(a) { retry if x }" do
955
- # TODO
956
- end
957
-
958
- relates "break" do
959
- compile do |g|
960
- g.push :nil
961
- g.pop
962
- g.push_rubinius
963
- g.push_literal :break
964
- g.send :jump_error, 1
965
- end
966
- end
967
-
968
- relates "redo" do
969
- compile do |g|
970
- g.push_rubinius
971
- g.push_literal :redo
972
- g.send :jump_error, 1
973
- end
974
- end
975
-
976
- relates "retry" do
977
- compile do |g|
978
- g.push_rubinius
979
- g.push_literal :retry
980
- g.send :jump_error, 1
981
- end
982
- end
983
-
984
- relates "next" do
985
- compile do |g|
986
- g.push :nil
987
- g.pop
988
- g.push_rubinius
989
- g.push_literal :next
990
- g.send :jump_error, 1
991
- end
992
- end
993
-
994
- relates <<-ruby do
995
- def x(a)
996
- bar { super }
997
- end
998
- ruby
999
-
1000
- compile do |g|
1001
- in_method :x do |d|
1002
- d.push :self
1003
-
1004
- d.in_block_send :bar, :none do |e|
1005
- e.push_block
1006
- e.zsuper :x
1007
- end
1008
- end
1009
- end
1010
- end
1011
- end