ruby-libjit 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/ext/jit_ext.c CHANGED
@@ -1097,7 +1097,7 @@ static VALUE type_s_create_struct(
1097
1097
  Data_Get_Struct(field, struct _jit_type, fields[j]);
1098
1098
  }
1099
1099
 
1100
- struct_type = jit_type_create_struct(fields, RARRAY_LEN(fields_v), 1);
1100
+ struct_type = jit_type_create_struct(fields, len, 1);
1101
1101
  return wrap_type_with_klass(struct_type, klass);
1102
1102
  }
1103
1103
 
@@ -33,9 +33,19 @@ class TestJitStruct < Test::Unit::TestCase
33
33
  [ :foo, JIT::Type::INT ],
34
34
  [ :bar, JIT::Type::FLOAT64 ],
35
35
  [ :baz, JIT::Type::VOID_PTR ])
36
- assert_equal 0, s_type.offset_of(:foo)
37
- assert_equal 4, s_type.offset_of(:bar)
38
- assert_equal 12, s_type.offset_of(:baz)
36
+ if JIT::Type::OBJECT.size == 4 then
37
+ # 32-bit
38
+ assert_equal 0, s_type.offset_of(:foo)
39
+ assert_equal 4, s_type.offset_of(:bar)
40
+ assert_equal 12, s_type.offset_of(:baz)
41
+ elsif JIT::Type::OBJECT.size == 8 then
42
+ # 64-bit
43
+ assert_equal 0, s_type.offset_of(:foo)
44
+ assert_equal 8, s_type.offset_of(:bar)
45
+ assert_equal 16, s_type.offset_of(:baz)
46
+ else
47
+ raise ArgumentError, "Invalid size for OBJECT: #{JIT::Type::OBJECT.size}"
48
+ end
39
49
  end
40
50
 
41
51
  def test_type_of
@@ -55,7 +65,10 @@ class TestJitStruct < Test::Unit::TestCase
55
65
  [ :bar, JIT::Type::FLOAT64 ],
56
66
  [ :baz, JIT::Type::VOID_PTR ])
57
67
  s = s_type.create(f)
58
- f.insn_store_relative(s.ptr, 4, f.const(JIT::Type::FLOAT64, 42.0))
68
+ f.insn_store_relative(
69
+ s.ptr,
70
+ s_type.offset_of(:bar),
71
+ f.const(JIT::Type::FLOAT64, 42.0))
59
72
  f.return s[:bar]
60
73
  }
61
74
  assert_function_result(
@@ -70,7 +83,10 @@ class TestJitStruct < Test::Unit::TestCase
70
83
  [ :bar, JIT::Type::FLOAT64 ],
71
84
  [ :baz, JIT::Type::VOID_PTR ])
72
85
  s = s_type.create(f)
73
- f.insn_store_relative(s.ptr, 4, f.const(JIT::Type::FLOAT64, 42.0))
86
+ f.insn_store_relative(
87
+ s.ptr,
88
+ s_type.offset_of(:bar),
89
+ f.const(JIT::Type::FLOAT64, 42.0))
74
90
  f.return s.bar
75
91
  }
76
92
  assert_function_result(
@@ -17,6 +17,17 @@ class TestJitValue < Test::Unit::TestCase
17
17
  &p)
18
18
  end
19
19
 
20
+ def test_store_float
21
+ p = proc { |f|
22
+ v = f.value(JIT::Type::FLOAT64)
23
+ v.store(f.const(JIT::Type::FLOAT64, 42.0))
24
+ f.return v
25
+ }
26
+ assert_function_result(
27
+ :result => [ JIT::Type::FLOAT64, 42.0 ],
28
+ &p)
29
+ end
30
+
20
31
  # TODO: address
21
32
 
22
33
  def test_int_plus
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-libjit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 4
10
+ version: 0.2.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Paul Brannan
@@ -9,8 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-12 00:00:00 -05:00
13
- default_executable:
18
+ date: 2012-05-03 00:00:00 Z
14
19
  dependencies: []
15
20
 
16
21
  description: |
@@ -35,24 +40,28 @@ files:
35
40
  - lib/jit.rb
36
41
  - lib/jit/array.rb
37
42
  - lib/jit/function.rb
38
- - lib/jit/struct.rb
39
- - lib/jit/pointer.rb
40
43
  - lib/jit/value.rb
41
44
  - lib/jit/type.rb
45
+ - lib/jit/struct.rb
46
+ - lib/jit/pointer.rb
42
47
  - ext/extconf.rb
43
48
  - ext/rubypp.rb
44
- - ext/minimal_node.c
45
49
  - ext/method_data.c
46
50
  - ext/jit_ext.c
51
+ - ext/minimal_node.c
52
+ - ext/rubyjit.h
47
53
  - ext/minimal_node.h
48
54
  - ext/method_data.h
49
- - ext/rubyjit.h
50
- - ext/method_data.c.rpp
51
55
  - ext/insns.inc.rpp
52
- - sample/gcd_benchmark.rb
56
+ - ext/method_data.c.rpp
53
57
  - sample/simple.rb
54
58
  - sample/fib.rb
55
- has_rdoc: true
59
+ - sample/gcd_benchmark.rb
60
+ - test/test_jit_array.rb
61
+ - test/test_jit_pointer.rb
62
+ - test/test_jit_function.rb
63
+ - test/test_jit_struct.rb
64
+ - test/test_jit_value.rb
56
65
  homepage: http://ruby-libjit.rubyforge.org
57
66
  licenses: []
58
67
 
@@ -62,27 +71,33 @@ rdoc_options: []
62
71
  require_paths:
63
72
  - lib
64
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
65
75
  requirements:
66
76
  - - ">="
67
77
  - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
68
81
  version: "0"
69
- version:
70
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
71
84
  requirements:
72
85
  - - ">="
73
86
  - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
74
90
  version: "0"
75
- version:
76
91
  requirements: []
77
92
 
78
93
  rubyforge_project: ruby-libjit
79
- rubygems_version: 1.3.5
94
+ rubygems_version: 1.7.2
80
95
  signing_key:
81
96
  specification_version: 3
82
97
  summary: A wrapper for the libjit library
83
98
  test_files:
84
- - test/test_jit_struct.rb
85
- - test/test_jit_value.rb
86
- - test/test_jit_function.rb
87
99
  - test/test_jit_array.rb
88
100
  - test/test_jit_pointer.rb
101
+ - test/test_jit_function.rb
102
+ - test/test_jit_struct.rb
103
+ - test/test_jit_value.rb