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
09802d7a
Commit
09802d7a
authored
Jul 05, 2019
by
gsamain
Committed by
Xavier Thompson
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clearer tracked state management (was_locked removal)
parent
a7b9dcd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
16 deletions
+2
-16
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+0
-11
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+0
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
09802d7a
...
@@ -321,7 +321,6 @@ class ExprNode(Node):
...
@@ -321,7 +321,6 @@ class ExprNode(Node):
result_is_used
=
True
result_is_used
=
True
is_numpy_attribute
=
False
is_numpy_attribute
=
False
tracked_state
=
None
tracked_state
=
None
was_locked
=
False
# The Analyse Expressions phase for expressions is split
# The Analyse Expressions phase for expressions is split
# into two sub-phases:
# into two sub-phases:
...
@@ -726,12 +725,10 @@ class ExprNode(Node):
...
@@ -726,12 +725,10 @@ class ExprNode(Node):
error
(
self
.
pos
,
"Address is not constant"
)
error
(
self
.
pos
,
"Address is not constant"
)
def
set_autorlock
(
self
,
env
):
def
set_autorlock
(
self
,
env
):
self
.
tracked_state
.
was_locked
=
True
self
.
tracked_state
.
is_rlocked
=
True
self
.
tracked_state
.
is_rlocked
=
True
self
.
tracked_state
.
needs_rlock
=
True
self
.
tracked_state
.
needs_rlock
=
True
def
set_autowlock
(
self
,
env
):
def
set_autowlock
(
self
,
env
):
self
.
tracked_state
.
was_locked
=
True
self
.
tracked_state
.
is_wlocked
=
True
self
.
tracked_state
.
is_wlocked
=
True
self
.
tracked_state
.
needs_wlock
=
True
self
.
tracked_state
.
needs_wlock
=
True
...
@@ -745,9 +742,6 @@ class ExprNode(Node):
...
@@ -745,9 +742,6 @@ class ExprNode(Node):
return
False
return
False
return
self
.
tracked_state
.
needs_wlock
return
self
.
tracked_state
.
needs_wlock
def
get_was_locked
(
self
):
return
self
.
was_locked
def
is_autolock
(
self
):
def
is_autolock
(
self
):
return
self
.
type
.
is_cyp_class
and
self
.
type
.
lock_mode
==
"autolock"
return
self
.
type
.
is_cyp_class
and
self
.
type
.
lock_mode
==
"autolock"
...
@@ -762,8 +756,6 @@ class ExprNode(Node):
...
@@ -762,8 +756,6 @@ class ExprNode(Node):
self
.
tracked_state
=
env
.
declare_tracked
(
self
.
entry
)
self
.
tracked_state
=
env
.
declare_tracked
(
self
.
entry
)
if
self
.
is_autolock
()
and
self
.
entry
.
is_variable
:
if
self
.
is_autolock
()
and
self
.
entry
.
is_variable
:
env
.
declare_autolocked
(
self
)
env
.
declare_autolocked
(
self
)
self
.
was_locked
=
self
.
tracked_state
.
was_locked
self
.
tracked_state
.
was_locked
=
True
def
is_rhs_locked
(
self
,
env
):
def
is_rhs_locked
(
self
,
env
):
if
not
hasattr
(
self
,
'entry'
)
or
not
self
.
entry
.
type
.
is_cyp_class
:
if
not
hasattr
(
self
,
'entry'
)
or
not
self
.
entry
.
type
.
is_cyp_class
:
...
@@ -13912,9 +13904,6 @@ class CoerceToTempNode(CoercionNode):
...
@@ -13912,9 +13904,6 @@ class CoerceToTempNode(CoercionNode):
def
may_be_none
(
self
):
def
may_be_none
(
self
):
return
self
.
arg
.
may_be_none
()
return
self
.
arg
.
may_be_none
()
def
get_was_locked
(
self
):
return
self
.
arg
.
get_was_locked
()
def
ensure_rhs_locked
(
self
,
env
,
is_dereferenced
=
False
):
def
ensure_rhs_locked
(
self
,
env
,
is_dereferenced
=
False
):
self
.
arg
.
ensure_rhs_locked
(
env
,
is_dereferenced
)
self
.
arg
.
ensure_rhs_locked
(
env
,
is_dereferenced
)
self
.
tracked_state
=
self
.
arg
.
tracked_state
self
.
tracked_state
=
self
.
arg
.
tracked_state
...
...
Cython/Compiler/Nodes.py
View file @
09802d7a
...
@@ -2071,7 +2071,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2071,7 +2071,7 @@ class FuncDefNode(StatNode, BlockNode):
code
.
funcstate
.
gil_owned
=
False
code
.
funcstate
.
gil_owned
=
False
for
node
in
lenv
.
autolocked_nodes
:
for
node
in
lenv
.
autolocked_nodes
:
if
node
.
entry
.
is_variable
and
not
node
.
entry
.
is_local
and
(
node
.
tracked_state
.
needs_wlock
or
node
.
tracked_state
.
needs_rlock
):
if
node
.
entry
.
is_variable
and
not
node
.
entry
.
is_local
and
(
node
.
needs_wlock
()
or
node
.
needs_rlock
()
):
node_result
=
node
.
result
()
node_result
=
node
.
result
()
code
.
putln
(
"if (%s != NULL)"
%
node_result
)
code
.
putln
(
"if (%s != NULL)"
%
node_result
)
if
node
.
needs_wlock
():
if
node
.
needs_wlock
():
...
@@ -2248,7 +2248,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2248,7 +2248,7 @@ class FuncDefNode(StatNode, BlockNode):
# which leads to a dangling lock on the previous reference
# which leads to a dangling lock on the previous reference
# (and attempt to unlock a non-locked ref).
# (and attempt to unlock a non-locked ref).
if
no
t
node
.
get_was_locked
()
and
(
node
.
tracked_state
.
needs_wlock
or
node
.
tracked_state
.
needs_rlock
):
if
no
de
.
needs_wlock
()
or
node
.
needs_rlock
(
):
code
.
putln
(
"Cy_UNLOCK(%s);"
%
node
.
result
())
code
.
putln
(
"Cy_UNLOCK(%s);"
%
node
.
result
())
for
entry
in
lenv
.
var_entries
:
for
entry
in
lenv
.
var_entries
:
...
...
Cython/Compiler/Symtab.py
View file @
09802d7a
...
@@ -162,7 +162,6 @@ class Entry(object):
...
@@ -162,7 +162,6 @@ class Entry(object):
# is_rlocked boolean Is locked with a read lock (used for cypclass)
# is_rlocked boolean Is locked with a read lock (used for cypclass)
# needs_rlock boolean The entry needs a read lock (used in autolock mode)
# needs_rlock boolean The entry needs a read lock (used in autolock mode)
# needs_wlock boolean The entry needs a write lock (used in autolock mode)
# needs_wlock boolean The entry needs a write lock (used in autolock mode)
# was_locked boolean Indicates to nodes falling through that the first lock already took place
# TODO: utility_code and utility_code_definition serves the same purpose...
# TODO: utility_code and utility_code_definition serves the same purpose...
...
@@ -238,7 +237,6 @@ class Entry(object):
...
@@ -238,7 +237,6 @@ class Entry(object):
is_rlocked
=
False
is_rlocked
=
False
needs_rlock
=
False
needs_rlock
=
False
needs_wlock
=
False
needs_wlock
=
False
was_locked
=
False
def
__init__
(
self
,
name
,
cname
,
type
,
pos
=
None
,
init
=
None
):
def
__init__
(
self
,
name
,
cname
,
type
,
pos
=
None
,
init
=
None
):
self
.
name
=
name
self
.
name
=
name
...
@@ -321,7 +319,6 @@ class TrackedLockedEntry:
...
@@ -321,7 +319,6 @@ class TrackedLockedEntry:
self
.
is_rlocked
=
False
self
.
is_rlocked
=
False
self
.
needs_wlock
=
False
self
.
needs_wlock
=
False
self
.
needs_rlock
=
False
self
.
needs_rlock
=
False
self
.
was_locked
=
False
class
Scope
(
object
):
class
Scope
(
object
):
# name string Unqualified name
# name string Unqualified name
...
...
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