dbussink (owner)

Revisions

gist: 177900 Download_button fork
public
Public Clone URL: git://gist.github.com/177900.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
diff --git a/lib/iconv.rb b/lib/iconv.rb
index 88342a4..8f26357 100644
--- a/lib/iconv.rb
+++ b/lib/iconv.rb
@@ -153,7 +153,7 @@ class Iconv
       is = FFI::MemoryPointer.new(str.size + 10)
       is.write_string str, str.size
 
- l1.write_long is.address
+ l1.write_pointer is.address
 
       start += str.size if start < 0
       if start < 0 || start >= str.size
@@ -167,7 +167,7 @@ class Iconv
           if length < 0
             length = 0
           else
- l1.write_long(is.address + start)
+ l1.write_pointer(is.address + start)
             length = str.size if length > str.size
           end
         end
diff --git a/vm/llvm/inline_primitive.cpp b/vm/llvm/inline_primitive.cpp
index 3a6be9f..deee7ae 100644
--- a/vm/llvm/inline_primitive.cpp
+++ b/vm/llvm/inline_primitive.cpp
@@ -101,8 +101,8 @@ namespace rubinius {
 
     Value* anded = BinaryOperator::CreateAnd(lint, rint, "fixnums_anded", ops.current_block());
 
- Value* fix_mask = ConstantInt::get(Type::Int32Ty, TAG_FIXNUM_MASK);
- Value* fix_tag = ConstantInt::get(Type::Int32Ty, TAG_FIXNUM);
+ Value* fix_mask = ConstantInt::get(ops.NativeIntTy, TAG_FIXNUM_MASK);
+ Value* fix_tag = ConstantInt::get(ops.NativeIntTy, TAG_FIXNUM);
 
     Value* masked = BinaryOperator::CreateAnd(anded, fix_mask, "masked", ops.current_block());
 
diff --git a/vm/llvm/jit_operations.hpp b/vm/llvm/jit_operations.hpp
index 8d61359..7d6cfcb 100644
--- a/vm/llvm/jit_operations.hpp
+++ b/vm/llvm/jit_operations.hpp
@@ -1,6 +1,7 @@
 #ifndef RBX_LLVM_JIT_OPERATIONS
 #define RBX_LLVM_JIT_OPERATIONS
 
+#include "config.h"
 #include "builtin/class.hpp"
 #include "builtin/fixnum.hpp"
 #include "builtin/symbol.hpp"
@@ -51,7 +52,6 @@ namespace rubinius {
     const llvm::Type* IntPtrTy;
     const llvm::Type* ObjType;
     const llvm::Type* ObjArrayTy;
- const llvm::Type* Int31Ty;
 
     // Frequently used types
     const llvm::Type* VMTy;
@@ -77,7 +77,7 @@ namespace rubinius {
       zero_ = ConstantInt::get(Type::Int32Ty, 0);
       one_ = ConstantInt::get(Type::Int32Ty, 1);
 
-#if __LP64__
+#ifdef IS_X8664
       IntPtrTy = llvm::Type::Int64Ty;
       FixnumTy = llvm::IntegerType::get(63);
 #else
@@ -93,8 +93,6 @@ namespace rubinius {
       ObjType = ptr_type("Object");
       ObjArrayTy = PointerType::getUnqual(ObjType);
 
- Int31Ty = llvm::IntegerType::get(31);
-
       VMTy = ptr_type("VM");
       CallFrameTy = ptr_type("CallFrame");
 
@@ -364,7 +362,7 @@ namespace rubinius {
     }
 
     Value* last_sp_as_int() {
- return ConstantInt::get(Type::Int32Ty, last_sp_);
+ return ConstantInt::get(NativeIntTy, last_sp_);
     }
 
     void flush_stack() { }
@@ -490,19 +488,19 @@ namespace rubinius {
     //
     Value* cast_int(Value* obj) {
       return b().CreatePtrToInt(
- obj, IntPtrTy, "cast");
+ obj, NativeIntTy, "cast");
     }
 
     // Fixnum manipulations
     //
     Value* tag_strip(Value* obj, const Type* type = NULL) {
- if(!type) type = Int31Ty;
+ if(!type) type = FixnumTy;
 
       Value* i = b().CreatePtrToInt(
- obj, Type::Int32Ty, "as_int");
+ obj, NativeIntTy, "as_int");
 
       Value* more = b().CreateLShr(
- i, ConstantInt::get(Type::Int32Ty, 1),
+ i, ConstantInt::get(NativeIntTy, 1),
           "lshr");
       return b().CreateIntCast(
           more, type, true, "stripped");
@@ -518,10 +516,10 @@ namespace rubinius {
     }
 
     Value* fixnum_tag(Value* obj) {
- Value* obj32 = b().CreateZExt(
- obj, Type::Int32Ty, "as_32bit");
- Value* one = ConstantInt::get(Type::Int32Ty, 1);
- Value* more = b().CreateShl(obj32, one, "shl");
+ Value* native_obj = b().CreateZExt(
+ obj, NativeIntTy, "as_native_int");
+ Value* one = ConstantInt::get(NativeIntTy, 1);
+ Value* more = b().CreateShl(native_obj, one, "shl");
       Value* tagged = b().CreateOr(more, one, "or");
 
       return b().CreateIntToPtr(tagged, ObjType, "as_obj");
diff --git a/vm/llvm/jit_visit.hpp b/vm/llvm/jit_visit.hpp
index 5939323..2591dd1 100644
--- a/vm/llvm/jit_visit.hpp
+++ b/vm/llvm/jit_visit.hpp
@@ -905,11 +905,11 @@ namespace rubinius {
         set_block(fast);
 
         std::vector<const Type*> types;
- types.push_back(Int31Ty);
- types.push_back(Int31Ty);
+ types.push_back(FixnumTy);
+ types.push_back(FixnumTy);
 
         std::vector<const Type*> struct_types;
- struct_types.push_back(Int31Ty);
+ struct_types.push_back(FixnumTy);
         struct_types.push_back(Type::Int1Ty);
 
         StructType* st = StructType::get(struct_types);
@@ -969,11 +969,11 @@ namespace rubinius {
         set_block(fast);
 
         std::vector<const Type*> types;
- types.push_back(Int31Ty);
- types.push_back(Int31Ty);
+ types.push_back(FixnumTy);
+ types.push_back(FixnumTy);
 
         std::vector<const Type*> struct_types;
- struct_types.push_back(Int31Ty);
+ struct_types.push_back(FixnumTy);
         struct_types.push_back(Type::Int1Ty);
 
         StructType* st = StructType::get(struct_types);