[pypy-commit] pypy remember-tracing-counts: kill optimize_hook was never usefull anyway
fijal
noreply at buildbot.pypy.org
Sun Sep 20 09:14:45 CEST 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: remember-tracing-counts
Changeset: r79710:03850deeb619
Date: 2015-09-20 09:14 +0200
http://bitbucket.org/pypy/pypy/changeset/03850deeb619/
Log: kill optimize_hook was never usefull anyway
diff --git a/pypy/module/pypyjit/__init__.py b/pypy/module/pypyjit/__init__.py
--- a/pypy/module/pypyjit/__init__.py
+++ b/pypy/module/pypyjit/__init__.py
@@ -13,7 +13,6 @@
'trace_next_iteration': 'interp_jit.trace_next_iteration',
'trace_next_iteration_hash': 'interp_jit.trace_next_iteration_hash',
'set_compile_hook': 'interp_resop.set_compile_hook',
- 'set_optimize_hook': 'interp_resop.set_optimize_hook',
'set_abort_hook': 'interp_resop.set_abort_hook',
'get_stats_snapshot': 'interp_resop.get_stats_snapshot',
'enable_debug': 'interp_resop.enable_debug',
diff --git a/pypy/module/pypyjit/hooks.py b/pypy/module/pypyjit/hooks.py
--- a/pypy/module/pypyjit/hooks.py
+++ b/pypy/module/pypyjit/hooks.py
@@ -35,10 +35,10 @@
self._compile_hook(debug_info, is_bridge=True)
def before_compile(self, debug_info):
- self._optimize_hook(debug_info, is_bridge=False)
+ pass
def before_compile_bridge(self, debug_info):
- self._optimize_hook(debug_info, is_bridge=True)
+ pass
def _compile_hook(self, debug_info, is_bridge):
space = self.space
@@ -58,34 +58,4 @@
finally:
cache.in_recursion = False
- def _optimize_hook(self, debug_info, is_bridge=False):
- space = self.space
- cache = space.fromcache(Cache)
- if cache.in_recursion:
- return
- if space.is_true(cache.w_optimize_hook):
- w_debug_info = W_JitLoopInfo(space, debug_info, is_bridge,
- cache.optimize_hook_with_ops)
- cache.in_recursion = True
- try:
- try:
- w_res = space.call_function(cache.w_optimize_hook,
- space.wrap(w_debug_info))
- if space.is_w(w_res, space.w_None):
- return
- l = []
- for w_item in space.listview(w_res):
- item = space.interp_w(WrappedOp, w_item)
- l.append(jit_hooks._cast_to_resop(item.op))
- del debug_info.operations[:] # modifying operations above is
- # probably not a great idea since types may not work
- # and we'll end up with half-working list and
- # a segfault/fatal RPython error
- for elem in l:
- debug_info.operations.append(elem)
- except OperationError, e:
- e.write_unraisable(space, "jit hook ", cache.w_compile_hook)
- finally:
- cache.in_recursion = False
-
pypy_hooks = PyPyJitIface()
diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -22,7 +22,6 @@
def __init__(self, space):
self.w_compile_hook = space.w_None
self.w_abort_hook = space.w_None
- self.w_optimize_hook = space.w_None
def getno(self):
self.no += 1
@@ -62,25 +61,6 @@
cache.compile_hook_with_ops = operations
cache.in_recursion = NonConstant(False)
- at unwrap_spec(operations=bool)
-def set_optimize_hook(space, w_hook, operations=True):
- """ set_optimize_hook(hook, operations=True)
-
- Set a compiling hook that will be called each time a loop is optimized,
- but before assembler compilation. This allows adding additional
- optimizations on Python level.
-
- The hook will be called with the pypyjit.JitLoopInfo object. Refer to it's
- docstring for details.
-
- Result value will be the resulting list of operations, or None
- """
- cache = space.fromcache(Cache)
- cache.w_optimize_hook = w_hook
- cache.optimize_hook_with_ops = operations
- cache.in_recursion = NonConstant(False)
-
-
def set_abort_hook(space, w_hook):
""" set_abort_hook(hook)
More information about the pypy-commit
mailing list