[pypy-svn] r66603 - pypy/branch/pyjitpl5/pypy/jit/backend/llgraph

arigo at codespeak.net arigo at codespeak.net
Fri Jul 24 18:16:25 CEST 2009


Author: arigo
Date: Fri Jul 24 18:16:23 2009
New Revision: 66603

Added:
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py.merge.tmp
      - copied, changed from r66600, pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/branch/pyjitpl5-optimize4/pypy/jit/backend/llgraph/llimpl.py
revisions 66237 to 66600:

    ------------------------------------------------------------------------
    r66577 | arigo | 2009-07-24 14:36:05 +0200 (Fri, 24 Jul 2009) | 2 lines
    
    Minor fixes and assert improvements.
    
    ------------------------------------------------------------------------
    r66573 | arigo | 2009-07-24 12:52:41 +0200 (Fri, 24 Jul 2009) | 2 lines
    
    Fix the llgraph backend for NEW_WITH_VTABLE not receiving a descr any more.
    
    ------------------------------------------------------------------------
    r66241 | arigo | 2009-07-15 18:36:01 +0200 (Wed, 15 Jul 2009) | 4 lines
    
    A branch in which to attempt refactoring of optimize4
    to take optimize3's idea of separating InstanceNodes and
    InstanceValues.
    
    ------------------------------------------------------------------------


Copied: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py.merge.tmp (from r66600, pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py)
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py.merge.tmp	Fri Jul 24 18:16:23 2009
@@ -624,8 +624,10 @@
     def op_new(self, size):
         return do_new(size.ofs)
 
-    def op_new_with_vtable(self, size, vtable):
-        result = do_new(size.ofs)
+    def op_new_with_vtable(self, descr, vtable):
+        assert descr is None
+        size = get_class_size(self.memocast, vtable)
+        result = do_new(size)
         value = lltype.cast_opaque_ptr(rclass.OBJECTPTR, result)
         value.typeptr = cast_from_int(rclass.CLASSTYPE, vtable, self.memocast)
         return result
@@ -685,8 +687,9 @@
 
     OPHANDLERS = [None] * (rop._LAST+1)
     
-    def op_new_with_vtable(self, typedescr, vtable):
-        from pypy.jit.backend.llgraph import runner
+    def op_new_with_vtable(self, descr, vtable):
+        assert descr is None
+        typedescr = get_class_size(self.memocast, vtable)
         return ootype.cast_to_object(ootype.new(typedescr.TYPE))
 
     def op_new_array(self, typedescr, count):
@@ -821,6 +824,8 @@
     frame.loop = loop
     frame.env = {}
     for i in range(len(loop.inputargs)):
+        expected_type = loop.inputargs[i].concretetype
+        assert lltype.typeOf(_future_values[i]) == expected_type
         frame.env[loop.inputargs[i]] = _future_values[i]
     del _future_values[:]
 
@@ -918,6 +923,7 @@
     def __init__(self):
         self.addresses = [llmemory.NULL]
         self.rev_cache = {}
+        self.vtable_to_size = {}
 
 def new_memo_cast():
     memocast = MemoCast()
@@ -940,6 +946,14 @@
     assert 0 <= int < len(memocast.addresses)
     return memocast.addresses[int]
 
+def get_class_size(memocast, vtable):
+    memocast = _from_opaque(memocast)
+    return memocast.vtable_to_size[vtable]
+
+def set_class_size(memocast, vtable, size):
+    memocast = _from_opaque(memocast)
+    memocast.vtable_to_size[vtable] = size
+
 class GuardFailed(Exception):
     pass
 
@@ -1236,6 +1250,7 @@
 setannotation(new_memo_cast, s_MemoCast)
 setannotation(cast_adr_to_int, annmodel.SomeInteger())
 setannotation(cast_int_to_adr, annmodel.SomeAddress())
+setannotation(set_class_size, annmodel.s_None)
 
 setannotation(do_arraylen_gc, annmodel.SomeInteger())
 setannotation(do_strlen, annmodel.SomeInteger())



More information about the Pypy-commit mailing list