gh-148211: decompose _POP_TOP_LOAD_CONST_INLINE(_BORROW) in JIT (GH-148230)

This commit is contained in:
Neko Asakura 2026-04-08 23:20:31 +08:00 committed by GitHub
parent 461125aaa3
commit d2fa4b2b13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 62 additions and 71 deletions

View file

@ -757,14 +757,6 @@ dummy_func(void) {
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
}
op(_POP_TOP_LOAD_CONST_INLINE, (ptr/4, pop -- value)) {
value = sym_new_const(ctx, ptr);
}
op(_POP_TOP_LOAD_CONST_INLINE_BORROW, (ptr/4, pop -- value)) {
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
}
op(_POP_CALL_LOAD_CONST_INLINE_BORROW, (ptr/4, unused, unused -- value)) {
value = PyJitRef_Borrow(sym_new_const(ctx, ptr));
}
@ -845,7 +837,7 @@ dummy_func(void) {
if (watched_mutations < _Py_MAX_ALLOWED_GLOBALS_MODIFICATIONS) {
PyDict_Watch(GLOBALS_WATCHER_ID, dict);
_Py_BloomFilter_Add(dependencies, dict);
PyObject *res = convert_global_to_const(this_instr, dict, false, true);
PyObject *res = convert_global_to_const(this_instr, dict, true);
if (res == NULL) {
attr = sym_new_not_null(ctx);
}
@ -898,8 +890,7 @@ dummy_func(void) {
PyTypeObject *type = (PyTypeObject *)sym_get_const(ctx, owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_POP_TOP_LOAD_CONST_INLINE_BORROW,
_POP_TOP_LOAD_CONST_INLINE);
true);
}
op(_LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES, (descr/4, owner -- attr)) {
@ -907,8 +898,7 @@ dummy_func(void) {
PyTypeObject *type = sym_get_type(owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_POP_TOP_LOAD_CONST_INLINE_BORROW,
_POP_TOP_LOAD_CONST_INLINE);
true);
}
op(_LOAD_ATTR_NONDESCRIPTOR_NO_DICT, (descr/4, owner -- attr)) {
@ -916,8 +906,7 @@ dummy_func(void) {
PyTypeObject *type = sym_get_type(owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_POP_TOP_LOAD_CONST_INLINE_BORROW,
_POP_TOP_LOAD_CONST_INLINE);
true);
}
op(_LOAD_ATTR_METHOD_WITH_VALUES, (descr/4, owner -- attr, self)) {
@ -925,8 +914,7 @@ dummy_func(void) {
PyTypeObject *type = sym_get_type(owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_INSERT_1_LOAD_CONST_INLINE_BORROW,
_INSERT_1_LOAD_CONST_INLINE);
false);
self = owner;
}
@ -935,8 +923,7 @@ dummy_func(void) {
PyTypeObject *type = sym_get_type(owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_INSERT_1_LOAD_CONST_INLINE_BORROW,
_INSERT_1_LOAD_CONST_INLINE);
false);
self = owner;
}
@ -945,8 +932,7 @@ dummy_func(void) {
PyTypeObject *type = sym_get_type(owner);
PyObject *name = get_co_name(ctx, oparg >> 1);
attr = lookup_attr(ctx, dependencies, this_instr, type, name,
_INSERT_1_LOAD_CONST_INLINE_BORROW,
_INSERT_1_LOAD_CONST_INLINE);
false);
self = owner;
}
@ -2010,7 +1996,7 @@ dummy_func(void) {
ctx->builtins_watched = true;
}
if (ctx->frame->globals_checked_version != 0 && ctx->frame->globals_watched) {
cnst = convert_global_to_const(this_instr, builtins, false, false);
cnst = convert_global_to_const(this_instr, builtins, false);
}
}
if (cnst == NULL) {
@ -2049,7 +2035,7 @@ dummy_func(void) {
ctx->frame->globals_checked_version = version;
}
if (ctx->frame->globals_checked_version == version) {
cnst = convert_global_to_const(this_instr, globals, false, false);
cnst = convert_global_to_const(this_instr, globals, false);
}
}
}