[pypy-svn] pypy jitypes2: hg merge default

antocuni commits-noreply at bitbucket.org
Thu Jan 20 10:07:48 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40964:6bb29ed03aa1
Date: 2011-01-20 10:07 +0100
http://bitbucket.org/pypy/pypy/changeset/6bb29ed03aa1/

Log:	hg merge default

diff --git a/pypy/jit/codewriter/assembler.py b/pypy/jit/codewriter/assembler.py
--- a/pypy/jit/codewriter/assembler.py
+++ b/pypy/jit/codewriter/assembler.py
@@ -9,6 +9,10 @@
 from pypy.rpython.lltypesystem import lltype, llmemory, rclass
 
 
+class AssemblerError(Exception):
+    pass
+
+
 class Assembler(object):
 
     def __init__(self):
@@ -24,7 +28,7 @@
         """Take the 'ssarepr' representation of the code and assemble
         it inside the 'jitcode'.  If jitcode is None, make a new one.
         """
-        self.setup()
+        self.setup(ssarepr.name)
         ssarepr._insns_pos = []
         for insn in ssarepr.insns:
             ssarepr._insns_pos.append(len(self.code))
@@ -40,7 +44,7 @@
         self._count_jitcodes += 1
         return jitcode
 
-    def setup(self):
+    def setup(self, name):
         self.code = []
         self.constants_dict = {}
         self.constants_i = []
@@ -54,6 +58,7 @@
         self.startpoints = set()
         self.alllabels = set()
         self.resulttypes = {}
+        self.ssareprname = name
 
     def emit_reg(self, reg):
         if reg.index >= self.count_regs[reg.kind]:
@@ -62,8 +67,8 @@
 
     def emit_const(self, const, kind, allow_short=False):
         value = const.value
-        TYPE = lltype.typeOf(value)
         if kind == 'int':
+            TYPE = const.concretetype
             if isinstance(TYPE, lltype.Ptr):
                 assert TYPE.TO._gckind == 'raw'
                 self.see_raw_object(value)
@@ -83,10 +88,11 @@
             value = lltype.cast_opaque_ptr(llmemory.GCREF, value)
             constants = self.constants_r
         elif kind == 'float':
-            assert TYPE == lltype.Float
+            assert const.concretetype == lltype.Float
             constants = self.constants_f
         else:
-            raise NotImplementedError(const)
+            raise AssemblerError('unimplemented %r in %r' %
+                                 (const, self.ssareprname))
         key = (kind, Constant(value))
         if key not in self.constants_dict:
             constants.append(value)


More information about the Pypy-commit mailing list