Commit 88b62b62 authored by Kevin Modzelewski's avatar Kevin Modzelewski

try to simplify things using bindObjIntoArgs

parent 4f95e1cc
...@@ -1232,6 +1232,15 @@ int Rewriter::_allocate(RewriterVar* result, int n) { ...@@ -1232,6 +1232,15 @@ int Rewriter::_allocate(RewriterVar* result, int n) {
if (consec == n) { if (consec == n) {
int a = i / 8 - n + 1; int a = i / 8 - n + 1;
int b = i / 8; int b = i / 8;
// Put placeholders in so the array space doesn't get re-allocated.
// This won't get collected, but that's fine.
// Note: make sure to do this marking before the initializeInReg call
for (int j = a; j <= b; j++) {
Location m(Location::Scratch, j * 8);
assert(vars_by_location.count(m) == 0);
vars_by_location[m] = LOCATION_PLACEHOLDER;
}
assembler::Register r = result->initializeInReg(); assembler::Register r = result->initializeInReg();
// TODO should be a LEA instruction // TODO should be a LEA instruction
...@@ -1240,13 +1249,6 @@ int Rewriter::_allocate(RewriterVar* result, int n) { ...@@ -1240,13 +1249,6 @@ int Rewriter::_allocate(RewriterVar* result, int n) {
assembler->mov(assembler::RSP, r); assembler->mov(assembler::RSP, r);
assembler->add(assembler::Immediate(8 * a + rewrite->getScratchRspOffset()), r); assembler->add(assembler::Immediate(8 * a + rewrite->getScratchRspOffset()), r);
// Put placeholders in so the array space doesn't get re-allocated.
// This won't get collected, but that's fine.
for (int j = a; j <= b; j++) {
Location m(Location::Scratch, j * 8);
vars_by_location[m] = LOCATION_PLACEHOLDER;
}
assertConsistent(); assertConsistent();
result->releaseIfNoUses(); result->releaseIfNoUses();
return a; return a;
......
This diff is collapsed.
...@@ -131,9 +131,10 @@ void rearrangeArguments(ParamReceiveSpec paramspec, const ParamNames* param_name ...@@ -131,9 +131,10 @@ void rearrangeArguments(ParamReceiveSpec paramspec, const ParamNames* param_name
Box* arg1, Box* arg2, Box* arg3, Box** args, const std::vector<BoxedString*>* keyword_names, Box* arg1, Box* arg2, Box* arg3, Box** args, const std::vector<BoxedString*>* keyword_names,
Box*& oarg1, Box*& oarg2, Box*& oarg3, Box** oargs); Box*& oarg1, Box*& oarg2, Box*& oarg3, Box** oargs);
// new_args should be allocated by the caller if at least three args get passed in // new_args should be allocated by the caller if at least three args get passed in.
ArgPassSpec bindObjIntoArgs(Box* obj, CallRewriteArgs* rewrite_args, ArgPassSpec argspec, Box*& arg1, Box*& arg2, // rewrite_args will get modified in place.
Box*& arg3, Box** args, Box** new_args); ArgPassSpec bindObjIntoArgs(Box* bind_obj, RewriterVar* r_bind_obj, CallRewriteArgs* rewrite_args, ArgPassSpec argspec,
Box*& arg1, Box*& arg2, Box*& arg3, Box** args, Box** new_args);
} // namespace pyston } // namespace pyston
#endif #endif
...@@ -547,7 +547,15 @@ static Box* typeTppCall(Box* self, CallRewriteArgs* rewrite_args, ArgPassSpec ar ...@@ -547,7 +547,15 @@ static Box* typeTppCall(Box* self, CallRewriteArgs* rewrite_args, ArgPassSpec ar
new_args = (Box**)alloca(sizeof(Box*) * (npassed_args + 1 - 3)); new_args = (Box**)alloca(sizeof(Box*) * (npassed_args + 1 - 3));
} }
ArgPassSpec new_argspec = bindObjIntoArgs(self, rewrite_args, argspec, arg1, arg2, arg3, args, new_args); RewriterVar* r_bind_obj = NULL;
if (rewrite_args) {
r_bind_obj = rewrite_args->obj;
rewrite_args->obj = NULL;
}
ArgPassSpec new_argspec
= bindObjIntoArgs(self, r_bind_obj, rewrite_args, argspec, arg1, arg2, arg3, args, new_args);
return typeCallInner(rewrite_args, new_argspec, arg1, arg2, arg3, new_args, keyword_names); return typeCallInner(rewrite_args, new_argspec, arg1, arg2, arg3, new_args, keyword_names);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment