Author: Maciej Fijalkowski <[email protected]>
Branch: rdict-experiments-3
Changeset: r67308:02efe5a1512a
Date: 2013-10-11 11:44 +0200
http://bitbucket.org/pypy/pypy/changeset/02efe5a1512a/

Log:    kill the flag a little better

diff --git a/pypy/objspace/std/dictmultiobject.py 
b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -8,7 +8,6 @@
 from pypy.objspace.std.util import negate
 
 from rpython.rlib import jit, rerased
-from rpython.rlib.debug import mark_dict_non_null
 from rpython.rlib.objectmodel import newlist_hint, r_dict, specialize
 from rpython.tool.sourcetools import func_renamer, func_with_new_name
 
@@ -854,8 +853,7 @@
         return True
 
     def get_empty_storage(self):
-        new_dict = r_dict(self.space.eq_w, self.space.hash_w,
-                          force_non_null=True)
+        new_dict = r_dict(self.space.eq_w, self.space.hash_w)
         return self.erase(new_dict)
 
     def _never_equal_to(self, w_lookup_type):
@@ -890,7 +888,6 @@
 
     def get_empty_storage(self):
         res = {}
-        mark_dict_non_null(res)
         return self.erase(res)
 
     def _never_equal_to(self, w_lookup_type):
@@ -954,7 +951,6 @@
 
     def get_empty_storage(self):
         res = {}
-        mark_dict_non_null(res)
         return self.erase(res)
 
     def _never_equal_to(self, w_lookup_type):
diff --git a/pypy/objspace/std/identitydict.py 
b/pypy/objspace/std/identitydict.py
--- a/pypy/objspace/std/identitydict.py
+++ b/pypy/objspace/std/identitydict.py
@@ -2,7 +2,6 @@
 ## dict strategy (see dictmultiobject.py)
 
 from rpython.rlib import rerased
-from rpython.rlib.debug import mark_dict_non_null
 from pypy.objspace.std.dictmultiobject import (AbstractTypedStrategy,
                                                DictStrategy,
                                                create_iterator_classes)
@@ -66,7 +65,6 @@
 
     def get_empty_storage(self):
         d = {}
-        mark_dict_non_null(d)
         return self.erase(d)
 
     def is_correct_type(self, w_obj):
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -1533,7 +1533,7 @@
 # some helper functions
 
 def newset(space):
-    return r_dict(space.eq_w, space.hash_w, force_non_null=True)
+    return r_dict(space.eq_w, space.hash_w)
 
 def set_strategy_and_setdata(space, w_set, w_iterable):
     if w_iterable is None :
diff --git a/rpython/annotator/dictdef.py b/rpython/annotator/dictdef.py
--- a/rpython/annotator/dictdef.py
+++ b/rpython/annotator/dictdef.py
@@ -84,14 +84,12 @@
 
     def __init__(self, bookkeeper, s_key = s_ImpossibleValue,
                                  s_value = s_ImpossibleValue,
-                               is_r_dict = False,
-                           force_non_null = False):
+                                 is_r_dict = False):
         self.dictkey = DictKey(bookkeeper, s_key, is_r_dict)
         self.dictkey.itemof[self] = True
         self.dictvalue = DictValue(bookkeeper, s_value)
         self.dictvalue.itemof[self] = True
         self.bookkeeper = bookkeeper
-        self.force_non_null = force_non_null
 
     def read_key(self, position_key=None):
         if position_key is None:
diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -303,28 +303,6 @@
         return hop.inputarg(hop.args_r[0], arg=0)
 
 
-def mark_dict_non_null(d):
-    """ Mark dictionary as having non-null keys and values. A warning would
-    be emitted (not an error!) in case annotation disagrees.
-    """
-    assert isinstance(d, dict)
-    return d
-
-
-class DictMarkEntry(ExtRegistryEntry):
-    _about_ = mark_dict_non_null
-
-    def compute_result_annotation(self, s_dict):
-        from rpython.annotator.model import SomeDict
-
-        assert isinstance(s_dict, SomeDict)
-        s_dict.dictdef.force_non_null = True
-        return s_dict
-
-    def specialize_call(self, hop):
-        hop.exception_cannot_occur()
-        return hop.inputarg(hop.args_r[0], arg=0)
-
 class IntegerCanBeNegative(Exception):
     pass
 
diff --git a/rpython/rlib/test/test_debug.py b/rpython/rlib/test/test_debug.py
--- a/rpython/rlib/test/test_debug.py
+++ b/rpython/rlib/test/test_debug.py
@@ -3,8 +3,7 @@
 from rpython.rlib.debug import (check_annotation, make_sure_not_resized,
                              debug_print, debug_start, debug_stop,
                              have_debug_prints, debug_offset, debug_flush,
-                             check_nonneg, IntegerCanBeNegative,
-                             mark_dict_non_null)
+                             check_nonneg, IntegerCanBeNegative)
 from rpython.rlib import debug
 from rpython.rtyper.test.test_llinterp import interpret, gengraph
 
@@ -53,15 +52,6 @@
     py.test.raises(ListChangeUnallowed, interpret, f, [],
                    list_comprehension_operations=True)
 
-def test_mark_dict_non_null():
-    def f():
-        d = {"ac": "bx"}
-        mark_dict_non_null(d)
-        return d
-
-    t, typer, graph = gengraph(f, [])
-    assert 
sorted(graph.returnblock.inputargs[0].concretetype.TO.entries.TO.OF._flds.keys())
 == ['key', 'value']
-
 
 class DebugTests(object):
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to