Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Emit block in uncommon exit path when inside an inlined block

  • Loading branch information...
commit 8c4017bfc19c92e78b11e458a71742e83ee7b644 1 parent 8019705
@dbussink dbussink authored
View
3  vm/llvm/inline_block.cpp
@@ -11,13 +11,14 @@ namespace rubinius {
JITInlineBlock::JITInlineBlock(Context* ctx,
CompiledCode* code, MachineCode* mcode,
- JITMethodInfo* scope, int which)
+ JITMethodInfo* scope, int which, Value* stack_ptr)
: block_break_result_(NULL)
, block_break_loc_(NULL)
, machine_code_(mcode)
, method_(&ctx->llvm_state()->roots())
, scope_(scope)
, which_(which)
+ , stack_ptr_(stack_ptr)
, created_object_(false)
{
method_.set(code);
View
7 vm/llvm/inline_block.hpp
@@ -16,11 +16,12 @@ namespace rubinius {
TypedRoot<CompiledCode*> method_;
JITMethodInfo* scope_;
int which_;
+ llvm::Value* stack_ptr_;
bool created_object_;
public:
JITInlineBlock(Context* ctx, CompiledCode* code, MachineCode* mcode,
- JITMethodInfo* scope, int which);
+ JITMethodInfo* scope, int which, llvm::Value* stack_ptr);
llvm::PHINode* block_break_result() {
return block_break_result_;
@@ -70,6 +71,10 @@ namespace rubinius {
created_object_ = true;
}
+ llvm::Value* stack_ptr() {
+ return stack_ptr_;
+ }
+
void eraseBlockEmit();
};
View
26 vm/llvm/jit_visit.hpp
@@ -1311,6 +1311,26 @@ namespace rubinius {
void emit_uncommon() {
emit_delayed_create_block();
+ if(current_block_) {
+ Signature sig(ctx_, ObjType);
+ sig << StateTy;
+ sig << CallFrameTy;
+ sig << ctx_->Int32Ty;
+
+ Value* call_args[] = {
+ state_,
+ call_frame_,
+ cint(current_block_->which())
+ };
+
+ Value* blk = sig.call("rbx_create_block", call_args, 3,
+ "delayed_create_block", b());
+
+ b().CreateStore(
+ blk,
+ current_block_->stack_ptr());
+ }
+
Value* sp = last_sp_as_int();
flush();
@@ -1674,7 +1694,7 @@ namespace rubinius {
CompiledCode* block_code = as<CompiledCode>(literal(which));
MachineCode* code = block_code->machine_code();
- current_block_ = new JITInlineBlock(ctx_, block_code, code, &info(), which);
+ current_block_ = new JITInlineBlock(ctx_, block_code, code, &info(), which, stack_ptr());
current_block_->set_block_emit_loc(block_emit);
}
@@ -1760,6 +1780,8 @@ namespace rubinius {
b().CreateBr(cont);
set_block(cont);
+
+ current_block_->eraseBlockEmit();
} else {
// Emit both the inlined code and a send for it
@@ -1791,8 +1813,6 @@ namespace rubinius {
allow_private_ = false;
- current_block_->eraseBlockEmit();
-
// Clear the current block
clear_current_block();
return;
Please sign in to comment.
Something went wrong with that request. Please try again.