Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
88b62b62
Commit
88b62b62
authored
Jun 24, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to simplify things using bindObjIntoArgs
parent
4f95e1cc
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
157 deletions
+57
-157
src/asm_writing/rewriter.cpp
src/asm_writing/rewriter.cpp
+9
-7
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+35
-146
src/runtime/rewrite_args.h
src/runtime/rewrite_args.h
+4
-3
src/runtime/types.cpp
src/runtime/types.cpp
+9
-1
No files found.
src/asm_writing/rewriter.cpp
View file @
88b62b62
...
...
@@ -1232,6 +1232,15 @@ int Rewriter::_allocate(RewriterVar* result, int n) {
if
(
consec
==
n
)
{
int
a
=
i
/
8
-
n
+
1
;
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
();
// TODO should be a LEA instruction
...
...
@@ -1240,13 +1249,6 @@ int Rewriter::_allocate(RewriterVar* result, int n) {
assembler
->
mov
(
assembler
::
RSP
,
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
();
result
->
releaseIfNoUses
();
return
a
;
...
...
src/runtime/objmodel.cpp
View file @
88b62b62
This diff is collapsed.
Click to expand it.
src/runtime/rewrite_args.h
View file @
88b62b62
...
...
@@ -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
*&
oarg1
,
Box
*&
oarg2
,
Box
*&
oarg3
,
Box
**
oargs
);
// 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
,
Box
*&
arg3
,
Box
**
args
,
Box
**
new_args
);
// new_args should be allocated by the caller if at least three args get passed in.
// rewrite_args will get modified in place.
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
#endif
src/runtime/types.cpp
View file @
88b62b62
...
...
@@ -547,7 +547,15 @@ static Box* typeTppCall(Box* self, CallRewriteArgs* rewrite_args, ArgPassSpec ar
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment