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
88a80f47
Commit
88a80f47
authored
Jun 07, 2019
by
gsamain
Committed by
Xavier Thompson
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make lock analysis on function calls cleaner
parent
5b91cf89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+31
-9
No files found.
Cython/Compiler/ExprNodes.py
View file @
88a80f47
...
...
@@ -6002,15 +6002,6 @@ class SimpleCallNode(CallNode):
arg
.
exact_builtin_type
=
False
args
[
0
]
=
arg
# Check for args locks: read-lock for const args, write-locks for other
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
formal_arg
=
func_type
.
args
[
i
]
actual_arg
=
args
[
i
]
if
formal_arg
.
type
.
is_cyp_class
:
if
formal_arg
.
type
.
is_const
:
actual_arg
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
actual_arg
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
# Coerce arguments
some_args_in_temps
=
False
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
...
...
@@ -6133,6 +6124,37 @@ class SimpleCallNode(CallNode):
self
.
overflowcheck
=
env
.
directives
[
'overflowcheck'
]
def
ensure_subexpr_rhs_locked
(
self
,
env
):
func_type
=
self
.
function_type
()
if
func_type
.
is_pyobject
:
self
.
arg_tuple
.
ensure_rhs_locked
(
env
)
else
:
max_nargs
=
len
(
func_type
.
args
)
actual_nargs
=
len
(
self
.
args
)
# Check for args locks: read-lock for const args, write-locks for other
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
formal_arg
=
func_type
.
args
[
i
]
actual_arg
=
self
.
args
[
i
]
deref_flag
=
formal_arg
.
type
.
is_cyp_class
if
isinstance
(
formal_arg
.
type
,
PyrexTypes
.
CConstOrVolatileType
)
and
formal_arg
.
type
.
is_const
:
actual_arg
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
deref_flag
)
else
:
actual_arg
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
deref_flag
)
# XXX - Should we do something in a pyfunc case ?
if
func_type
.
is_const_method
:
self
.
function
.
ensure_rhs_locked
(
env
)
else
:
self
.
function
.
ensure_lhs_locked
(
env
)
def
ensure_subexpr_lhs_locked
(
self
,
env
):
# This may be seen a bit weird
# In fact, the only thing that changes between lhs & rhs analysis for function
# calls is that the result should be locked, but the subexpr analysis is
# exactly the same, because the result is not explicitely tied to args
# and base object (in case of a method call).
self
.
ensure_subexpr_rhs_locked
(
env
)
def
is_lhs_locked
(
self
,
env
):
return
self
.
wlocked
...
...
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