[pypy-commit] pypy oparser-mock-model: move the import of longlong inside the model

antocuni noreply at buildbot.pypy.org
Thu Jun 9 13:37:36 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: oparser-mock-model
Changeset: r44863:db05c08bbcc1
Date: 2011-06-09 12:31 +0200
http://bitbucket.org/pypy/pypy/changeset/db05c08bbcc1/

Log:	move the import of longlong inside the model

diff --git a/pypy/jit/tool/oparser.py b/pypy/jit/tool/oparser.py
--- a/pypy/jit/tool/oparser.py
+++ b/pypy/jit/tool/oparser.py
@@ -10,11 +10,9 @@
                                             UnaryOp, PlainResOp
 
 from pypy.jit.codewriter.heaptracker import adr2int
-from pypy.jit.codewriter import longlong
-from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import llmemory
 from pypy.rpython.ootypesystem import ootype
 
-
 class ParseError(Exception):
     pass
 
@@ -157,7 +155,7 @@
             return self.model.ConstInt(int(arg))
         except ValueError:
             if self.is_float(arg):
-                return self.model.ConstFloat(longlong.getfloatstorage(float(arg)))
+                return self.model.ConstFloat(self.model.convert_to_floatstorage(arg))
             if (arg.startswith('"') or arg.startswith("'") or
                 arg.startswith('s"')):
                 # XXX ootype
diff --git a/pypy/jit/tool/oparser_model.py b/pypy/jit/tool/oparser_model.py
--- a/pypy/jit/tool/oparser_model.py
+++ b/pypy/jit/tool/oparser_model.py
@@ -13,6 +13,12 @@
         get_const_ptr_for_string = staticmethod(get_const_ptr_for_string)
         get_const_ptr_for_unicode = staticmethod(get_const_ptr_for_unicode)
 
+        @staticmethod
+        def convert_to_floatstorage(arg):
+            from pypy.jit.codewriter import longlong
+            return longlong.getfloatstorage(float(arg))
+
+
     return LoopModel
 
 def get_mock_model():
@@ -76,6 +82,10 @@
         def get_const_ptr_for_unicode(cls, s):
             return cls.ConstPtr(s)
 
+        @staticmethod
+        def convert_to_floatstorage(arg):
+            return float(arg)
+
         class llhelper(object):
             pass
 


More information about the pypy-commit mailing list