convinius 0.1.1 → 0.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.
- data/README.md +6 -0
- data/convinius.gemspec +1 -1
- data/lib/convinius.rb +1 -0
- data/lib/convinius/asm.rb +8 -27
- data/lib/convinius/generator.rb +10 -4
- data/lib/convinius/globals.rb +4 -0
- metadata +5 -4
data/README.md
CHANGED
@@ -45,6 +45,12 @@ A more realistic example:
|
|
45
45
|
include Awesome
|
46
46
|
end
|
47
47
|
|
48
|
+
Import constants from Rubinius
|
49
|
+
------------------------------
|
50
|
+
in: `convinius/globals`
|
51
|
+
|
52
|
+
Defines global constants `Tuple` and `Fiber`.
|
53
|
+
|
48
54
|
Convenience for Rubinius::Generator
|
49
55
|
-----------------------------------
|
50
56
|
in: `convinius/generator`
|
data/convinius.gemspec
CHANGED
data/lib/convinius.rb
CHANGED
data/lib/convinius/asm.rb
CHANGED
@@ -2,33 +2,14 @@ module Convinius
|
|
2
2
|
module ASM
|
3
3
|
extend self
|
4
4
|
|
5
|
-
def asm(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
g.splat_index = nil
|
14
|
-
|
15
|
-
g.local_count = 0
|
16
|
-
g.local_names = []
|
17
|
-
|
18
|
-
block.arity > 0 ? yield(g) : g.instance_eval(&block)
|
19
|
-
|
20
|
-
g.ret
|
21
|
-
g.close
|
22
|
-
|
23
|
-
g.encode
|
24
|
-
cm = g.package Rubinius::CompiledMethod
|
25
|
-
puts cm.decode if $DEBUG
|
26
|
-
|
27
|
-
code = Object.new
|
28
|
-
ss = Rubinius::StaticScope.new Object
|
29
|
-
Rubinius.attach_method g.name, cm, ss, code
|
30
|
-
|
31
|
-
code
|
5
|
+
def asm(opts = {}, &block)
|
6
|
+
object = opts[:object] || Object.new
|
7
|
+
opts = { :file => "(asm)", :line => 1, :method => :call }.merge! opts
|
8
|
+
Rubinius.object_metaclass(object).dynamic_method(opts[:method], opts[:file], opts[:line]) do |g|
|
9
|
+
block.arity > 0 ? yield(g) : g.instance_eval(&block)
|
10
|
+
g.ret
|
11
|
+
end
|
12
|
+
object
|
32
13
|
end
|
33
14
|
|
34
15
|
class << self
|
data/lib/convinius/generator.rb
CHANGED
@@ -3,10 +3,16 @@ module Convinius
|
|
3
3
|
append_features Rubinius::Generator
|
4
4
|
|
5
5
|
def make_tuple(count)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
push count
|
7
|
+
invoke_primitive :tuple_allocate, 1
|
8
|
+
(count - 1).downto(0) do |i|
|
9
|
+
dup
|
10
|
+
rotate 3
|
11
|
+
push i
|
12
|
+
swap
|
13
|
+
invoke_primitive :tuple_put, 3
|
14
|
+
pop
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
12
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convinius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Konstantin Haase
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- lib/convinius.rb
|
35
35
|
- lib/convinius/asm.rb
|
36
36
|
- lib/convinius/generator.rb
|
37
|
+
- lib/convinius/globals.rb
|
37
38
|
- lib/convinius/to_class.rb
|
38
39
|
- spec/asm_spec.rb
|
39
40
|
- spec/generator_spec.rb
|