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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
5ef559b2
Commit
5ef559b2
authored
Sep 26, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewTempExprNode, which allows incremental migration of temps to new system
parent
b0a706e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
1 deletion
+60
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+60
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
5ef559b2
...
...
@@ -560,6 +560,64 @@ class ExprNode(Node):
return
self
.
result_in_temp
()
class
NewTempExprNode
(
ExprNode
):
backwards_compatible_result
=
None
def
result
(
self
):
if
self
.
is_temp
:
return
self
.
temp_code
else
:
return
self
.
calculate_result_code
()
def
allocate_target_temps
(
self
,
env
,
rhs
):
self
.
allocate_subexpr_temps
(
env
)
rhs
.
release_temp
(
rhs
)
self
.
releasesubexpr_temps
(
env
)
def
allocate_temps
(
self
,
env
,
result
=
None
):
self
.
allocate_subexpr_temps
(
env
)
self
.
backwards_compatible_result
=
result
if
self
.
is_temp
:
self
.
release_subexpr_temps
(
env
)
def
allocate_temp
(
self
,
env
,
result
=
None
):
assert
result
is
None
def
release_temp
(
self
,
env
):
pass
def
generate_result_code
(
self
,
code
):
if
self
.
is_temp
:
type
=
self
.
type
if
not
type
.
is_void
:
if
type
.
is_pyobject
:
type
=
PyrexTypes
.
py_object_type
if
self
.
backwards_compatible_result
:
self
.
temp_code
=
self
.
backwards_compatible_result
else
:
self
.
temp_code
=
code
.
funcstate
.
allocate_temp
(
type
)
else
:
self
.
temp_code
=
None
def
generate_disposal_code
(
self
,
code
):
if
self
.
is_temp
:
if
not
self
.
backwards_compatible_result
:
code
.
funcstate
.
release_temp
(
self
.
temp_code
)
else
:
self
.
generate_subexpr_disposal_code
(
code
)
def
generate_post_assignment_code
(
self
,
code
):
if
self
.
is_temp
:
if
self
.
type
.
is_pyobject
:
code
.
putln
(
"%s = 0;"
%
self
.
temp_code
)
if
not
self
.
backwards_compatible_result
:
code
.
funcstate
.
release_temp
(
self
.
temp_code
)
else
:
self
.
generate_subexpr_disposal_code
(
code
)
class
AtomicExprNode
(
ExprNode
):
# Abstract base class for expression nodes which have
# no sub-expressions.
...
...
@@ -3220,7 +3278,7 @@ def get_compile_time_binop(node):
%
node
.
operator
)
return
func
class
BinopNode
(
ExprNode
):
class
BinopNode
(
NewTemp
ExprNode
):
# operator string
# operand1 ExprNode
# operand2 ExprNode
...
...
@@ -3270,6 +3328,7 @@ class BinopNode(ExprNode):
self
.
operand2
.
check_const
()
def
generate_result_code
(
self
,
code
):
NewTempExprNode
.
generate_result_code
(
self
,
code
)
#print "BinopNode.generate_result_code:", self.operand1, self.operand2 ###
if
self
.
operand1
.
type
.
is_pyobject
:
function
=
self
.
py_operation_function
()
...
...
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