[pypy-svn] r61880 - in pypy/branch/pyjitpl5/pypy/jit: backend/llgraph metainterp
fijal at codespeak.net
fijal at codespeak.net
Sat Feb 14 13:49:46 CET 2009
Author: fijal
Date: Sat Feb 14 13:49:43 2009
New Revision: 61880
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
Log:
* Don't support resizable lists (at all)
* Fish a bit in the backend for correct type of ptr when
having lists of pointers
Modified: 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 Sat Feb 14 13:49:43 2009
@@ -85,7 +85,7 @@
'strsetitem' : (('ptr', 'int', 'int'), None),
'getitem' : (('ptr', 'ptr', 'int'), 'int'),
'setitem' : (('ptr', 'ptr', 'int', 'int'), None),
- 'newlist' : (('ptr', 'int'), 'ptr'),
+ 'newlist' : (('ptr', 'varargs'), 'ptr'),
}
# ____________________________________________________________
@@ -762,8 +762,19 @@
def op_setitem(self, ll_setitem, lst, item, val):
self.do_call(ll_setitem, lst, item, val)
- def op_newlist(self, ll_newlist, lgt):
- return self.do_call(ll_newlist, lgt)
+ def op_newlist(self, ll_newlist, lgt, default_val=None):
+ res = self.do_call(ll_newlist, lgt)
+ if (default_val is not None and
+ isinstance(lltype.typeOf(default_val), lltype.Ptr)):
+ TP = lltype.typeOf(res).TO.OF
+ if default_val:
+ default_val = lltype.cast_opaque_ptr(TP, res)
+ else:
+ default_val = lltype.nullptr(TP.TO)
+ if default_val is not None:
+ for i in range(len(res)):
+ res[i] = default_val
+ return res
def op_cast_int_to_ptr(self, i):
if i == 0:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py Sat Feb 14 13:49:43 2009
@@ -609,7 +609,8 @@
c_func, TP = support.builtin_func_for_spec(self.codewriter.rtyper,
oopspec_name, ll_args,
op.result.concretetype)
- if oopspec_name.startswith('list') or oopspec_name == 'newlist':
+ if ((oopspec_name.startswith('list') or oopspec_name == 'newlist') and
+ not isinstance(TP.TO, lltype.GcStruct)):
if oopspec_name.startswith('list.getitem'):
opname = oopspec_name[len('list.'):]
elif oopspec_name.startswith('list.setitem'):
More information about the Pypy-commit
mailing list