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
0556c173
Commit
0556c173
authored
Nov 29, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BoolBinopNode cleanup due to new temps
parent
63968d47
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-12
No files found.
Cython/Compiler/ExprNodes.py
View file @
0556c173
...
@@ -3914,11 +3914,8 @@ class BoolBinopNode(ExprNode):
...
@@ -3914,11 +3914,8 @@ class BoolBinopNode(ExprNode):
# operator string
# operator string
# operand1 ExprNode
# operand1 ExprNode
# operand2 ExprNode
# operand2 ExprNode
# temp_bool ExprNode used internally
temp_bool
=
None
subexprs
=
[
'operand1'
,
'operand2'
]
subexprs
=
[
'operand1'
,
'operand2'
,
'temp_bool'
]
def
compile_time_value
(
self
,
denv
):
def
compile_time_value
(
self
,
denv
):
if
self
.
operator
==
'and'
:
if
self
.
operator
==
'and'
:
...
@@ -3941,7 +3938,6 @@ class BoolBinopNode(ExprNode):
...
@@ -3941,7 +3938,6 @@ class BoolBinopNode(ExprNode):
self
.
operand2
.
type
.
is_pyobject
:
self
.
operand2
.
type
.
is_pyobject
:
self
.
operand1
=
self
.
operand1
.
coerce_to_pyobject
(
env
)
self
.
operand1
=
self
.
operand1
.
coerce_to_pyobject
(
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to_pyobject
(
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to_pyobject
(
env
)
self
.
temp_bool
=
TempNode
(
self
.
pos
,
PyrexTypes
.
c_bint_type
,
env
)
self
.
type
=
py_object_type
self
.
type
=
py_object_type
self
.
gil_check
(
env
)
self
.
gil_check
(
env
)
else
:
else
:
...
@@ -3966,9 +3962,6 @@ class BoolBinopNode(ExprNode):
...
@@ -3966,9 +3962,6 @@ class BoolBinopNode(ExprNode):
# be necessary.
# be necessary.
self
.
allocate_temp
(
env
,
result_code
)
self
.
allocate_temp
(
env
,
result_code
)
self
.
operand1
.
allocate_temps
(
env
,
self
.
result
())
self
.
operand1
.
allocate_temps
(
env
,
self
.
result
())
if
self
.
temp_bool
:
self
.
temp_bool
.
allocate_temp
(
env
)
self
.
temp_bool
.
release_temp
(
env
)
self
.
operand2
.
allocate_temps
(
env
,
self
.
result
())
self
.
operand2
.
allocate_temps
(
env
,
self
.
result
())
# We haven't called release_temp on either operand,
# We haven't called release_temp on either operand,
# because although they are temp nodes, they don't own
# because although they are temp nodes, they don't own
...
@@ -3992,7 +3985,7 @@ class BoolBinopNode(ExprNode):
...
@@ -3992,7 +3985,7 @@ class BoolBinopNode(ExprNode):
def
generate_evaluation_code
(
self
,
code
):
def
generate_evaluation_code
(
self
,
code
):
self
.
operand1
.
generate_evaluation_code
(
code
)
self
.
operand1
.
generate_evaluation_code
(
code
)
test_result
=
self
.
generate_operand1_test
(
code
)
test_result
,
uses_temp
=
self
.
generate_operand1_test
(
code
)
if
self
.
operator
==
'and'
:
if
self
.
operator
==
'and'
:
sense
=
""
sense
=
""
else
:
else
:
...
@@ -4001,6 +3994,8 @@ class BoolBinopNode(ExprNode):
...
@@ -4001,6 +3994,8 @@ class BoolBinopNode(ExprNode):
"if (%s%s) {"
%
(
"if (%s%s) {"
%
(
sense
,
sense
,
test_result
))
test_result
))
if
uses_temp
:
code
.
funcstate
.
release_temp
(
test_result
)
self
.
operand1
.
generate_disposal_code
(
code
)
self
.
operand1
.
generate_disposal_code
(
code
)
self
.
operand2
.
generate_evaluation_code
(
code
)
self
.
operand2
.
generate_evaluation_code
(
code
)
code
.
putln
(
code
.
putln
(
...
@@ -4009,7 +4004,8 @@ class BoolBinopNode(ExprNode):
...
@@ -4009,7 +4004,8 @@ class BoolBinopNode(ExprNode):
def
generate_operand1_test
(
self
,
code
):
def
generate_operand1_test
(
self
,
code
):
# Generate code to test the truth of the first operand.
# Generate code to test the truth of the first operand.
if
self
.
type
.
is_pyobject
:
if
self
.
type
.
is_pyobject
:
test_result
=
self
.
temp_bool
.
result
()
test_result
=
code
.
funcstate
.
allocate_temp
(
PyrexTypes
.
c_bint_type
,
manage_ref
=
False
)
code
.
putln
(
code
.
putln
(
"%s = __Pyx_PyObject_IsTrue(%s); %s"
%
(
"%s = __Pyx_PyObject_IsTrue(%s); %s"
%
(
test_result
,
test_result
,
...
@@ -4017,7 +4013,7 @@ class BoolBinopNode(ExprNode):
...
@@ -4017,7 +4013,7 @@ class BoolBinopNode(ExprNode):
code
.
error_goto_if_neg
(
test_result
,
self
.
pos
)))
code
.
error_goto_if_neg
(
test_result
,
self
.
pos
)))
else
:
else
:
test_result
=
self
.
operand1
.
result
()
test_result
=
self
.
operand1
.
result
()
return
test_result
return
(
test_result
,
self
.
type
.
is_pyobject
)
class
CondExprNode
(
ExprNode
):
class
CondExprNode
(
ExprNode
):
...
@@ -4027,7 +4023,6 @@ class CondExprNode(ExprNode):
...
@@ -4027,7 +4023,6 @@ class CondExprNode(ExprNode):
# true_val ExprNode
# true_val ExprNode
# false_val ExprNode
# false_val ExprNode
temp_bool
=
None
true_val
=
None
true_val
=
None
false_val
=
None
false_val
=
None
...
...
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