[pypy-svn] r15637 - pypy/dist/pypy/rpython

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Aug 4 18:58:36 CEST 2005


Author: cfbolz
Date: Thu Aug  4 18:58:35 2005
New Revision: 15637

Added:
   pypy/dist/pypy/rpython/chooselltype.py
Modified:
   pypy/dist/pypy/rpython/llinterp.py
Log:
First attempt of a minimally intrusive way of using the llinterpreter with
my lltype implementation. A lot of tests actually pass the problem is
that constants are not properly handled yet.


Added: pypy/dist/pypy/rpython/chooselltype.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/chooselltype.py	Thu Aug  4 18:58:35 2005
@@ -0,0 +1,24 @@
+# XXX this whole thing is messy.
+
+# choose the lltype implementation with the following variable:
+# 0 is the original pypy/rpython/lltype.py
+# 1 is the lltype implementation on top of the memory simulator:
+#     pypy/rpython/memory/lltypesimulation.py
+
+use_lltype_number = 0
+
+def raising(*args):
+    raise NotImplemented, "missing function"
+
+if use_lltype_number == 0:
+    from pypy.rpython.lltype import _ptr, Ptr, Void, typeOf, malloc, cast_pointer, PyObject, pyobjectptr
+    from pypy.rpython.lltype import Array, Struct
+    from pypy.rpython.rmodel import getfunctionptr
+elif use_lltype_number == 1:
+    from pypy.rpython.lltype import Ptr, Void, typeOf, PyObject
+    from pypy.rpython.lltype import Array, Struct
+    from pypy.rpython.memory.lltypesimulation import simulatorptr as _ptr, cast_pointer, malloc
+    pyobjectptr = raising
+    getfunctionptr = raising
+else:
+    raise ValueError, "unknown lltype number"

Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Thu Aug  4 18:58:35 2005
@@ -3,9 +3,9 @@
 from pypy.objspace.flow.model import Constant, Variable, last_exception
 from pypy.rpython.rarithmetic import intmask, r_uint, ovfcheck
 import py
-from pypy.rpython.lltype import _ptr, Ptr, Void, typeOf, malloc, cast_pointer, PyObject, pyobjectptr
-from pypy.rpython.lltype import Array, Struct
-from pypy.rpython.rmodel import getfunctionptr
+from pypy.rpython.chooselltype import _ptr, Ptr, Void, typeOf, malloc, cast_pointer, PyObject, pyobjectptr
+from pypy.rpython.chooselltype import Array, Struct
+from pypy.rpython.chooselltype import getfunctionptr
 import math
 
 log = py.log.Producer('llinterp')



More information about the Pypy-commit mailing list