Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Define ALLOCA_STACKVARIABLES like ALLOCA_CALLFRAME

  • Loading branch information...
commit d2f41dbad835233123c98c04f472453e0d15f754 1 parent 03248a9
@ryoqun authored
View
6 vm/builtin/block_environment.cpp
@@ -281,11 +281,7 @@ namespace rubinius {
}
#endif
- size_t scope_size = sizeof(StackVariables) +
- (vmm->number_of_locals * sizeof(Object*));
-
- StackVariables* scope =
- reinterpret_cast<StackVariables*>(alloca(scope_size));
+ StackVariables* scope = ALLOCA_STACKVARIABLES(vmm->number_of_locals);
Module* mod = invocation.module;
if(!mod) mod = env->module();
View
3  vm/stack_variables.hpp
@@ -75,6 +75,9 @@ namespace rubinius {
friend class GarbageCollector;
};
+
+#define ALLOCA_STACKVARIABLES(local_size) \
+ (StackVariables*)alloca(sizeof(StackVariables) + (sizeof(Object*) * local_size))
}
#endif
View
10 vm/vmmethod.cpp
@@ -562,10 +562,7 @@ namespace rubinius {
CompiledMethod* cm = as<CompiledMethod>(exec);
VMMethod* vmm = cm->backend_method();
- size_t scope_size = sizeof(StackVariables) +
- (vmm->number_of_locals * sizeof(Object*));
- StackVariables* scope =
- reinterpret_cast<StackVariables*>(alloca(scope_size));
+ StackVariables* scope = ALLOCA_STACKVARIABLES(vmm->number_of_locals);
// Originally, I tried using msg.module directly, but what happens is if
// super is used, that field is read. If you combine that with the method
// being called recursively, msg.module can change, causing super() to
@@ -639,10 +636,7 @@ namespace rubinius {
Object* VMMethod::execute_as_script(STATE, CompiledMethod* cm, CallFrame* previous) {
VMMethod* vmm = cm->backend_method();
- size_t scope_size = sizeof(StackVariables) +
- (vmm->number_of_locals * sizeof(Object*));
- StackVariables* scope =
- reinterpret_cast<StackVariables*>(alloca(scope_size));
+ StackVariables* scope = ALLOCA_STACKVARIABLES(vmm->number_of_locals);
// Originally, I tried using msg.module directly, but what happens is if
// super is used, that field is read. If you combine that with the method
// being called recursively, msg.module can change, causing super() to
Please sign in to comment.
Something went wrong with that request. Please try again.