Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5e6e3aee
Commit
5e6e3aee
authored
Dec 13, 2010
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename temps_allocator to closure_temps and move it to funcstate
parent
9a76c8a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+5
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
No files found.
Cython/Compiler/Code.py
View file @
5e6e3aee
...
...
@@ -117,6 +117,7 @@ class FunctionState(object):
self
.
temps_free
=
{}
# (type, manage_ref) -> list of free vars with same type/managed status
self
.
temps_used_type
=
{}
# name -> (type, manage_ref)
self
.
temp_counter
=
0
self
.
closure_temps
=
None
# labels
...
...
@@ -270,6 +271,9 @@ class FunctionState(object):
if
manage_ref
for
cname
in
freelist
]
def
init_closure_temps
(
self
,
scope
):
self
.
closure_temps
=
ClosureTempAllocator
(
scope
)
class
IntConst
(
object
):
"""Global info about a Python integer constant held by GlobalState.
...
...
@@ -1397,7 +1401,7 @@ class PyrexCodeWriter(object):
class
ClosureTempAllocator
(
object
):
def
__init__
(
self
,
klass
=
None
):
def
__init__
(
self
,
klass
):
self
.
klass
=
klass
self
.
temps_allocated
=
{}
self
.
temps_free
=
{}
...
...
Cython/Compiler/ExprNodes.py
View file @
5e6e3aee
...
...
@@ -5006,10 +5006,10 @@ class YieldExprNode(ExprNode):
else
:
code
.
put_init_to_py_none
(
Naming
.
retval_cname
,
py_object_type
)
saved
=
[]
code
.
temp_allocator
.
reset
()
code
.
funcstate
.
closure_temps
.
reset
()
code
.
putln
(
'/* Save temporary variables */'
)
for
cname
,
type
,
manage_ref
in
code
.
funcstate
.
temps_in_use
():
save_cname
=
code
.
temp_allocator
.
allocate_temp
(
type
)
save_cname
=
code
.
funcstate
.
closure_temps
.
allocate_temp
(
type
)
saved
.
append
((
cname
,
save_cname
,
type
))
if
type
.
is_pyobject
:
code
.
put_xgiveref
(
cname
)
...
...
Cython/Compiler/Nodes.py
View file @
5e6e3aee
...
...
@@ -1361,7 +1361,7 @@ class FuncDefNode(StatNode, BlockNode):
if
not
self
.
is_generator
:
self
.
generate_preamble
(
env
,
code
)
if
self
.
is_generator
:
code
.
temp_allocator
=
ClosureTempAllocator
(
lenv
.
scope_class
.
type
.
scope
)
code
.
funcstate
.
init_closure_temps
(
lenv
.
scope_class
.
type
.
scope
)
resume_code
=
code
.
insertion_point
()
first_run_label
=
code
.
new_label
(
'first_run'
)
code
.
use_label
(
first_run_label
)
...
...
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