Commit 31b47306 authored by gsamain's avatar gsamain

Clearer tracked state management (was_locked removal)

parent aa44fd4d
......@@ -319,7 +319,6 @@ class ExprNode(Node):
result_is_used = True
is_numpy_attribute = False
tracked_state = None
was_locked = False
# The Analyse Expressions phase for expressions is split
# into two sub-phases:
......@@ -694,12 +693,10 @@ class ExprNode(Node):
error(self.pos, "Address is not constant")
def set_autorlock(self, env):
self.tracked_state.was_locked = True
self.tracked_state.is_rlocked = True
self.tracked_state.needs_rlock = True
def set_autowlock(self, env):
self.tracked_state.was_locked = True
self.tracked_state.is_wlocked = True
self.tracked_state.needs_wlock = True
......@@ -713,9 +710,6 @@ class ExprNode(Node):
return False
return self.tracked_state.needs_wlock
def get_was_locked(self):
return self.was_locked
def is_autolock(self):
return self.type.is_cyp_class and self.type.lock_mode == "autolock"
......@@ -730,8 +724,6 @@ class ExprNode(Node):
self.tracked_state = env.declare_tracked(self.entry)
if self.is_autolock() and self.entry.is_variable:
env.declare_autolocked(self)
self.was_locked = self.tracked_state.was_locked
self.tracked_state.was_locked = True
def is_rhs_locked(self, env):
if not hasattr(self, 'entry') or not self.entry.type.is_cyp_class:
......@@ -13730,9 +13722,6 @@ class CoerceToTempNode(CoercionNode):
# The arg is always already analysed
return self
def get_was_locked(self):
return self.arg.get_was_locked()
def ensure_rhs_locked(self, env, is_dereferenced = False):
self.arg.ensure_rhs_locked(env, is_dereferenced)
self.tracked_state = self.arg.tracked_state
......
......@@ -2053,7 +2053,7 @@ class FuncDefNode(StatNode, BlockNode):
code.funcstate.gil_owned = False
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()
code.putln("if (%s != NULL)" % node_result)
if node.needs_wlock():
......@@ -2191,7 +2191,7 @@ class FuncDefNode(StatNode, BlockNode):
# which leads to a dangling lock on the previous reference
# (and attempt to unlock a non-locked ref).
if not node.get_was_locked() and (node.tracked_state.needs_wlock or node.tracked_state.needs_rlock):
if node.needs_wlock() or node.needs_rlock():
code.putln("Cy_UNLOCK(%s);" % node.result())
for entry in lenv.var_entries:
......
......@@ -139,7 +139,6 @@ class Entry(object):
# 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_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...
......@@ -214,7 +213,6 @@ class Entry(object):
is_rlocked = False
needs_rlock = False
needs_wlock = False
was_locked = False
def __init__(self, name, cname, type, pos = None, init = None):
self.name = name
......@@ -293,7 +291,6 @@ class TrackedLockedEntry:
self.is_rlocked = False
self.needs_wlock = False
self.needs_rlock = False
self.was_locked = False
class Scope(object):
# name string Unqualified name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment