aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-08-31 09:01:00 +0300
committerMatti Picus <matti.picus@gmail.com>2020-08-31 09:01:00 +0300
commite517593b8cf1a9dc84d13cb6c811b34356add86c (patch)
tree1635aceaaefc0bba4b6ed9d3bd9e3b6da99bb31b
parentMerge branch 'branch/jit-releaseall' into 'branch/default' (diff)
downloadpypy-e517593b8cf1a9dc84d13cb6c811b34356add86c.tar.gz
pypy-e517593b8cf1a9dc84d13cb6c811b34356add86c.tar.bz2
pypy-e517593b8cf1a9dc84d13cb6c811b34356add86c.zip
document new function, fix translation
-rw-r--r--pypy/doc/jit-hooks.rst15
-rw-r--r--pypy/doc/whatsnew-head.rst6
-rw-r--r--pypy/module/pypyjit/interp_jit.py6
-rw-r--r--pypy/module/pypyjit/moduledef.py2
4 files changed, 25 insertions, 4 deletions
diff --git a/pypy/doc/jit-hooks.rst b/pypy/doc/jit-hooks.rst
index 49c3f325de..c1dabe66cb 100644
--- a/pypy/doc/jit-hooks.rst
+++ b/pypy/doc/jit-hooks.rst
@@ -2,9 +2,7 @@ JIT hooks
=========
There are several hooks in the ``pypyjit`` module that may help you with
-understanding what's pypy's JIT doing while running your program. There
-are three functions related to that coming from the ``pypyjit`` module:
-
+understanding what pypy's JIT is doing while running your program:
.. function:: set_compile_hook(callable, operations=True)
@@ -80,3 +78,14 @@ are three functions related to that coming from the ``pypyjit`` module:
* ``asmlen`` - length of raw memory with assembler associated
+Resetting the JIT
+=================
+
+.. function:: releaseall()
+
+ Marks all current machine code objects as ready to release. They will be
+ released at the next GC (unless they are currently in use in the stack of
+ one of the threads). Doing ``pypyjit.releaseall(); gc.collect()`` is a
+ heavy hammer that forces the JIT roughly back to the state of a newly
+ started PyPy.
+
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
index fd14d8106c..f7d52d2114 100644
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -42,3 +42,9 @@ Remove all implicit str-unicode conversions in RPython.
.. branch: initialize_lock_timeout_on_windows
Fix uninitialized value in rlock.acquire on windows, fixes issue 3252
+
+.. branch: jit-releaseall
+
+Add ``pypyjit.releaseall()`` that marks all current machine code
+objects as ready to release. They will be released at the next GC (unless they
+are currently in use in the stack of one of the threads).
diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
index bd0b099dc3..c1516c1cf5 100644
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -242,6 +242,12 @@ def trace_next_iteration_hash(space, hash):
@dont_look_inside
def releaseall(space):
+ """ Mark all current machine code objects as ready to release. They will
+ be released at the next GC (unless they are currently in use in the stack
+ of one of the threads). Doing pypyjit.releaseall(); gc.collect() is a
+ heavy hammer that forces the JIT roughly to the state of a newly started
+ PyPy.
+ """
jit_hooks.stats_memmgr_release_all(None)
# class Cache(object):
diff --git a/pypy/module/pypyjit/moduledef.py b/pypy/module/pypyjit/moduledef.py
index 49ec1ad556..854d1d0790 100644
--- a/pypy/module/pypyjit/moduledef.py
+++ b/pypy/module/pypyjit/moduledef.py
@@ -12,7 +12,7 @@ class Module(MixedModule):
'dont_trace_here': 'interp_jit.dont_trace_here',
'trace_next_iteration': 'interp_jit.trace_next_iteration',
'trace_next_iteration_hash': 'interp_jit.trace_next_iteration_hash',
- 'releaseall', 'interp_jit.releaseall',
+ 'releaseall': 'interp_jit.releaseall',
'set_compile_hook': 'interp_resop.set_compile_hook',
'set_abort_hook': 'interp_resop.set_abort_hook',
'set_trace_too_long_hook': 'interp_resop.set_trace_too_long_hook',