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
Gwenaël Samain
cython
Commits
31b47306
Commit
31b47306
authored
Jul 05, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clearer tracked state management (was_locked removal)
parent
aa44fd4d
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 @
31b47306
...
@@ -319,7 +319,6 @@ class ExprNode(Node):
...
@@ -319,7 +319,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:
...
@@ -694,12 +693,10 @@ class ExprNode(Node):
...
@@ -694,12 +693,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
...
@@ -713,9 +710,6 @@ class ExprNode(Node):
...
@@ -713,9 +710,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"
...
@@ -730,8 +724,6 @@ class ExprNode(Node):
...
@@ -730,8 +724,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
:
...
@@ -13730,9 +13722,6 @@ class CoerceToTempNode(CoercionNode):
...
@@ -13730,9 +13722,6 @@ class CoerceToTempNode(CoercionNode):
# The arg is always already analysed
# The arg is always already analysed
return
self
return
self
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 @
31b47306
...
@@ -2053,7 +2053,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2053,7 +2053,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
():
...
@@ -2191,7 +2191,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -2191,7 +2191,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 @
31b47306
...
@@ -139,7 +139,6 @@ class Entry(object):
...
@@ -139,7 +139,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...
...
@@ -214,7 +213,6 @@ class Entry(object):
...
@@ -214,7 +213,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
...
@@ -293,7 +291,6 @@ class TrackedLockedEntry:
...
@@ -293,7 +291,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