mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
GH-113464: Add a JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds or --experimental-jit for PCbuild-based ones) to build an *experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf). See Tools/jit/README.md for more information on how to install the required build-time tooling.
This commit is contained in:
parent
f7c05d7ad3
commit
f6d9e5926b
29 changed files with 1738 additions and 5 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include "pycore_function.h"
|
||||
#include "pycore_instruments.h"
|
||||
#include "pycore_intrinsics.h"
|
||||
#include "pycore_jit.h"
|
||||
#include "pycore_long.h" // _PyLong_GetZero()
|
||||
#include "pycore_moduleobject.h" // PyModuleObject
|
||||
#include "pycore_object.h" // _PyObject_GC_TRACK()
|
||||
|
|
@ -955,9 +956,24 @@ resume_with_error:
|
|||
|
||||
|
||||
|
||||
// The Tier 2 interpreter is also here!
|
||||
// Tier 2 is also here!
|
||||
enter_tier_two:
|
||||
|
||||
#ifdef _Py_JIT
|
||||
|
||||
; // ;)
|
||||
jit_func jitted = current_executor->jit_code;
|
||||
next_instr = jitted(frame, stack_pointer, tstate);
|
||||
frame = tstate->current_frame;
|
||||
Py_DECREF(current_executor);
|
||||
if (next_instr == NULL) {
|
||||
goto resume_with_error;
|
||||
}
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
DISPATCH();
|
||||
|
||||
#else
|
||||
|
||||
#undef LOAD_IP
|
||||
#define LOAD_IP(UNUSED) (void)0
|
||||
|
||||
|
|
@ -1073,6 +1089,8 @@ deoptimize:
|
|||
Py_DECREF(current_executor);
|
||||
DISPATCH();
|
||||
|
||||
#endif // _Py_JIT
|
||||
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue