[pypy-svn] r22187 - in pypy/dist/pypy: jit jit/test rpython

arigo at codespeak.net arigo at codespeak.net
Sat Jan 14 23:48:51 CET 2006


Author: arigo
Date: Sat Jan 14 23:48:48 2006
New Revision: 22187

Modified:
   pypy/dist/pypy/jit/llabstractinterp.py
   pypy/dist/pypy/jit/test/test_vlist.py
   pypy/dist/pypy/jit/vlist.py
   pypy/dist/pypy/rpython/rlist.py
Log:
Some more oopspecs, and some virtual methods working.  Nothing systematic yet.


Modified: pypy/dist/pypy/jit/llabstractinterp.py
==============================================================================
--- pypy/dist/pypy/jit/llabstractinterp.py	(original)
+++ pypy/dist/pypy/jit/llabstractinterp.py	Sat Jan 14 23:48:48 2006
@@ -872,13 +872,13 @@
             # dispatch on the 'self' argument if it is virtual
             a_self = args_a[0]
             args_a = args_a[1:]
-            if not isinstance(a_self, LLAbstractContainer):
+            if not isinstance(a_self.content, LLAbstractContainer):
                 return None
             type_name, operation_name = operation_name.split('.')
-            if a_self.type_name != type_name:
+            if a_self.content.type_name != type_name:
                 return None
             try:
-                handler = getattr(a_self, 'oop_' + operation_name)
+                handler = getattr(a_self.content, 'oop_' + operation_name)
             except AttributeError:
                 print 'MISSING HANDLER: oop_%s' % (operation_name,)
                 return None

Modified: pypy/dist/pypy/jit/test/test_vlist.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_vlist.py	(original)
+++ pypy/dist/pypy/jit/test/test_vlist.py	Sat Jan 14 23:48:48 2006
@@ -53,7 +53,6 @@
     assert insns == {'direct_call': 13}
 
 def test_newlist_force():
-    py.test.skip("in-progress")
     def fn(n):
         lst = []
         lst.append(n)

Modified: pypy/dist/pypy/jit/vlist.py
==============================================================================
--- pypy/dist/pypy/jit/vlist.py	(original)
+++ pypy/dist/pypy/jit/vlist.py	Sat Jan 14 23:48:48 2006
@@ -66,11 +66,14 @@
     def oop_append(self, op, a_newobj):
         self.items_a.append(a_newobj)
 
-    def oop_pop(self, op, a_index):
-        c_index = a_index.maybe_get_constant()
-        if c_index is None:
-            raise NotImplementedError
-        return self.items_a.pop(c_index.value)
+    def oop_pop(self, op, a_index=None):
+        if a_index is None:
+            return self.items_a.pop()
+        else:
+            c_index = a_index.maybe_get_constant()
+            if c_index is None:
+                raise NotImplementedError
+            return self.items_a.pop(c_index.value)
 
 
 def oop_newlist(op, a_numitems, a_item=ll_dummy_value):

Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Sat Jan 14 23:48:48 2006
@@ -540,6 +540,7 @@
     length = l.length
     _ll_list_resize_ge(l, length+1)
     l.items[length] = newitem
+ll_append.oopspec = 'list.append(l, newitem)'
 
 # this one is for the special case of insert(0, x)
 def ll_prepend(l, newitem):
@@ -552,6 +553,7 @@
         items[dst] = items[src]
         dst = src
     items[0] = newitem
+ll_prepend.oopspec = 'list.insert(l, 0, newitem)'
 
 def ll_insert_nonneg(l, index, newitem):
     length = l.length
@@ -563,6 +565,7 @@
         items[dst] = items[src]
         dst = src
     items[index] = newitem
+ll_insert_nonneg.oopspec = 'list.insert(l, index, newitem)'
 
 def dum_checkidx(): pass
 def dum_nocheck(): pass
@@ -573,6 +576,7 @@
     res = l.items[index]
     ll_delitem_nonneg(dum_nocheck, l, index)
     return res
+ll_pop_nonneg.oopspec = 'list.pop(l, index)'
 
 def ll_pop_default(func, l):
     length = l.length
@@ -587,6 +591,7 @@
         items[index] = nullptr(ITEM.TO)
     _ll_list_resize_le(l, newlength)
     return res
+ll_pop_default.oopspec = 'list.pop(l)'
 
 def ll_pop_zero(func, l):
     length = l.length
@@ -617,6 +622,7 @@
     res = l.items[index]
     ll_delitem_nonneg(dum_nocheck, l, index)
     return res
+ll_pop.oopspec = 'list.pop(l, index)'
 
 def ll_reverse(l):
     length = l.ll_length()
@@ -629,11 +635,13 @@
         items[length_1_i] = tmp
         i += 1
         length_1_i -= 1
+ll_reverse.oopspec = 'list.reverse(l)'
 
 def ll_getitem_nonneg(func, l, index):
     if func is dum_checkidx and (index >= l.ll_length()):
         raise IndexError
     return l.ll_items()[index]
+ll_getitem_nonneg.oopspec = 'list.getitem(l, index)'
 
 def ll_getitem(func, l, index):
     length = l.ll_length()
@@ -642,6 +650,7 @@
     if func is dum_checkidx and (index < 0 or index >= length):
         raise IndexError
     return l.ll_items()[index]
+ll_getitem.oopspec = 'list.getitem(l, index)'
 
 def ll_setitem_nonneg(func, l, index, newitem):
     if func is dum_checkidx and (index >= l.ll_length()):
@@ -674,6 +683,7 @@
     if isinstance(ITEM, Ptr):
         items[newlength] = nullptr(ITEM.TO)
     _ll_list_resize_le(l, newlength)
+ll_delitem_nonneg.oopspec = 'list.delitem(l, index)'
 
 def ll_delitem(func, l, i):
     length = l.length
@@ -682,6 +692,7 @@
     if func is dum_checkidx and (i < 0 or i >= length):
         raise IndexError
     ll_delitem_nonneg(dum_nocheck, l, i)
+ll_delitem.oopspec = 'list.delitem(l, i)'
 
 def ll_concat(RESLIST, l1, l2):
     len1 = l1.ll_length()



More information about the Pypy-commit mailing list