Permalink
Browse files

Improve block creation speed

Shortcut promoting a StackVariables.
Only set a block's StaticScope if it has none.
  • Loading branch information...
1 parent 5c10e79 commit e3e230646aa1330c19727b3fde6bf38248733a6c Evan Phoenix committed Oct 12, 2009
Showing with 10 additions and 5 deletions.
  1. +1 −1 vm/call_frame.cpp
  2. +6 −1 vm/call_frame.hpp
  3. +3 −3 vm/llvm/jit_util.cpp
View
@@ -12,7 +12,7 @@
#include "object_utils.hpp"
namespace rubinius {
- VariableScope* CallFrame::promote_scope(STATE) {
+ VariableScope* CallFrame::promote_scope_full(STATE) {
return scope->create_heap_alias(state, this, !has_closed_scope_p());
}
View
@@ -108,7 +108,12 @@ namespace rubinius {
ip_ = pos - cm->backend_method()->addresses;
}
- VariableScope* promote_scope(STATE);
+ VariableScope* promote_scope_full(STATE);
+
+ VariableScope* promote_scope(STATE) {
+ if(VariableScope* vs = scope->on_heap()) return vs;
+ return promote_scope_full(state);
+ }
void print_backtrace(STATE);
int line(STATE);
View
@@ -148,10 +148,10 @@ extern "C" {
Object* _lit = call_frame->cm->literals()->at(state, index);
CompiledMethod* cm = as<CompiledMethod>(_lit);
- call_frame->promote_scope(state);
-
// TODO: We don't need to be doing this everytime.
- cm->scope(state, call_frame->static_scope());
+ if(cm->scope()->nil_p()) {
+ cm->scope(state, call_frame->static_scope());
+ }
VMMethod* vmm = call_frame->cm->backend_method();
return BlockEnvironment::under_call_frame(state, cm, vmm,

0 comments on commit e3e2306

Please sign in to comment.