Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: kill-typesystem
Changeset: r65763:5187c3d557f1
Date: 2013-07-28 20:54 +0100
http://bitbucket.org/pypy/pypy/changeset/5187c3d557f1/

Log:    kill typesystem specialization

diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py
--- a/rpython/rtyper/annlowlevel.py
+++ b/rpython/rtyper/annlowlevel.py
@@ -73,16 +73,6 @@
         return LowLevelAnnotatorPolicy.lowlevelspecialize(funcdesc, args_s, {})
     default_specialize = staticmethod(default_specialize)
 
-    def specialize__ts(pol, funcdesc, args_s, ref):
-        ts = pol.rtyper.type_system
-        ref = ref.split('.')
-        x = ts
-        for part in ref:
-            x = getattr(x, part)
-        bk = pol.rtyper.annotator.bookkeeper
-        funcdesc2 = bk.getdesc(x)
-        return pol.default_specialize(funcdesc2, args_s)
-
     def specialize__semierased(funcdesc, args_s):
         a2l = annmodel.annotation_to_lltype
         l2a = annmodel.lltype_to_annotation
diff --git a/rpython/rtyper/lltypesystem/ll_str.py 
b/rpython/rtyper/lltypesystem/ll_str.py
--- a/rpython/rtyper/lltypesystem/ll_str.py
+++ b/rpython/rtyper/lltypesystem/ll_str.py
@@ -1,14 +1,9 @@
 from rpython.rtyper.lltypesystem.lltype import GcArray, Array, Char, malloc
-from rpython.rtyper.annlowlevel import llstr
 from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong
 from rpython.rlib import jit
 
 CHAR_ARRAY = GcArray(Char)
 
-@jit.elidable
-def ll_int_str(repr, i):
-    return ll_int2dec(i)
-
 def ll_unsigned(i):
     if isinstance(i, r_longlong) or isinstance(i, r_ulonglong):
         return r_ulonglong(i)
@@ -47,7 +42,7 @@
 hex_chars = malloc(Array(Char), 16, immortal=True)
 
 for i in range(16):
-    hex_chars[i] = "%x"%i
+    hex_chars[i] = "%x" % i
 
 @jit.elidable
 def ll_int2hex(i, addPrefix):
@@ -122,8 +117,3 @@
         result.chars[j] = temp[len-j-1]
         j += 1
     return result
-
-@jit.elidable
-def ll_float_str(repr, f):
-    from rpython.rlib.rfloat import formatd
-    return llstr(formatd(f, 'f', 6))
diff --git a/rpython/rtyper/rfloat.py b/rpython/rtyper/rfloat.py
--- a/rpython/rtyper/rfloat.py
+++ b/rpython/rtyper/rfloat.py
@@ -1,6 +1,9 @@
 from rpython.annotator import model as annmodel
 from rpython.rlib.objectmodel import _hash_float
 from rpython.rlib.rarithmetic import base_int
+from rpython.rlib.rfloat import formatd
+from rpython.rlib import jit
+from rpython.rtyper.annlowlevel import llstr
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.lltypesystem.lltype import (Signed, Unsigned,
     SignedLongLong, UnsignedLongLong, Bool, Float)
@@ -134,11 +137,9 @@
         hop.exception_cannot_occur()
         return vlist[0]
 
-    # version picked by specialisation based on which
-    # type system rtyping is using, from <type_system>.ll_str module
+    @jit.elidable
     def ll_str(self, f):
-        pass
-    ll_str._annspecialcase_ = "specialize:ts('ll_str.ll_float_str')"
+        return llstr(formatd(f, 'f', 6))
 
 #
 # _________________________ Conversions _________________________
diff --git a/rpython/rtyper/rint.py b/rpython/rtyper/rint.py
--- a/rpython/rtyper/rint.py
+++ b/rpython/rtyper/rint.py
@@ -2,7 +2,7 @@
 
 from rpython.annotator import model as annmodel
 from rpython.flowspace.operation import op_appendices
-from rpython.rlib import objectmodel
+from rpython.rlib import objectmodel, jit
 from rpython.rlib.rarithmetic import intmask, r_int, r_longlong
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.lltypesystem.lltype import (Signed, Unsigned, Bool, Float,
@@ -365,11 +365,10 @@
         hop.exception_cannot_occur()
         return vlist[0]
 
-    # version picked by specialisation based on which
-    # type system rtyping is using, from <type_system>.ll_str module
+    @jit.elidable
     def ll_str(self, i):
-        raise NotImplementedError
-    ll_str._annspecialcase_ = "specialize:ts('ll_str.ll_int_str')"
+        from rpython.rtyper.lltypesystem.ll_str import ll_int2dec
+        return ll_int2dec(i)
 
     def rtype_hex(self, hop):
         self = self.as_int
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to