GH-90997: Shrink the LOAD_GLOBAL caches (#102569)

This commit is contained in:
Brandt Bucher 2023-03-10 17:01:16 -08:00 committed by GitHub
parent 767d3a8f6f
commit 08b67fb34f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 187 additions and 172 deletions

View file

@ -1349,7 +1349,7 @@
TARGET(LOAD_GLOBAL) {
PREDICTED(LOAD_GLOBAL);
static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 5, "incorrect cache size");
static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size");
PyObject *null = NULL;
PyObject *v;
#if ENABLE_SPECIALIZATION
@ -1408,7 +1408,7 @@
STACK_GROW(((oparg & 1) ? 1 : 0));
stack_pointer[-1] = v;
if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
next_instr += 5;
next_instr += 4;
DISPATCH();
}
@ -1416,7 +1416,7 @@
PyObject *null = NULL;
PyObject *res;
uint16_t index = read_u16(&next_instr[1].cache);
uint32_t version = read_u32(&next_instr[2].cache);
uint16_t version = read_u16(&next_instr[2].cache);
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
PyDictObject *dict = (PyDictObject *)GLOBALS();
@ -1432,7 +1432,7 @@
STACK_GROW(((oparg & 1) ? 1 : 0));
stack_pointer[-1] = res;
if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
next_instr += 5;
next_instr += 4;
DISPATCH();
}
@ -1440,8 +1440,8 @@
PyObject *null = NULL;
PyObject *res;
uint16_t index = read_u16(&next_instr[1].cache);
uint32_t mod_version = read_u32(&next_instr[2].cache);
uint16_t bltn_version = read_u16(&next_instr[4].cache);
uint16_t mod_version = read_u16(&next_instr[2].cache);
uint16_t bltn_version = read_u16(&next_instr[3].cache);
assert(cframe.use_tracing == 0);
DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL);
@ -1460,7 +1460,7 @@
STACK_GROW(((oparg & 1) ? 1 : 0));
stack_pointer[-1] = res;
if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = null; }
next_instr += 5;
next_instr += 4;
DISPATCH();
}