Skip to content

Commit

Permalink
CallFrame#previous is already a CallFrame, no need to cast
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Aug 5, 2012
1 parent cd6e0ec commit 422359a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion vm/builtin/compiledcode.cpp
Expand Up @@ -361,7 +361,7 @@ namespace rubinius {
}

CompiledCode* CompiledCode::of_sender(STATE, CallFrame* calling_environment) {
CallFrame* caller = static_cast<CallFrame*>(calling_environment->previous);
CallFrame* caller = calling_environment->previous;
if(caller) {
if(caller->cm) {
return caller->cm;
Expand Down
10 changes: 5 additions & 5 deletions vm/builtin/location.cpp
Expand Up @@ -60,7 +60,7 @@ namespace rubinius {
}

Location* Location::of_closest_ruby_method(STATE, CallFrame* calling_environment) {
CallFrame* dest = static_cast<CallFrame*>(calling_environment->previous);
CallFrame* dest = calling_environment->previous;
// Skip any frames for native methods
while(dest->native_method_p()) { dest = dest->previous; }
return Location::create(state, dest, false);
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace rubinius {

// First the first normal frame
while(!call_frame->cm) {
call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
// Weird edge case.
if(!call_frame) return bt;
}
Expand All @@ -106,7 +106,7 @@ namespace rubinius {

bt->append(state, loc);

call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;

while(call_frame) {
// Ignore synthetic frames
Expand All @@ -117,7 +117,7 @@ namespace rubinius {
if(loc) bt->append(state, loc);
}

call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
}

return bt;
Expand Down Expand Up @@ -169,7 +169,7 @@ namespace rubinius {
Tuple::from(state, 4, call_frame->cm, line, block, name));
}

call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
}

return bt;
Expand Down
4 changes: 2 additions & 2 deletions vm/builtin/system.cpp
Expand Up @@ -600,7 +600,7 @@ namespace rubinius {
bool include_vars = CBOOL(inc_vars);

for(native_int i = skip->to_native(); call_frame && i > 0; --i) {
call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
}

return Location::from_call_stack(state, call_frame, include_vars);
Expand All @@ -611,7 +611,7 @@ namespace rubinius {
CallFrame* call_frame = calling_environment;

for(native_int i = skip->to_native(); call_frame && i > 0; --i) {
call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
}

return Location::mri_backtrace(state, call_frame);
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/variable_scope.cpp
Expand Up @@ -30,7 +30,7 @@ namespace rubinius {
}

VariableScope* VariableScope::of_sender(STATE, CallFrame* call_frame) {
CallFrame* dest = static_cast<CallFrame*>(call_frame->previous);
CallFrame* dest = call_frame->previous;
// Skip any frames for native methods
while(dest->native_method_p()) { dest = dest->previous; }
return dest->promote_scope(state);
Expand Down
8 changes: 4 additions & 4 deletions vm/call_frame.cpp
Expand Up @@ -91,12 +91,12 @@ namespace rubinius {
}

stream << std::endl;
cf = static_cast<CallFrame*>(cf->previous);
cf = cf->previous;
continue;
}

if(!cf->cm) {
cf = static_cast<CallFrame*>(cf->previous);
cf = cf->previous;
continue;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ namespace rubinius {
stream << ")";

stream << std::endl;
cf = static_cast<CallFrame*>(cf->previous);
cf = cf->previous;
}

}
Expand All @@ -175,7 +175,7 @@ namespace rubinius {
CallFrame* cur = this;
while(cur) {
if(cur->scope && cur->scope->on_heap() == scope) return true;
cur = static_cast<CallFrame*>(cur->previous);
cur = cur->previous;
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion vm/gc/gc.cpp
Expand Up @@ -245,7 +245,7 @@ namespace rubinius {

saw_variable_scope(call_frame, displace(call_frame->scope, offset));

call_frame = static_cast<CallFrame*>(call_frame->previous);
call_frame = call_frame->previous;
}
}

Expand Down

0 comments on commit 422359a

Please sign in to comment.