[pypy-svn] r5271 - pypy/trunk/src/goal
arigo at codespeak.net
arigo at codespeak.net
Thu Jun 24 18:37:23 CEST 2004
Author: arigo
Date: Thu Jun 24 18:37:23 2004
New Revision: 5271
Added:
pypy/trunk/src/goal/autopath.py (contents, props changed)
pypy/trunk/src/goal/translate_pypy.py (contents, props changed)
Log:
An ambitious goal: set the translation entry point to StdObjSpace.mul().
Added: pypy/trunk/src/goal/autopath.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/goal/autopath.py Thu Jun 24 18:37:23 2004
@@ -0,0 +1,3 @@
+import sys, os
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
+
Added: pypy/trunk/src/goal/translate_pypy.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/goal/translate_pypy.py Thu Jun 24 18:37:23 2004
@@ -0,0 +1,44 @@
+#
+#
+#
+
+import autopath
+
+from pypy.objspace.std.objspace import StdObjSpace, W_Object
+from pypy.objspace.std.intobject import W_IntObject
+from pypy.objspace.std.restricted_int import r_int
+from pypy.translator.translator import Translator
+from pypy.annotation import model as annmodel
+
+
+# __________ Entry point __________
+
+space = StdObjSpace()
+
+def entry_point():
+ w_a = W_IntObject(space, -6)
+ w_b = W_IntObject(space, -7)
+ return space.mul(w_a, w_b)
+
+
+# __________ Special cases __________
+
+def special_immutablevalue(x):
+ if x is r_int:
+ x = int
+ return general_immutablevalue(x)
+
+general_immutablevalue = annmodel.immutablevalue
+annmodel.immutablevalue = special_immutablevalue
+
+# __________ Main __________
+
+if __name__ == '__main__':
+ # 2.3 specific
+ import os
+ os.putenv("PYTHONINSPECT", "1")
+
+ t = Translator(entry_point, verbose=True)
+ t.simplify()
+ a = t.annotate([])
+ a.simplify()
More information about the Pypy-commit
mailing list