Author: Maciej Fijalkowski <[email protected]>
Branch: improve-consecutive-dict-lookups
Changeset: r70015:b6d875f4bbaf
Date: 2014-03-17 16:00 +0200
http://bitbucket.org/pypy/pypy/changeset/b6d875f4bbaf/

Log:    fixes

diff --git a/rpython/jit/metainterp/optimizeopt/heap.py 
b/rpython/jit/metainterp/optimizeopt/heap.py
--- a/rpython/jit/metainterp/optimizeopt/heap.py
+++ b/rpython/jit/metainterp/optimizeopt/heap.py
@@ -298,7 +298,7 @@
 
     def _optimize_CALL_DICT_LOOKUP(self, op):
         args = self.optimizer.make_args_key(op)
-        descr = op.getdescr().extrainfo.extradescr
+        descr = op.getdescr().get_extra_info().extradescr
         res_v = self.getvalue(op.result)
         if descr in self.cached_dict_reads:
             d = self.cached_dict_reads[descr]
@@ -306,7 +306,7 @@
             d = args_dict()
         try:
             res_v = d[args]
-            self.optimizer.make_equal_to(op.result, res_v, True)
+            self.make_equal_to(op.result, res_v)
             self.remove_next_guard = True
             res = True
         except KeyError:
diff --git a/rpython/rtyper/lltypesystem/rbuilder.py 
b/rpython/rtyper/lltypesystem/rbuilder.py
--- a/rpython/rtyper/lltypesystem/rbuilder.py
+++ b/rpython/rtyper/lltypesystem/rbuilder.py
@@ -85,14 +85,6 @@
         ll_builder.used = needed
 
     @staticmethod
-    @enforceargs(None, lltype.Char)
-    def ll_append_char(ll_builder, char):
-        if ll_builder.used == ll_builder.allocated:
-            ll_builder.grow(ll_builder, 1)
-        ll_builder.buf.chars[ll_builder.used] = char
-        ll_builder.used += 1
-
-    @staticmethod
     def ll_append_slice(ll_builder, ll_str, start, end):
         needed = end - start
         used = ll_builder.used
@@ -114,6 +106,7 @@
         ll_builder.used = used
 
     @staticmethod
+    @enforceargs(None, None, int)
     def ll_append_charpsize(ll_builder, charp, size):
         used = ll_builder.used
         if used + size > ll_builder.allocated:
@@ -139,6 +132,14 @@
         return ll_builder != nullptr(cls.lowleveltype.TO)
 
 class StringBuilderRepr(BaseStringBuilderRepr):
+    @staticmethod
+    @enforceargs(None, lltype.Char)
+    def ll_append_char(ll_builder, char):
+        if ll_builder.used == ll_builder.allocated:
+            ll_builder.grow(ll_builder, 1)
+        ll_builder.buf.chars[ll_builder.used] = char
+        ll_builder.used += 1
+
     lowleveltype = lltype.Ptr(STRINGBUILDER)
     basetp = STR
     mallocfn = staticmethod(rstr.mallocstr)
@@ -149,6 +150,15 @@
     )
 
 class UnicodeBuilderRepr(BaseStringBuilderRepr):
+
+    @staticmethod
+    @enforceargs(None, lltype.UniChar)
+    def ll_append_char(ll_builder, char):
+        if ll_builder.used == ll_builder.allocated:
+            ll_builder.grow(ll_builder, 1)
+        ll_builder.buf.chars[ll_builder.used] = char
+        ll_builder.used += 1
+
     lowleveltype = lltype.Ptr(UNICODEBUILDER)
     basetp = UNICODE
     mallocfn = staticmethod(rstr.mallocunicode)
diff --git a/rpython/rtyper/lltypesystem/rstr.py 
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -4,7 +4,7 @@
 from rpython.rlib import jit, types
 from rpython.rlib.debug import ll_assert
 from rpython.rlib.objectmodel import (malloc_zero_filled, we_are_translated,
-    _hash_string, keepalive_until_here, specialize)
+    _hash_string, keepalive_until_here, specialize, enforceargs)
 from rpython.rlib.signature import signature
 from rpython.rlib.rarithmetic import ovfcheck
 from rpython.rtyper.error import TyperError
@@ -108,6 +108,7 @@
     copy_string_to_raw = func_with_new_name(copy_string_to_raw, 
'copy_%s_to_raw' % name)
 
     @jit.dont_look_inside
+    @enforceargs(None, None, None, int)
     def copy_raw_to_string(ptrsrc, dst, dststart, length):
         # xxx Warning: same note as above apply: don't do this at home
         assert length >= 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to