rubinius-compiler 2.1.1 → 2.2.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.
- checksums.yaml +4 -4
- data/lib/rubinius/compiler.rb +0 -1
- data/lib/rubinius/compiler/compiled_file.rb +3 -1
- data/lib/rubinius/compiler/compiler.rb +1 -1
- data/lib/rubinius/compiler/evaluator.rb +2 -2
- data/lib/rubinius/compiler/generator.rb +6 -2
- data/lib/rubinius/compiler/generator_methods.rb +1 -1
- data/lib/rubinius/compiler/locals.rb +1 -1
- data/lib/rubinius/compiler/printers.rb +1 -1
- data/lib/rubinius/compiler/stages.rb +6 -6
- data/lib/rubinius/compiler/version.rb +2 -2
- data/rubinius-compiler.gemspec +1 -3
- metadata +2 -17
- data/lib/rubinius/compiler/runtime.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dd9fd0e49db22c941646e4853543e677fb23114
|
4
|
+
data.tar.gz: a4c1802c05c7db3f7eed86823149defbdcb54c42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04322de0c555568a219143b19c0d4e202dc5ab975c7cc066242f28e925097eab8afaabb79d676ceaa5fd45bcab311210f75eb4409dcc8ae1d669a466cd5aca11
|
7
|
+
data.tar.gz: d0f84e7cca7a0c0835028ad44d14febc074f687816888a47d3dc3ffa37510f8f13749b02da5d20904ea162123695ff87443460d5718f1e78f030b55c4de989c6
|
data/lib/rubinius/compiler.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: ascii-8bit -*-
|
2
2
|
|
3
|
-
module
|
3
|
+
module CodeTools
|
4
4
|
##
|
5
5
|
# A decode for the .rbc file format.
|
6
6
|
|
@@ -318,6 +318,8 @@ module Rubinius::ToolSets.current::ToolSet
|
|
318
318
|
str.append marshal(val.post_args)
|
319
319
|
str.append marshal(val.total_args)
|
320
320
|
str.append marshal(val.splat)
|
321
|
+
str.append marshal(val.keywords)
|
322
|
+
str.append marshal(val.arity)
|
321
323
|
str.append marshal(val.literals)
|
322
324
|
str.append marshal(val.lines)
|
323
325
|
str.append marshal(val.file)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
# Used for the Rubinius::asm Compiler hook.
|
5
5
|
|
6
|
-
module
|
6
|
+
module CodeTools
|
7
7
|
module AST
|
8
8
|
class Node
|
9
9
|
end
|
@@ -298,7 +298,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
-
class
|
301
|
+
class Arguments < Node
|
302
302
|
def execute(e)
|
303
303
|
array = @array.map { |x| x.execute(e) }
|
304
304
|
array << @splat.execute if @splat.kind_of? SplatValue
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: us-ascii -*-
|
2
2
|
|
3
|
-
module
|
3
|
+
module CodeTools
|
4
4
|
class Generator
|
5
5
|
include GeneratorMethods
|
6
6
|
|
@@ -261,6 +261,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
261
261
|
@required_args = 0
|
262
262
|
@post_args = 0
|
263
263
|
@total_args = 0
|
264
|
+
@arity = 0
|
264
265
|
|
265
266
|
@detected_args = 0
|
266
267
|
@detected_locals = 0
|
@@ -268,6 +269,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
268
269
|
@splat_index = nil
|
269
270
|
@local_names = nil
|
270
271
|
@block_index = nil
|
272
|
+
@keywords = nil
|
271
273
|
@local_count = 0
|
272
274
|
|
273
275
|
@state = []
|
@@ -285,7 +287,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
285
287
|
:required_args, :post_args, :total_args, :splat_index,
|
286
288
|
:local_count, :local_names, :primitive, :for_block, :for_module_body,
|
287
289
|
:current_block, :detected_args, :detected_locals,
|
288
|
-
:block_index
|
290
|
+
:block_index, :arity, :keywords
|
289
291
|
|
290
292
|
def execute(node)
|
291
293
|
node.bytecode self
|
@@ -324,8 +326,10 @@ module Rubinius::ToolSets.current::ToolSet
|
|
324
326
|
code.total_args = @total_args
|
325
327
|
code.splat = @splat_index
|
326
328
|
code.block_index = @block_index
|
329
|
+
code.arity = @arity
|
327
330
|
code.local_count = @local_count
|
328
331
|
code.local_names = @local_names.to_tuple if @local_names
|
332
|
+
code.keywords = @keywords.to_tuple if @keywords
|
329
333
|
|
330
334
|
code.stack_size = max_stack_size
|
331
335
|
code.file = @file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: us-ascii -*-
|
2
2
|
|
3
|
-
module
|
3
|
+
module CodeTools
|
4
4
|
class Compiler
|
5
5
|
Stages = { }
|
6
6
|
|
@@ -134,7 +134,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
134
134
|
end
|
135
135
|
|
136
136
|
# AST -> symbolic bytecode
|
137
|
-
class
|
137
|
+
class Bytecode < Stage
|
138
138
|
stage :bytecode
|
139
139
|
next_stage Encoder
|
140
140
|
|
@@ -144,7 +144,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
144
144
|
super
|
145
145
|
@variable_scope = nil
|
146
146
|
compiler.generator = self
|
147
|
-
@processor =
|
147
|
+
@processor = Generator
|
148
148
|
end
|
149
149
|
|
150
150
|
def run
|
@@ -214,7 +214,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
214
214
|
# source file -> AST
|
215
215
|
class FileParser < Parser
|
216
216
|
stage :file
|
217
|
-
next_stage
|
217
|
+
next_stage Bytecode
|
218
218
|
|
219
219
|
def input(file, line=1)
|
220
220
|
@file = file
|
@@ -229,7 +229,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
229
229
|
# source string -> AST
|
230
230
|
class StringParser < Parser
|
231
231
|
stage :string
|
232
|
-
next_stage
|
232
|
+
next_stage Bytecode
|
233
233
|
|
234
234
|
def input(string, name="(eval)", line=1)
|
235
235
|
@input = string
|
@@ -244,7 +244,7 @@ module Rubinius::ToolSets.current::ToolSet
|
|
244
244
|
|
245
245
|
class EvalParser < StringParser
|
246
246
|
stage :eval
|
247
|
-
next_stage
|
247
|
+
next_stage Bytecode
|
248
248
|
|
249
249
|
def should_cache?
|
250
250
|
@output.should_cache?
|
data/rubinius-compiler.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
require 'rubinius/toolset'
|
3
2
|
require './lib/rubinius/compiler/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |spec|
|
6
5
|
spec.name = "rubinius-compiler"
|
7
|
-
spec.version =
|
6
|
+
spec.version = CodeTools::Compiler::VERSION
|
8
7
|
spec.authors = ["Brian Shirai"]
|
9
8
|
spec.email = ["brixen@gmail.com"]
|
10
9
|
spec.description = %q{Rubinius bytecode compiler.}
|
@@ -20,7 +19,6 @@ Gem::Specification.new do |spec|
|
|
20
19
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
20
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
21
|
spec.add_development_dependency "mspec", "~> 1.5"
|
23
|
-
spec.add_development_dependency "rubinius-toolset", "~> 2.2"
|
24
22
|
spec.add_development_dependency "rubinius-processor", "~> 2.0"
|
25
23
|
spec.add_development_dependency "rubinius-ast", "~> 2.0"
|
26
24
|
spec.add_development_dependency "rubinius-bridge", "~> 1.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinius-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubinius-toolset
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.2'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.2'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rubinius-processor
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,7 +131,6 @@ files:
|
|
145
131
|
- lib/rubinius/compiler/locals.rb
|
146
132
|
- lib/rubinius/compiler/opcodes.rb
|
147
133
|
- lib/rubinius/compiler/printers.rb
|
148
|
-
- lib/rubinius/compiler/runtime.rb
|
149
134
|
- lib/rubinius/compiler/stages.rb
|
150
135
|
- lib/rubinius/compiler/version.rb
|
151
136
|
- rubinius-compiler.gemspec
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# -*- encoding: us-ascii -*-
|
2
|
-
|
3
|
-
module Rubinius::ToolSets.current::ToolSet
|
4
|
-
module Compiler::Runtime
|
5
|
-
def self.matches_when(array, receiver)
|
6
|
-
array.each { |x| return true if x === receiver }
|
7
|
-
false
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.unwrap_block_arg(arg)
|
11
|
-
if arg.size == 1
|
12
|
-
elem = arg.at(0)
|
13
|
-
return elem if elem.kind_of?(Array)
|
14
|
-
end
|
15
|
-
|
16
|
-
arg
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.find_constant_for_op_asign_or(name, scope)
|
20
|
-
name = Rubinius::Type.coerce_to_constant_name name
|
21
|
-
|
22
|
-
current, constant = scope.module, undefined
|
23
|
-
|
24
|
-
while current
|
25
|
-
if entry = current.constant_table.lookup(name)
|
26
|
-
constant = entry.constant
|
27
|
-
constant = constant.call if constant.kind_of?(Autoload)
|
28
|
-
return constant
|
29
|
-
end
|
30
|
-
|
31
|
-
current = current.direct_superclass
|
32
|
-
end
|
33
|
-
|
34
|
-
if instance_of?(Module)
|
35
|
-
if entry = Object.constant_table.lookup(name)
|
36
|
-
constant = entry.constant
|
37
|
-
constant = constant.call if constant.kind_of?(Autoload)
|
38
|
-
return constant
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.get_flip_flop(scope, index)
|
46
|
-
scope.flip_flops ||= {}
|
47
|
-
scope.flip_flops[index]
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.set_flip_flop(scope, index, value)
|
51
|
-
scope.flip_flops ||= {}
|
52
|
-
scope.flip_flops[index] = value
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.rbx_marshal_constant
|
56
|
-
name
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.get_encoding(name)
|
60
|
-
if defined?(Encoding)
|
61
|
-
Encoding.find name
|
62
|
-
else
|
63
|
-
name
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.pre_exe
|
68
|
-
yield
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|