[pypy-svn] r40769 - pypy/dist/pypy/translator/goal
pedronis at codespeak.net
pedronis at codespeak.net
Mon Mar 19 14:41:42 CET 2007
Author: pedronis
Date: Mon Mar 19 14:41:39 2007
New Revision: 40769
Modified:
pypy/dist/pypy/translator/goal/targetportal.py
Log:
add usage of we_are_jitted and stopping at info from the hint policy to the example.
Modified: pypy/dist/pypy/translator/goal/targetportal.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetportal.py (original)
+++ pypy/dist/pypy/translator/goal/targetportal.py Mon Mar 19 14:41:39 2007
@@ -1,6 +1,11 @@
-from pypy.rlib.objectmodel import hint
+from pypy.rlib.objectmodel import hint, we_are_jitted
+
+def jitted():
+ print "jitted"
def compute(x, y):
+ if we_are_jitted():
+ jitted()
hint(x, concrete=True)
r = x + y
return r
@@ -20,4 +25,16 @@
return entry_point, None
def portal(drv):
- return compute, None
+ from pypy.jit.hintannotator.annotator import HintAnnotatorPolicy
+ class MyHintAnnotatorPolicy(HintAnnotatorPolicy):
+
+ def __init__(self):
+ HintAnnotatorPolicy.__init__(self, oopspec=True,
+ novirtualcontainer=True)
+
+ def look_inside_graph(self, graph):
+ if graph.func is jitted:
+ return False
+ return True
+
+ return compute, MyHintAnnotatorPolicy()
More information about the Pypy-commit
mailing list