Skip to content

Instantly share code, notes, and snippets.

@dbussink
Created August 30, 2009 07:40
Show Gist options
  • Select an option

  • Save dbussink/177898 to your computer and use it in GitHub Desktop.

Select an option

Save dbussink/177898 to your computer and use it in GitHub Desktop.
diff --git a/vm/llvm/inline_primitive.cpp b/vm/llvm/inline_primitive.cpp
index 3a6be9f..1deded8 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..803d98f 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__
+#if 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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment