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
9bf71811
Commit
9bf71811
authored
Aug 26, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite the creation of generators
parent
0fdabf35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
src/runtime/list.cpp
src/runtime/list.cpp
+2
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+11
-0
No files found.
src/runtime/list.cpp
View file @
9bf71811
...
@@ -986,7 +986,7 @@ Box* listNew(BoxedClass* cls, Box* container) {
...
@@ -986,7 +986,7 @@ Box* listNew(BoxedClass* cls, Box* container) {
Box
*
listInit
(
BoxedList
*
self
,
Box
*
container
)
{
Box
*
listInit
(
BoxedList
*
self
,
Box
*
container
)
{
assert
(
PyList_Check
(
self
));
assert
(
PyList_Check
(
self
));
if
(
container
!=
None
)
{
if
(
container
)
{
listIAdd
(
self
,
container
);
listIAdd
(
self
,
container
);
}
}
...
@@ -1243,7 +1243,7 @@ void setupList() {
...
@@ -1243,7 +1243,7 @@ void setupList() {
list_cls
->
giveAttr
(
"__new__"
,
list_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listNew
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
None
}));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listNew
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
None
}));
list_cls
->
giveAttr
(
"__init__"
,
list_cls
->
giveAttr
(
"__init__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listInit
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
N
one
}));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listInit
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
N
ULL
}));
list_cls
->
giveAttr
(
"count"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listCount
,
BOXED_INT
,
2
)));
list_cls
->
giveAttr
(
"count"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listCount
,
BOXED_INT
,
2
)));
list_cls
->
giveAttr
(
list_cls
->
giveAttr
(
...
...
src/runtime/objmodel.cpp
View file @
9bf71811
...
@@ -3645,6 +3645,17 @@ Box* callFunc(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args, ArgPassSpe
...
@@ -3645,6 +3645,17 @@ Box* callFunc(BoxedFunctionBase* func, CallRewriteArgs* rewrite_args, ArgPassSpe
// TODO: we might not have a lot to gain by rewriting into createGenerator, but we could at least
// TODO: we might not have a lot to gain by rewriting into createGenerator, but we could at least
// rewrite up to the call to it:
// rewrite up to the call to it:
res
=
createGenerator
(
func
,
arg1
,
arg2
,
arg3
,
oargs
);
res
=
createGenerator
(
func
,
arg1
,
arg2
,
arg3
,
oargs
);
if
(
rewrite_args
)
{
RewriterVar
*
r_arg1
=
num_output_args
>=
1
?
rewrite_args
->
arg1
:
rewrite_args
->
rewriter
->
loadConst
(
0
);
RewriterVar
*
r_arg2
=
num_output_args
>=
2
?
rewrite_args
->
arg2
:
rewrite_args
->
rewriter
->
loadConst
(
0
);
RewriterVar
*
r_arg3
=
num_output_args
>=
3
?
rewrite_args
->
arg3
:
rewrite_args
->
rewriter
->
loadConst
(
0
);
RewriterVar
*
r_args
=
num_output_args
>=
4
?
rewrite_args
->
args
:
rewrite_args
->
rewriter
->
loadConst
(
0
);
rewrite_args
->
out_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
createGenerator
,
rewrite_args
->
obj
,
r_arg1
,
r_arg2
,
r_arg3
,
r_args
);
rewrite_args
->
out_success
=
true
;
}
}
else
{
}
else
{
res
=
callCLFunc
<
S
>
(
f
,
rewrite_args
,
num_output_args
,
closure
,
NULL
,
func
->
globals
,
arg1
,
arg2
,
arg3
,
oargs
);
res
=
callCLFunc
<
S
>
(
f
,
rewrite_args
,
num_output_args
,
closure
,
NULL
,
func
->
globals
,
arg1
,
arg2
,
arg3
,
oargs
);
}
}
...
...
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