[pypy-commit] pypy stm-gc: Kill that approach to detect that stm is not needed to access frames.

arigo noreply at buildbot.pypy.org
Sun Feb 12 18:39:48 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52395:63bb9bd6ff7d
Date: 2012-02-12 18:39 +0100
http://bitbucket.org/pypy/pypy/changeset/63bb9bd6ff7d/

Log:	Kill that approach to detect that stm is not needed to access
	frames. I have another plan.

diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -39,9 +39,6 @@
 
     __metaclass__ = extendabletype
 
-    _stm_access_directly_ = True
-    _immutable_fields_ = ['locals_stack_w->...', 'cells->...']
-
     frame_finished_execution = False
     last_instr               = -1
     last_exception           = None
diff --git a/pypy/rpython/rclass.py b/pypy/rpython/rclass.py
--- a/pypy/rpython/rclass.py
+++ b/pypy/rpython/rclass.py
@@ -38,11 +38,7 @@
     def __repr__(self):
         return '<%s>' % self.name
 
-# IR_MUTABLE_OWNED means that the field is a regular mutable pointer field,
-# but as a pointer it is the only reference to whatever it points to.  This
-# is useful for STM support in PyFrame.
 IR_MUTABLE              = ImmutableRanking('mutable', False)
-IR_MUTABLE_OWNED        = ImmutableRanking("mutable_owned", False)
 IR_IMMUTABLE            = ImmutableRanking('immutable', True)
 IR_IMMUTABLE_ARRAY      = ImmutableRanking('immutable_array', True)
 IR_QUASIIMMUTABLE       = ImmutableRanking('quasiimmutable', False)
@@ -210,8 +206,6 @@
                 self.immutable_field_set = set(immutable_fields.value)
             accessor = FieldListAccessor()
             hints['immutable_fields'] = accessor
-        if self.classdef.classdesc.lookup('_stm_access_directly_') is not None:
-            hints['stm_access_directly'] = True
         return hints
 
     def __repr__(self):
@@ -256,9 +250,6 @@
             elif name.endswith('?'):    # a quasi-immutable field
                 name = name[:-1]
                 rank = IR_QUASIIMMUTABLE
-            elif name.endswith('->...'):  # for stm_access_directly:
-                name = name[:-5]          # a mutable but owned object
-                rank = IR_MUTABLE_OWNED
             else:                       # a regular immutable/green field
                 rank = IR_IMMUTABLE
             try:
diff --git a/pypy/rpython/test/test_rclass.py b/pypy/rpython/test/test_rclass.py
--- a/pypy/rpython/test/test_rclass.py
+++ b/pypy/rpython/test/test_rclass.py
@@ -7,7 +7,6 @@
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 from pypy.rpython.rclass import IR_IMMUTABLE, IR_IMMUTABLE_ARRAY
 from pypy.rpython.rclass import IR_QUASIIMMUTABLE, IR_QUASIIMMUTABLE_ARRAY
-from pypy.rpython.rclass import IR_MUTABLE_OWNED
 from pypy.rpython.error import TyperError
 from pypy.objspace.flow.model import summary
 
@@ -1143,49 +1142,6 @@
                                       'cast_pointer': 1,
                                       'setfield': 1}
 
-    def test_stm_access_directly(self):
-        for ret in ['a', 'b', 'c']:
-            class A(object):
-                pass
-            class B(A):
-                _stm_access_directly_ = True
-            class C(B):
-                pass
-            def f(n):
-                a = b = c = None
-                if n < 5:
-                    a = A()
-                    a.a = n
-                elif n < 10:
-                    b = B()
-                    b.b = n
-                else:
-                    c = C()
-                    c.c = n
-                if ret == 'a': return a
-                if ret == 'b': return b
-                if ret == 'c': return c
-            t, typer, graph = self.gengraph(f, [int])
-            TYPE = graph.getreturnvar().concretetype.TO
-            if ret == 'a':
-                assert "stm_access_directly" not in TYPE._hints
-            else:
-                assert TYPE._hints["stm_access_directly"] == True
-
-    def test_mutable_but_owned(self):
-        class A(object):
-            _immutable_fields_ = ['a->...']
-        class B(object):
-            pass
-        def f(n):
-            a = A()
-            a.a = B()
-            return a
-        t, typer, graph = self.gengraph(f, [int])
-        A_TYPE = graph.getreturnvar().concretetype.TO
-        accessor = A_TYPE._hints["immutable_fields"]
-        assert accessor._fields == {"inst_a": IR_MUTABLE_OWNED}
-
 
 class TestOOtype(BaseTestRclass, OORtypeMixin):
 


More information about the pypy-commit mailing list