Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Shrink load method cache
  • Loading branch information
Fidget-Spinner committed Jun 7, 2022
commit 56ea61a3739648d929f3a58c9f3ff659b1990702
12 changes: 5 additions & 7 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,19 @@ typedef struct {
_Py_CODEUNIT index;
} _PyAttrCache;


// MUST be the max(_PyAttrCache, _PyLoadMethodCache)
#define INLINE_CACHE_ENTRIES_LOAD_ATTR CACHE_ENTRIES(_PyLoadMethodCache)

#define INLINE_CACHE_ENTRIES_STORE_ATTR CACHE_ENTRIES(_PyAttrCache)

typedef struct {
_Py_CODEUNIT counter;
_Py_CODEUNIT type_version[2];
_Py_CODEUNIT UNUSED;
_Py_CODEUNIT keys_version[2];
_Py_CODEUNIT descr[4];
} _PyLoadMethodCache;


// MUST be the max(_PyAttrCache, _PyLoadMethodCache)
#define INLINE_CACHE_ENTRIES_LOAD_ATTR CACHE_ENTRIES(_PyLoadMethodCache)

#define INLINE_CACHE_ENTRIES_STORE_ATTR CACHE_ENTRIES(_PyAttrCache)

typedef struct {
_Py_CODEUNIT counter;
_Py_CODEUNIT func_version[2];
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Lib/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ def jabs_op(name, op):
"LOAD_ATTR": {
"counter": 1,
"version": 2,
"index": 1,
"keys_version": 2,
"descr": 4,
},
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def bug42562():

%3d LOAD_GLOBAL 0 (Exception)
CHECK_EXC_MATCH
POP_JUMP_FORWARD_IF_FALSE 24 (to 84)
POP_JUMP_FORWARD_IF_FALSE 23 (to 82)
STORE_FAST 0 (e)

%3d LOAD_FAST 0 (e)
Expand Down Expand Up @@ -983,7 +983,7 @@ def test_load_attr_specialize(self):

1 2 LOAD_CONST 0 ('a')
4 LOAD_ATTR_SLOT 0 (__class__)
26 RETURN_VALUE
24 RETURN_VALUE
"""
co = compile("'a'.__class__", "", "eval")
self.code_quicken(lambda: exec(co, {}, {}))
Expand Down
69 changes: 34 additions & 35 deletions Programs/test_frozenmain.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.