Browse Source
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
This patch implements per opcode cache mechanism, and use it in only LOAD_GLOBAL opcode. Based on Yury's opcache3.patch in bpo-26219.pull/13775/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 285 additions and 16 deletions
-
4Doc/whatsnew/3.8.rst
-
17Include/code.h
-
3Include/internal/pycore_ceval.h
-
27Include/internal/pycore_code.h
-
6Lib/test/test_dict_version.py
-
1Makefile.pre.in
-
3Misc/NEWS.d/next/Core and Builtins/2019-05-29-22-03-09.bpo-26219.Ovf1Qs.rst
-
65Objects/codeobject.c
-
25Objects/dictobject.c
-
1PCbuild/pythoncore.vcxproj
-
3PCbuild/pythoncore.vcxproj.filters
-
143Python/ceval.c
-
3Python/pylifecycle.c
@ -0,0 +1,27 @@ |
|||
#ifndef Py_INTERNAL_CODE_H |
|||
#define Py_INTERNAL_CODE_H |
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
typedef struct { |
|||
PyObject *ptr; /* Cached pointer (borrowed reference) */ |
|||
uint64_t globals_ver; /* ma_version of global dict */ |
|||
uint64_t builtins_ver; /* ma_version of builtin dict */ |
|||
} _PyOpcache_LoadGlobal; |
|||
|
|||
struct _PyOpcache { |
|||
union { |
|||
_PyOpcache_LoadGlobal lg; |
|||
} u; |
|||
char optimized; |
|||
}; |
|||
|
|||
/* Private API */ |
|||
int _PyCode_InitOpcache(PyCodeObject *co); |
|||
|
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
#endif /* !Py_INTERNAL_CODE_H */ |
|||
@ -0,0 +1,3 @@ |
|||
Implemented per opcode cache mechanism and ``LOAD_GLOBAL`` instruction use |
|||
it. ``LOAD_GLOBAL`` is now about 40% faster. Contributed by Yury Selivanov, |
|||
and Inada Naoki. |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue