rubinius-compiler 2.3.1 → 3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubinius/code/compiler.rb +10 -0
- data/lib/rubinius/{compiler → code/compiler}/compiled_file.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/compiler.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/evaluator.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/generator.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/generator_methods.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/iseq.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/locals.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/opcodes.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/printers.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/stages.rb +0 -0
- data/lib/rubinius/{compiler → code/compiler}/version.rb +1 -1
- metadata +23 -271
- data/.gitignore +0 -17
- data/.travis.yml +0 -8
- data/Gemfile +0 -4
- data/LICENSE +0 -25
- data/README.md +0 -29
- data/Rakefile +0 -1
- data/lib/rubinius/compiler.rb +0 -10
- data/rubinius-compiler.gemspec +0 -28
- data/spec/alias_spec.rb +0 -39
- data/spec/and_spec.rb +0 -44
- data/spec/array_spec.rb +0 -110
- data/spec/attrasgn_spec.rb +0 -186
- data/spec/back_ref_spec.rb +0 -11
- data/spec/call_spec.rb +0 -580
- data/spec/case_spec.rb +0 -576
- data/spec/cdecl_spec.rb +0 -70
- data/spec/class_spec.rb +0 -120
- data/spec/colon2_spec.rb +0 -8
- data/spec/colon3_spec.rb +0 -8
- data/spec/const_spec.rb +0 -7
- data/spec/custom/guards/profiler.rb +0 -18
- data/spec/custom/helpers/generator.rb +0 -828
- data/spec/custom/matchers/compile_as.rb +0 -46
- data/spec/custom/mspec.rb +0 -15
- data/spec/custom/runner/actions/debug.rb +0 -10
- data/spec/custom/runner/actions/gcstats.rb +0 -17
- data/spec/custom/runner/actions/memory.rb +0 -11
- data/spec/custom/runner/actions/parser.rb +0 -14
- data/spec/custom/runner/actions/profiler.rb +0 -19
- data/spec/custom/runner/relates.rb +0 -86
- data/spec/custom/utils/options.rb +0 -40
- data/spec/custom/utils/script.rb +0 -50
- data/spec/cvar_spec.rb +0 -39
- data/spec/cvasgn_spec.rb +0 -33
- data/spec/cvdecl_spec.rb +0 -17
- data/spec/defined_spec.rb +0 -616
- data/spec/defn_spec.rb +0 -732
- data/spec/defs_spec.rb +0 -113
- data/spec/dot2_spec.rb +0 -16
- data/spec/dot3_spec.rb +0 -17
- data/spec/dregx_spec.rb +0 -160
- data/spec/dstr_spec.rb +0 -424
- data/spec/dsym_spec.rb +0 -18
- data/spec/dxstr_spec.rb +0 -24
- data/spec/ensure_spec.rb +0 -196
- data/spec/false_spec.rb +0 -7
- data/spec/flip2_spec.rb +0 -21
- data/spec/flip3_spec.rb +0 -12
- data/spec/for_spec.rb +0 -228
- data/spec/gasgn_spec.rb +0 -15
- data/spec/generator/encode_spec.rb +0 -34
- data/spec/gvar_spec.rb +0 -37
- data/spec/hash_spec.rb +0 -108
- data/spec/iasgn_spec.rb +0 -26
- data/spec/if_spec.rb +0 -415
- data/spec/iter_spec.rb +0 -1011
- data/spec/lasgn_spec.rb +0 -561
- data/spec/lit_spec.rb +0 -61
- data/spec/masgn_spec.rb +0 -1558
- data/spec/match2_spec.rb +0 -42
- data/spec/match3_spec.rb +0 -54
- data/spec/match_spec.rb +0 -29
- data/spec/module_spec.rb +0 -73
- data/spec/nil_spec.rb +0 -7
- data/spec/not_spec.rb +0 -47
- data/spec/nth_ref_spec.rb +0 -7
- data/spec/op_asgn_spec.rb +0 -563
- data/spec/or_spec.rb +0 -126
- data/spec/postexe_spec.rb +0 -11
- data/spec/preexe_spec.rb +0 -21
- data/spec/regex_spec.rb +0 -54
- data/spec/rescue_spec.rb +0 -763
- data/spec/return_spec.rb +0 -152
- data/spec/sclass_spec.rb +0 -138
- data/spec/spec_helper.rb +0 -12
- data/spec/str_spec.rb +0 -118
- data/spec/super_spec.rb +0 -170
- data/spec/transforms/assembly_spec.rb +0 -195
- data/spec/transforms/block_given_spec.rb +0 -75
- data/spec/transforms/fast_coerce_spec.rb +0 -112
- data/spec/transforms/fast_new_spec.rb +0 -255
- data/spec/transforms/invoke_primitive_spec.rb +0 -14
- data/spec/transforms/kernel_methods_spec.rb +0 -29
- data/spec/transforms/primitive_spec.rb +0 -33
- data/spec/transforms/privately_spec.rb +0 -24
- data/spec/true_spec.rb +0 -7
- data/spec/undef_spec.rb +0 -133
- data/spec/until_spec.rb +0 -254
- data/spec/valias_spec.rb +0 -11
- data/spec/while_spec.rb +0 -494
- data/spec/xstr_spec.rb +0 -10
- data/spec/yield_spec.rb +0 -92
- data/spec/zsuper_spec.rb +0 -63
data/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Rubinius::Compiler
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'rubinius-compiler'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install rubinius-compiler
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
data/lib/rubinius/compiler.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require "rubinius/compiler/compiler"
|
2
|
-
require "rubinius/compiler/stages"
|
3
|
-
require "rubinius/compiler/locals"
|
4
|
-
require "rubinius/compiler/generator_methods"
|
5
|
-
require "rubinius/compiler/generator"
|
6
|
-
require "rubinius/compiler/iseq"
|
7
|
-
require "rubinius/compiler/opcodes"
|
8
|
-
require "rubinius/compiler/compiled_file"
|
9
|
-
require "rubinius/compiler/evaluator"
|
10
|
-
require "rubinius/compiler/printers"
|
data/rubinius-compiler.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require './lib/rubinius/compiler/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "rubinius-compiler"
|
6
|
-
spec.version = CodeTools::Compiler::VERSION
|
7
|
-
spec.authors = ["Brian Shirai"]
|
8
|
-
spec.email = ["brixen@gmail.com"]
|
9
|
-
spec.description = %q{Rubinius bytecode compiler.}
|
10
|
-
spec.summary = %q{Rubinius bytecode compiler.}
|
11
|
-
spec.homepage = "https://github.com/rubinius/rubinius-compiler"
|
12
|
-
spec.license = "BSD"
|
13
|
-
|
14
|
-
spec.files = `git ls-files`.split($/)
|
15
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
|
19
|
-
spec.required_ruby_version = ">= 1.9.2"
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "mspec", "~> 1.5"
|
24
|
-
spec.add_development_dependency "rubinius-processor", "~> 2.0"
|
25
|
-
spec.add_development_dependency "rubinius-ast", "~> 2.0"
|
26
|
-
spec.add_development_dependency "rubinius-bridge", "~> 1.0"
|
27
|
-
spec.add_development_dependency "redcard", "~> 1.0"
|
28
|
-
end
|
data/spec/alias_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
describe "An Alias node" do
|
2
|
-
alias_both = lambda do |g|
|
3
|
-
g.push_scope
|
4
|
-
g.push_literal :y
|
5
|
-
g.push_literal :x
|
6
|
-
g.send :alias_method, 2, true
|
7
|
-
end
|
8
|
-
|
9
|
-
relates "alias :y :x" do
|
10
|
-
compile(&alias_both)
|
11
|
-
end
|
12
|
-
|
13
|
-
relates "alias y x" do
|
14
|
-
compile(&alias_both)
|
15
|
-
end
|
16
|
-
|
17
|
-
relates <<-ruby do
|
18
|
-
alias :"y\#{1}" :"x\#{2}"
|
19
|
-
ruby
|
20
|
-
|
21
|
-
compile do |g|
|
22
|
-
g.push_scope
|
23
|
-
|
24
|
-
g.push_literal "y"
|
25
|
-
g.push 1
|
26
|
-
g.meta_to_s
|
27
|
-
g.string_build 2
|
28
|
-
g.send :to_sym, 0, true
|
29
|
-
|
30
|
-
g.push_literal "x"
|
31
|
-
g.push 2
|
32
|
-
g.meta_to_s
|
33
|
-
g.string_build 2
|
34
|
-
g.send :to_sym, 0, true
|
35
|
-
|
36
|
-
g.send :alias_method, 2, true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/spec/and_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
describe "An And node" do
|
2
|
-
relates "(a and b)" do
|
3
|
-
compile do |g|
|
4
|
-
g.push :self
|
5
|
-
g.send :a, 0, true
|
6
|
-
g.dup
|
7
|
-
|
8
|
-
lhs_true = g.new_label
|
9
|
-
g.gif lhs_true
|
10
|
-
|
11
|
-
g.pop
|
12
|
-
g.push :self
|
13
|
-
g.send :b, 0, true
|
14
|
-
|
15
|
-
lhs_true.set!
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
relates "() and a" do
|
20
|
-
compile do |g|
|
21
|
-
f = g.new_label
|
22
|
-
g.push :nil
|
23
|
-
g.dup
|
24
|
-
g.gif f
|
25
|
-
g.pop
|
26
|
-
g.push :self
|
27
|
-
g.send :a, 0, true
|
28
|
-
f.set!
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
relates "a and ()" do
|
33
|
-
compile do |g|
|
34
|
-
f = g.new_label
|
35
|
-
g.push :self
|
36
|
-
g.send :a, 0, true
|
37
|
-
g.dup
|
38
|
-
g.gif f
|
39
|
-
g.pop
|
40
|
-
g.push :nil
|
41
|
-
f.set!
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/array_spec.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
describe "An Array node" do
|
2
|
-
relates '[1, :b, "c"]' do
|
3
|
-
compile do |g|
|
4
|
-
g.push 1
|
5
|
-
g.push_literal :b
|
6
|
-
g.push_literal "c"
|
7
|
-
g.string_dup
|
8
|
-
g.make_array 3
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
relates "%w[a b c]" do
|
13
|
-
compile do |g|
|
14
|
-
g.push_literal "a"
|
15
|
-
g.string_dup
|
16
|
-
g.push_literal "b"
|
17
|
-
g.string_dup
|
18
|
-
g.push_literal "c"
|
19
|
-
g.string_dup
|
20
|
-
g.make_array 3
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
relates '%w[a #{@b} c]' do
|
25
|
-
compile do |g|
|
26
|
-
g.push_literal "a"
|
27
|
-
g.string_dup
|
28
|
-
|
29
|
-
g.push_literal "\#{@b}"
|
30
|
-
g.string_dup
|
31
|
-
|
32
|
-
g.push_literal "c"
|
33
|
-
g.string_dup
|
34
|
-
g.make_array 3
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
relates "%W[a b c]" do
|
39
|
-
compile do |g|
|
40
|
-
g.push_literal "a"
|
41
|
-
g.string_dup
|
42
|
-
g.push_literal "b"
|
43
|
-
g.string_dup
|
44
|
-
g.push_literal "c"
|
45
|
-
g.string_dup
|
46
|
-
g.make_array 3
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
relates '%W[a #{@b} c]' do
|
51
|
-
compile do |g|
|
52
|
-
g.push_literal "a"
|
53
|
-
g.string_dup
|
54
|
-
|
55
|
-
g.push_ivar :@b
|
56
|
-
g.meta_to_s
|
57
|
-
g.string_build 1
|
58
|
-
|
59
|
-
g.push_literal "c"
|
60
|
-
g.string_dup
|
61
|
-
g.make_array 3
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
relates "[*[1]]" do
|
66
|
-
compile do |g|
|
67
|
-
g.push 1
|
68
|
-
g.make_array 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
relates "[*1]" do
|
73
|
-
compile do |g|
|
74
|
-
g.push 1
|
75
|
-
g.cast_array
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
relates "[[*1]]" do
|
80
|
-
compile do |g|
|
81
|
-
g.push 1
|
82
|
-
g.cast_array
|
83
|
-
g.make_array 1
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
relates "[1, *2]" do
|
88
|
-
compile do |g|
|
89
|
-
g.push 1
|
90
|
-
g.make_array 1
|
91
|
-
|
92
|
-
g.push 2
|
93
|
-
g.cast_array
|
94
|
-
|
95
|
-
g.send :+, 1
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
relates "[1, *c()]" do
|
100
|
-
# TODO
|
101
|
-
end
|
102
|
-
|
103
|
-
relates <<-ruby do
|
104
|
-
x = [2]
|
105
|
-
[1, *x]
|
106
|
-
ruby
|
107
|
-
|
108
|
-
# TODO
|
109
|
-
end
|
110
|
-
end
|
data/spec/attrasgn_spec.rb
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
describe "An Attrasgn node" do
|
2
|
-
relates <<-ruby do
|
3
|
-
y = 0
|
4
|
-
42.method = y
|
5
|
-
ruby
|
6
|
-
|
7
|
-
compile do |g|
|
8
|
-
g.push 0
|
9
|
-
g.set_local 0
|
10
|
-
g.pop
|
11
|
-
g.push 42
|
12
|
-
g.push_local 0
|
13
|
-
g.dup
|
14
|
-
g.move_down 2
|
15
|
-
g.send :method=, 1, false
|
16
|
-
g.pop
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
relates "a.m = *[1]" do
|
21
|
-
# attrasgn_splat
|
22
|
-
end
|
23
|
-
|
24
|
-
relates "a[*b] = c" do
|
25
|
-
compile do |g|
|
26
|
-
g.push :self
|
27
|
-
g.send :a, 0, true
|
28
|
-
g.push :self
|
29
|
-
g.send :b, 0, true
|
30
|
-
g.cast_array
|
31
|
-
g.push :self
|
32
|
-
g.send :c, 0, true
|
33
|
-
g.dup
|
34
|
-
g.move_down 3
|
35
|
-
g.swap
|
36
|
-
g.push :nil
|
37
|
-
g.send_with_splat :[]=, 1, false, true
|
38
|
-
g.pop
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
relates "a[b, *c] = d" do
|
43
|
-
compile do |g|
|
44
|
-
g.push :self
|
45
|
-
g.send :a, 0, true
|
46
|
-
g.push :self
|
47
|
-
g.send :b, 0, true
|
48
|
-
g.make_array 1
|
49
|
-
g.push :self
|
50
|
-
g.send :c, 0, true
|
51
|
-
g.cast_array
|
52
|
-
g.send :+, 1
|
53
|
-
g.push :self
|
54
|
-
g.send :d, 0, true
|
55
|
-
g.dup
|
56
|
-
g.move_down 3
|
57
|
-
g.swap
|
58
|
-
g.push :nil
|
59
|
-
g.send_with_splat :[]=, 1, false, true
|
60
|
-
g.pop
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
relates "a[b, *c] = *d" do
|
65
|
-
compile do |g|
|
66
|
-
g.push :self
|
67
|
-
g.send :a, 0, true
|
68
|
-
g.push :self
|
69
|
-
g.send :b, 0, true
|
70
|
-
g.make_array 1
|
71
|
-
g.push :self
|
72
|
-
g.send :c, 0, true
|
73
|
-
g.cast_array
|
74
|
-
g.send :+, 1
|
75
|
-
g.push :self
|
76
|
-
g.send :d, 0, true
|
77
|
-
g.cast_array
|
78
|
-
g.dup
|
79
|
-
g.move_down 3
|
80
|
-
g.swap
|
81
|
-
g.push :nil
|
82
|
-
g.send_with_splat :[]=, 1, false, true
|
83
|
-
g.pop
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
relates "a[b, *c] = d, e" do
|
88
|
-
compile do |g|
|
89
|
-
g.push :self
|
90
|
-
g.send :a, 0, true
|
91
|
-
g.push :self
|
92
|
-
g.send :b, 0, true
|
93
|
-
g.make_array 1
|
94
|
-
g.push :self
|
95
|
-
g.send :c, 0, true
|
96
|
-
g.cast_array
|
97
|
-
g.send :+, 1
|
98
|
-
g.push :self
|
99
|
-
g.send :d, 0, true
|
100
|
-
g.push :self
|
101
|
-
g.send :e, 0, true
|
102
|
-
g.make_array 2
|
103
|
-
g.dup
|
104
|
-
g.move_down 3
|
105
|
-
g.swap
|
106
|
-
g.push :nil
|
107
|
-
g.send_with_splat :[]=, 1, false, true
|
108
|
-
g.pop
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
relates "a[42] = 24" do
|
113
|
-
compile do |g|
|
114
|
-
g.push :self
|
115
|
-
g.send :a, 0, true
|
116
|
-
g.push 42
|
117
|
-
g.push 24
|
118
|
-
g.dup
|
119
|
-
g.move_down 3
|
120
|
-
g.send :[]=, 2, false
|
121
|
-
g.pop
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
relates "self[index, 0] = other_string" do
|
126
|
-
compile do |g|
|
127
|
-
g.push :self
|
128
|
-
g.push :self
|
129
|
-
g.send :index, 0, true
|
130
|
-
g.push 0
|
131
|
-
g.push :self
|
132
|
-
g.send :other_string, 0, true
|
133
|
-
g.dup
|
134
|
-
g.move_down 4
|
135
|
-
g.send :[]=, 3, true
|
136
|
-
g.pop
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
relates <<-ruby do
|
141
|
-
a = []
|
142
|
-
a [42] = 24
|
143
|
-
ruby
|
144
|
-
|
145
|
-
compile do |g|
|
146
|
-
g.make_array 0
|
147
|
-
g.set_local 0
|
148
|
-
g.pop
|
149
|
-
g.push_local 0
|
150
|
-
g.push 42
|
151
|
-
g.push 24
|
152
|
-
g.dup
|
153
|
-
g.move_down 3
|
154
|
-
g.send :[]=, 2, false
|
155
|
-
g.pop
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
ruby_version_is ""..."1.9" do
|
160
|
-
relates "m { |a.b| }" do
|
161
|
-
compile do |g|
|
162
|
-
g.push :self
|
163
|
-
|
164
|
-
d = new_block_generator(g)
|
165
|
-
|
166
|
-
d.cast_for_single_block_arg
|
167
|
-
|
168
|
-
d.push :self
|
169
|
-
d.send :a, 0, true
|
170
|
-
d.swap
|
171
|
-
d.send :b=, 1, false
|
172
|
-
d.pop
|
173
|
-
|
174
|
-
d.push_modifiers
|
175
|
-
d.new_label.set!
|
176
|
-
d.push :nil
|
177
|
-
d.pop_modifiers
|
178
|
-
d.ret
|
179
|
-
|
180
|
-
g.create_block(d)
|
181
|
-
|
182
|
-
g.send_with_block :m, 0, true
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|