Permalink
Browse files

Apply the VM-to-State transition to the JIT code

Since the following commit, many C++ functions are changed to take a pointer to
a State, not a pointer to a VM. But the LLVM code hasn't catch up the change.

  35a49f3 Introduce State class as STATE

This is very confusing. Just update it.

The reason Rubinius doesn't currently break in this situation is that the LLVM
IR type system is completely independent of the actual C++ type system.
  • Loading branch information...
1 parent 674fdcc commit 4bf2ad43027ce677afae4d337e72476d130e1187 @ryoqun committed Apr 2, 2012
View
@@ -141,7 +141,7 @@ namespace rubinius {
ops_.setup_out_args(count_);
std::vector<Type*> ftypes;
- ftypes.push_back(ops_.state()->ptr_type("VM"));
+ ftypes.push_back(ops_.state()->ptr_type("State"));
ftypes.push_back(ops_.state()->ptr_type("CallFrame"));
ftypes.push_back(ops_.state()->ptr_type("Executable"));
ftypes.push_back(ops_.state()->ptr_type("Module"));
@@ -431,7 +431,7 @@ namespace rubinius {
ops_.set_object_slot(self, offset, val);
} else {
Signature sig2(ops_.state(), "Object");
- sig2 << "VM";
+ sig2 << "State";
sig2 << "CallFrame";
sig2 << "Object";
sig2 << "Object";
@@ -515,7 +515,7 @@ namespace rubinius {
if(!ivar) {
Signature sig2(ops_.state(), "Object");
- sig2 << "VM";
+ sig2 << "State";
sig2 << "Object";
sig2 << "Object";
@@ -739,7 +739,7 @@ namespace rubinius {
case RBX_FFI_TYPE_LONG:
case RBX_FFI_TYPE_ULONG: {
Signature sig(ops_.state(), ops_.NativeIntTy);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -766,7 +766,7 @@ namespace rubinius {
case RBX_FFI_TYPE_FLOAT: {
Signature sig(ops_.state(), ops_.state()->FloatTy);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -787,7 +787,7 @@ namespace rubinius {
case RBX_FFI_TYPE_DOUBLE: {
Signature sig(ops_.state(), ops_.state()->DoubleTy);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -809,7 +809,7 @@ namespace rubinius {
case RBX_FFI_TYPE_LONG_LONG:
case RBX_FFI_TYPE_ULONG_LONG: {
Signature sig(ops_.state(), ops_.state()->Int64Ty);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -842,7 +842,7 @@ namespace rubinius {
Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
Signature sig(ops_.state(), type);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -865,7 +865,7 @@ namespace rubinius {
Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
Signature sig(ops_.state(), type);
- sig << "VM";
+ sig << "State";
sig << "Object";
sig << llvm::PointerType::getUnqual(ops_.state()->Int1Ty);
@@ -890,7 +890,7 @@ namespace rubinius {
}
Signature check(ops_.state(), ops_.NativeIntTy);
- check << "VM";
+ check << "State";
check << "CallFrame";
Value* check_args[] = { ops_.vm(), ops_.call_frame() };
@@ -923,7 +923,7 @@ namespace rubinius {
#endif
{
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << ops_.state()->Int32Ty;
res_args[1] = ops_.b().CreateSExtOrBitCast(res_args[1],
@@ -942,7 +942,7 @@ namespace rubinius {
#endif
{
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << ops_.state()->Int64Ty;
result = sig.call("rbx_ffi_from_int64", res_args, 2, "to_obj",
@@ -952,7 +952,7 @@ namespace rubinius {
case RBX_FFI_TYPE_FLOAT: {
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << ops_.state()->FloatTy;
result = sig.call("rbx_ffi_from_float", res_args, 2, "to_obj",
@@ -962,7 +962,7 @@ namespace rubinius {
case RBX_FFI_TYPE_DOUBLE: {
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << ops_.state()->DoubleTy;
result = sig.call("rbx_ffi_from_double", res_args, 2, "to_obj",
@@ -972,7 +972,7 @@ namespace rubinius {
case RBX_FFI_TYPE_PTR: {
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
result = sig.call("rbx_ffi_from_ptr", res_args, 2, "to_obj",
@@ -986,7 +986,7 @@ namespace rubinius {
case RBX_FFI_TYPE_STRING: {
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
result = sig.call("rbx_ffi_from_string", res_args, 2, "to_obj",
@@ -996,7 +996,7 @@ namespace rubinius {
case RBX_FFI_TYPE_STRPTR: {
Signature sig(ops_.state(), ops_.ObjType);
- sig << "VM";
+ sig << "State";
sig << llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
result = sig.call("rbx_ffi_from_string_with_pointer", res_args, 2, "to_obj",
@@ -489,7 +489,7 @@ namespace rubinius {
}
Signature sig(ops.state(), ops.state()->ptr_type("Float"));
- sig << "VM";
+ sig << "State";
Function* func = sig.function("rbx_float_allocate");
func->setDoesNotAlias(0, true); // return value
@@ -607,7 +607,7 @@ namespace rubinius {
Value* V = i.recv();
Signature sig(ops.state(), "Object");
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
sig << "Object";
@@ -636,7 +636,7 @@ namespace rubinius {
i.context().enter_inline();
Signature sig(ops.state(), ops.state()->ptr_type("Object"));
- sig << "VM";
+ sig << "State";
sig << "Object";
Value* call_args[] = { ops.vm(), i.recv() };
@@ -655,7 +655,7 @@ namespace rubinius {
ops.check_class(self, klass, i.failure());
Signature sig(ops.state(), "Class");
- sig << "VM";
+ sig << "State";
sig << "Object";
Value* call_args[] = { ops.vm(), self };
@@ -774,7 +774,7 @@ namespace rubinius {
std::vector<Value*> call_args;
Signature sig(ops_.state(), "Object");
- sig << "VM";
+ sig << "State";
call_args.push_back(ops_.vm());
if(stub_res.pass_callframe()) {
View
@@ -18,7 +18,7 @@ namespace jit {
void BlockBuilder::setup() {
std::vector<Type*> ftypes;
- ftypes.push_back(ls_->ptr_type("VM"));
+ ftypes.push_back(ls_->ptr_type("State"));
ftypes.push_back(ls_->ptr_type("CallFrame"));
ftypes.push_back(ls_->ptr_type("BlockEnvironment"));
ftypes.push_back(ls_->ptr_type("Arguments"));
@@ -76,7 +76,7 @@ namespace jit {
b().SetInsertPoint(setup_profiling);
Signature sig(ls_, ls_->VoidTy);
- sig << "VM";
+ sig << "State";
sig << llvm::PointerType::getUnqual(ls_->Int8Ty);
sig << "BlockEnvironment";
sig << "Module";
@@ -224,7 +224,7 @@ namespace jit {
b().SetInsertPoint(destruct);
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
sig << "Arguments";
@@ -447,7 +447,7 @@ namespace jit {
// Phase 4 - splat
if(vmm_->splat_position >= 0) {
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "Arguments";
sig << ls_->Int32Ty;
sig << ls_->Int32Ty;
View
@@ -180,7 +180,7 @@ namespace jit {
Value* call_args[] = { info_.vm(), info_.previous(), exec, module, info_.args() };
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
sig << "Executable";
sig << "Module";
@@ -548,7 +548,7 @@ namespace jit {
b().SetInsertPoint(import_args_);
Signature sig(ls_, obj_type);
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
Function* func_ci = sig.function("rbx_check_interrupts");
@@ -96,7 +96,7 @@ namespace jit {
if(stack_args.size() == 1 && vmm_->total_args > 1) {
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
sig << "Object";
sig << vars->getType();
View
@@ -20,7 +20,7 @@ namespace jit {
void MethodBuilder::setup() {
std::vector<Type*> ftypes;
- ftypes.push_back(ls_->ptr_type("VM"));
+ ftypes.push_back(ls_->ptr_type("State"));
ftypes.push_back(ls_->ptr_type("CallFrame"));
ftypes.push_back(ls_->ptr_type("Executable"));
ftypes.push_back(ls_->ptr_type("Module"));
@@ -235,7 +235,7 @@ namespace jit {
// Phase 4 - splat
if(vmm_->splat_position >= 0) {
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "Arguments";
sig << ls_->Int32Ty;
sig << ls_->Int32Ty;
@@ -367,7 +367,7 @@ namespace jit {
// Setup the splat.
if(vmm_->splat_position >= 0) {
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "Arguments";
sig << ls_->Int32Ty;
sig << ls_->Int32Ty;
@@ -447,7 +447,7 @@ namespace jit {
// Call our arg_error helper
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "CallFrame";
sig << "Arguments";
sig << ls_->Int32Ty;
@@ -576,7 +576,7 @@ namespace jit {
b().SetInsertPoint(setup_profiling);
Signature sig(ls_, ls_->VoidTy);
- sig << "VM";
+ sig << "State";
sig << llvm::PointerType::getUnqual(ls_->Int8Ty);
sig << "Executable";
sig << "Module";
@@ -92,7 +92,7 @@ namespace rubinius {
llvm::Type* ObjArrayTy;
// Frequently used types
- llvm::Type* VMTy;
+ llvm::Type* StateTy;
llvm::Type* CallFrameTy;
// Commonly used constants
@@ -130,7 +130,7 @@ namespace rubinius {
ObjType = ptr_type("Object");
ObjArrayTy = llvm::PointerType::getUnqual(ObjType);
- VMTy = ptr_type("VM");
+ StateTy = ptr_type("State");
CallFrameTy = ptr_type("CallFrame");
Function::arg_iterator input = function_->arg_begin();
@@ -715,7 +715,7 @@ namespace rubinius {
set_block(do_flush);
Signature sig(ls_, "Object");
- sig << "VM";
+ sig << "State";
sig << "StackVariables";
Value* call_args[] = { vm_, vars };
@@ -946,7 +946,7 @@ namespace rubinius {
void write_barrier(Value* obj, Value* val) {
Signature wb(ls_, ObjType);
- wb << VMTy;
+ wb << StateTy;
wb << ObjType;
wb << ObjType;
Oops, something went wrong.

0 comments on commit 4bf2ad4

Please sign in to comment.