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
5d0d221d
Commit
5d0d221d
authored
Dec 22, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise runtime 'iso' check for 'active' and 'locked' instances
parent
c329db8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
5d0d221d
...
...
@@ -11378,6 +11378,7 @@ class ConsumeNode(ExprNode):
#
# nogil boolean used internally
# generate_runtime_check boolean used internally
# check_refcount_only boolean used internally
# operand_is_named boolean used internally
subexprs
=
[
'operand'
]
...
...
@@ -11405,12 +11406,14 @@ class ConsumeNode(ExprNode):
self
.
type
=
PyrexTypes
.
error_type
return
self
self
.
generate_runtime_check
=
operand_type
.
qualifier
not
in
(
'iso'
,
'iso~'
)
self
.
check_refcount_only
=
operand_type
.
qualifier
in
(
'active'
,
'locked'
)
if
operand_type
.
qualifier
==
'iso~'
:
self
.
type
=
operand_type
else
:
self
.
type
=
PyrexTypes
.
cyp_class_qualified_type
(
operand_type
.
qual_base_type
,
'iso~'
)
else
:
self
.
generate_runtime_check
=
True
self
.
check_refcount_only
=
False
self
.
type
=
PyrexTypes
.
cyp_class_qualified_type
(
operand_type
,
'iso~'
)
self
.
operand_is_named
=
self
.
operand
.
is_name
or
self
.
operand
.
is_attribute
self
.
is_temp
=
self
.
operand_is_named
or
(
self
.
generate_runtime_check
and
not
self
.
operand
.
is_temp
)
...
...
@@ -11441,7 +11444,10 @@ class ConsumeNode(ExprNode):
if
self
.
is_temp
:
code
.
putln
(
"%s = %s;"
%
(
result_code
,
self
.
operand
.
result
()))
if
self
.
generate_runtime_check
:
code
.
putln
(
"if (%s != NULL && !%s->CyObject_iso()) {"
%
(
result_code
,
result_code
))
if
self
.
check_refcount_only
:
code
.
putln
(
"if (%s != NULL && %s->CyObject_GETREF() != 1) {"
%
(
result_code
,
result_code
))
else
:
code
.
putln
(
"if (%s != NULL && !%s->CyObject_iso()) {"
%
(
result_code
,
result_code
))
if
self
.
nogil
:
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_STATE _save = PyGILState_Ensure();"
)
...
...
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