Permalink
Browse files

Fix on stack handling for Arguments

This make sure we also update the receiver and block and handles
arguments better. This way arguments also get updated if they do not
originate from a tuple container.
  • Loading branch information...
1 parent 0c3b622 commit 499bbe66ba1423dcade04cfcdd5b7caa418c441f @dbussink dbussink committed Oct 16, 2013
Showing with 19 additions and 6 deletions.
  1. +12 −4 vm/arguments.hpp
  2. +3 −1 vm/builtin/block_environment.cpp
  3. +4 −1 vm/builtin/compiled_code.cpp
View
@@ -76,6 +76,10 @@ namespace rubinius {
return recv_;
}
+ Object*& recv_location() {
+ return recv_;
+ }
+
void set_recv(Object* val) {
recv_ = val;
}
@@ -84,6 +88,10 @@ namespace rubinius {
return block_;
}
+ Object*& block_location() {
+ return block_;
+ }
+
void set_block(Object* val) {
block_ = val;
}
@@ -96,6 +104,10 @@ namespace rubinius {
return arguments_;
}
+ Object**& arguments_location() {
+ return arguments_;
+ }
+
Tuple* argument_container() const {
return argument_container_;
}
@@ -124,10 +136,6 @@ namespace rubinius {
use_tuple(tup, size, 0);
}
- Tuple*& argument_container_location() {
- return argument_container_;
- }
-
Array* as_array(STATE);
void append(STATE, Array* ary);
void prepend(STATE, Array* ary);
@@ -68,7 +68,9 @@ namespace rubinius {
MachineCode* mcode = env->compiled_code_->machine_code();
if(!mcode) {
- OnStack<2> os(state, env, args.argument_container_location());
+ OnStack<3> os(state, env, args.recv_location(), args.block_location());
+ VariableRootBuffer vrb(state->vm()->current_root_buffers(),
+ &args.arguments_location(), args.total());
GCTokenImpl gct;
mcode = env->machine_code(state, gct, previous);
@@ -207,7 +207,10 @@ namespace rubinius {
const char* reason = 0;
int ip = -1;
- OnStack<4> os(state, code, exec, mod, args.argument_container_location());
+ OnStack<5> os(state, code, exec, mod, args.recv_location(), args.block_location());
+
+ VariableRootBuffer vrb(state->vm()->current_root_buffers(),
+ &args.arguments_location(), args.total());
GCTokenImpl gct;
if(!code->internalize(state, gct, call_frame, &reason, &ip)) {

0 comments on commit 499bbe6

Please sign in to comment.