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
9dfc01d1
Commit
9dfc01d1
authored
Sep 25, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eager-decref the iterable when breaking a loop
parent
fa775e2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
src/core/cfg.cpp
src/core/cfg.cpp
+11
-2
test/tests/local_lifetime.py
test/tests/local_lifetime.py
+4
-0
No files found.
src/core/cfg.cpp
View file @
9dfc01d1
...
...
@@ -2423,6 +2423,7 @@ public:
curblock
->
connectTo
(
test_false
);
CFGBlock
*
loop_block
=
cfg
->
addBlock
();
CFGBlock
*
break_block
=
cfg
->
addDeferredBlock
();
CFGBlock
*
end_block
=
cfg
->
addDeferredBlock
();
CFGBlock
*
else_block
=
cfg
->
addDeferredBlock
();
...
...
@@ -2433,8 +2434,7 @@ public:
curblock
=
test_false
;
pushJump
(
else_block
);
// TODO: need to del the iter_name when break'ing out of the loop
pushLoopContinuation
(
test_block
,
end_block
);
pushLoopContinuation
(
test_block
,
break_block
);
curblock
=
loop_block
;
InternedString
next_name
(
nodeName
());
...
...
@@ -2481,6 +2481,15 @@ public:
if
(
curblock
)
pushJump
(
end_block
);
if
(
break_block
->
predecessors
.
size
()
==
0
)
{
delete
break_block
;
}
else
{
cfg
->
placeBlock
(
break_block
);
curblock
=
break_block
;
push_back
(
makeKill
(
itername
));
pushJump
(
end_block
);
}
if
(
end_block
->
predecessors
.
size
()
==
0
)
{
delete
end_block
;
curblock
=
NULL
;
...
...
test/tests/local_lifetime.py
View file @
9dfc01d1
...
...
@@ -32,4 +32,8 @@ def f3():
print
i
else
:
print
-
1
for
i
in
MyIterable
():
break
print
"a"
f3
()
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