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/return_spec.rb DELETED
@@ -1,152 +0,0 @@
1
- describe "A Return node" do
2
- relates "return" do
3
- compile do |g|
4
- g.push :nil
5
- g.ret
6
- end
7
- end
8
-
9
- relates "return 1" do
10
- compile do |g|
11
- g.push 1
12
- g.ret
13
- end
14
- end
15
-
16
- ruby_version_is ""..."1.9" do
17
- relates "return *1" do
18
- compile do |g|
19
- bottom = g.new_label
20
-
21
- g.push 1
22
- g.cast_array
23
- g.dup
24
- g.send :size, 0
25
- g.push 1
26
- g.send :>, 1
27
- g.git bottom
28
-
29
- g.push 0
30
- g.send :at, 1
31
-
32
- bottom.set!
33
-
34
- g.ret
35
- end
36
- end
37
-
38
- relates <<-ruby do
39
- x = 1, 2
40
- return *x
41
- ruby
42
-
43
- compile do |g|
44
- g.push 1
45
- g.push 2
46
- g.make_array 2
47
- g.set_local 0
48
- g.pop
49
-
50
- bottom = g.new_label
51
-
52
- g.push_local 0
53
- g.cast_array
54
- g.dup
55
- g.send :size, 0
56
- g.push 1
57
- g.send :>, 1
58
- g.git bottom
59
-
60
- g.push 0
61
- g.send :at, 1
62
-
63
- bottom.set!
64
-
65
- g.ret
66
- end
67
- end
68
-
69
- relates "return *[1]" do
70
- compile do |g|
71
- g.splatted_array
72
- g.ret
73
- end
74
- end
75
- end
76
-
77
- ruby_version_is "1.9" do
78
- relates "return *1" do
79
- compile do |g|
80
- bottom = g.new_label
81
-
82
- g.push 1
83
- g.cast_array
84
-
85
- g.ret
86
- end
87
- end
88
-
89
- relates <<-ruby do
90
- x = 1, 2
91
- return *x
92
- ruby
93
-
94
- compile do |g|
95
- g.push 1
96
- g.push 2
97
- g.make_array 2
98
- g.set_local 0
99
- g.pop
100
-
101
- g.push_local 0
102
- g.cast_array
103
-
104
- g.ret
105
- end
106
- end
107
-
108
- relates "return *[1]" do
109
- compile do |g|
110
- bottom = g.new_label
111
-
112
- g.push 1
113
- g.make_array 1
114
-
115
- g.ret
116
- end
117
- end
118
- end
119
-
120
- relates "return 1, 2, 3" do
121
- compile do |g|
122
- g.push 1
123
- g.push 2
124
- g.push 3
125
- g.make_array 3
126
- g.ret
127
- end
128
- end
129
-
130
- relates "return 1, 2, *c" do
131
- compile do |g|
132
- g.push 1
133
- g.push 2
134
- g.make_array 2
135
-
136
- g.push :self
137
- g.send :c, 0, true
138
- g.cast_array
139
-
140
- g.send :+, 1
141
- g.ret
142
- end
143
- end
144
-
145
- relates "return [*[1]]" do
146
- compile do |g|
147
- g.push 1
148
- g.make_array 1
149
- g.ret
150
- end
151
- end
152
- end
data/spec/sclass_spec.rb DELETED
@@ -1,138 +0,0 @@
1
- describe "An Sclass node" do
2
- relates <<-ruby do
3
- class << self
4
- 42
5
- end
6
- ruby
7
-
8
- compile do |g|
9
- g.push :self
10
- g.push_type
11
- g.swap
12
- g.send :object_singleton_class, 1
13
-
14
- d = new_generator(g)
15
-
16
- g.create_block d
17
-
18
- d.push_self
19
- d.add_scope
20
- d.push 42
21
- d.ret
22
-
23
- g.swap
24
- g.push_scope
25
- g.push_true
26
- g.send :call_under, 3
27
- end
28
- end
29
-
30
- relates <<-ruby do
31
- class A
32
- class << self
33
- a
34
- end
35
- class B
36
- end
37
- end
38
- ruby
39
-
40
- compile do |g|
41
- in_class :A do |d|
42
-
43
-
44
- d.push :self
45
- d.push_type
46
- d.swap
47
- d.send :object_singleton_class, 1
48
-
49
- e = new_generator(g)
50
-
51
- d.create_block(e)
52
-
53
- e.push_self
54
- e.add_scope
55
- e.push :self
56
- e.send :a, 0, true
57
- e.ret
58
-
59
- d.swap
60
- d.push_scope
61
- d.push_true
62
- d.send :call_under, 3
63
-
64
- d.pop
65
- d.in_class :B
66
- d.pop
67
- d.push :nil
68
- end
69
- end
70
- end
71
-
72
- relates <<-ruby do
73
- x = "a"
74
- class << x
75
- end
76
- ruby
77
-
78
- compile do |g|
79
- g.push_literal "a"
80
- g.string_dup
81
- g.set_local 0
82
- g.pop
83
- g.push_local 0
84
- g.push_type
85
- g.swap
86
- g.send :object_singleton_class, 1
87
- g.pop
88
- g.push :nil
89
- end
90
- end
91
-
92
- relates <<-ruby do
93
- x = "a"
94
- m do
95
- class << x
96
- end
97
- end
98
- ruby
99
-
100
- compile do |g|
101
- g.push_literal "a"
102
- g.string_dup
103
- g.set_local 0
104
- g.pop
105
-
106
- g.push :self
107
-
108
- g.in_block_send :m, :none do |d|
109
- d.push_local_depth 1, 0
110
- d.push_type
111
- d.swap
112
- d.send :object_singleton_class, 1
113
- d.pop
114
- d.push :nil
115
- end
116
- end
117
- end
118
-
119
- relates <<-ruby do
120
- x = "a"
121
- class << x
122
- self
123
- end
124
- ruby
125
-
126
- compile do |g|
127
- g.push_literal "a"
128
- g.string_dup
129
- g.set_local 0
130
- g.pop
131
-
132
- g.push_local 0
133
- g.push_type
134
- g.swap
135
- g.send :object_singleton_class, 1
136
- end
137
- end
138
- end
data/spec/spec_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'rubinius/bridge'
2
- require 'rubinius/toolset'
3
-
4
- Rubinius::ToolSets.create :spec do
5
- require "rubinius/melbourne"
6
- require "rubinius/processor"
7
- require "rubinius/compiler"
8
- require "rubinius/ast"
9
-
10
- require 'spec/custom/matchers/compile_as'
11
- require 'spec/custom/runner/relates'
12
- end
data/spec/str_spec.rb DELETED
@@ -1,118 +0,0 @@
1
- describe "A Str node" do
2
- relates '"x"' do
3
- compile do |g|
4
- g.push_literal "x"
5
- g.string_dup
6
- end
7
- end
8
-
9
- str_concat = lambda do |g|
10
- g.push_literal "before after"
11
- g.string_dup
12
- end
13
-
14
- relates <<-ruby do
15
- "before" \
16
- " after"
17
- ruby
18
-
19
- compile(&str_concat)
20
- end
21
-
22
- relates '"before" " after"' do
23
- compile(&str_concat)
24
- end
25
-
26
- relates <<-ruby do
27
- "file = \#{__FILE__}\n"
28
- ruby
29
-
30
- compile do |g|
31
- g.push_literal "file = "
32
-
33
- g.push_scope
34
- g.send :active_path, 0
35
- g.meta_to_s
36
-
37
- g.push_literal "\n"
38
-
39
- g.string_build 3
40
- end
41
- end
42
-
43
- relates <<-ruby do
44
- <<'EOM'.strip
45
- blah
46
- blah
47
- EOM
48
- ruby
49
-
50
- compile do |g|
51
- g.push_literal " blah\nblah\n"
52
- g.string_dup
53
- g.send :strip, 0, false
54
- end
55
- end
56
-
57
- relates <<-ruby do
58
- a += <<-H1 + b + <<-H2
59
- first
60
- H1
61
- second
62
- H2
63
- ruby
64
-
65
- compile do |g|
66
- g.push_local 0
67
-
68
- g.push_literal " first\n"
69
- g.string_dup
70
-
71
- g.push :self
72
- g.send :b, 0, true
73
- g.send :+, 1, false
74
-
75
- g.push_literal " second\n"
76
- g.string_dup
77
-
78
- g.send :+, 1, false
79
- g.send :+, 1, false
80
-
81
- g.set_local 0
82
- end
83
- end
84
-
85
- relates <<-ruby do
86
- <<-EOM
87
- blah
88
- blah
89
-
90
- EOM
91
- ruby
92
-
93
- compile do |g|
94
- g.push_literal " blah\nblah\n\n"
95
- g.string_dup
96
- end
97
- end
98
-
99
- relates <<-ruby do
100
- <<'EOM'
101
- blah
102
- blah
103
- EOM
104
- ruby
105
-
106
- compile do |g|
107
- g.push_literal " blah\nblah\n"
108
- g.string_dup
109
- end
110
- end
111
-
112
- relates "%(blah)" do
113
- compile do |g|
114
- g.push_literal "blah"
115
- g.string_dup
116
- end
117
- end
118
- end
data/spec/super_spec.rb DELETED
@@ -1,170 +0,0 @@
1
- describe "A Super node" do
2
- relates <<-ruby do
3
- def x
4
- super()
5
- end
6
- ruby
7
-
8
- compile do |g|
9
- in_method :x do |d|
10
- d.push_block
11
- d.send_super :x, 0
12
- end
13
- end
14
- end
15
-
16
- relates <<-ruby do
17
- def x(&block)
18
- super(&block)
19
- end
20
- ruby
21
-
22
- compile do |g|
23
- in_method :x do |d|
24
- d.block_arg 0
25
-
26
- is_nil = d.new_label
27
- d.push_local 0
28
- d.dup
29
- d.is_nil
30
- d.git is_nil
31
- d.push_cpath_top
32
- d.find_const :Proc
33
- d.swap
34
- d.send :__from_block__, 1
35
- is_nil.set!
36
- d.send_super :x, 0
37
- end
38
- end
39
- end
40
-
41
- relates <<-ruby do
42
- def x
43
- super([24, 42])
44
- end
45
- ruby
46
-
47
- compile do |g|
48
- in_method :x do |d|
49
- d.push 24
50
- d.push 42
51
- d.make_array 2
52
- d.push_block
53
- d.send_super :x, 1
54
- end
55
- end
56
- end
57
-
58
- relates <<-ruby do
59
- def x
60
- super(4)
61
- end
62
- ruby
63
-
64
- compile do |g|
65
- in_method :x do |d|
66
- d.push 4
67
- d.push_block
68
- d.send_super :x, 1
69
- end
70
- end
71
- end
72
-
73
- relates "super(a, &b)" do
74
- compile do |g|
75
- t = g.new_label
76
-
77
- g.push :self
78
- g.send :a, 0, true
79
-
80
- g.push :self
81
- g.send :b, 0, true
82
-
83
- g.dup
84
- g.is_nil
85
- g.git t
86
-
87
- g.push_cpath_top
88
- g.find_const :Proc
89
- g.swap
90
-
91
- g.send :__from_block__, 1
92
-
93
- t.set!
94
-
95
- # nil here because the test isn't wrapped in a method, so
96
- # there is no current method to pull the name of the method
97
- # from
98
- g.send_super nil, 1
99
- end
100
- end
101
-
102
- relates "super(a, *b)" do
103
- compile do |g|
104
- g.push :self
105
- g.send :a, 0, true
106
-
107
- g.push :self
108
- g.send :b, 0, true
109
-
110
- g.cast_array
111
-
112
- g.push_block
113
-
114
- # nil here because the test isn't wrapped in a method, so
115
- # there is no current method to pull the name of the method
116
- # from
117
- g.send_super nil, 1, true
118
- end
119
- end
120
-
121
- relates <<-ruby do
122
- def f(*)
123
- super
124
- end
125
- ruby
126
-
127
- compile do |g|
128
- in_method :f do |d|
129
- d.push_block
130
- d.zsuper :f
131
- end
132
- end
133
- end
134
-
135
- relates <<-ruby do
136
- def x
137
- super(24, 42)
138
- end
139
- ruby
140
-
141
- compile do |g|
142
- in_method :x do |d|
143
- d.push 24
144
- d.push 42
145
- d.push_block
146
- d.send_super :x, 2
147
- end
148
- end
149
- end
150
-
151
- relates "super([*[1]])" do
152
- compile do |g|
153
- g.push 1
154
- g.make_array 1
155
- g.push_block
156
- g.send_super nil, 1
157
- end
158
- end
159
-
160
- relates "super(*[1])" do
161
- compile do |g|
162
- g.push 1
163
- g.make_array 1
164
- g.cast_array
165
-
166
- g.push_block
167
- g.send_super nil, 0, true
168
- end
169
- end
170
- end