GH-131798: Optimize _GUARD_TOS_SLICE (GH-144470)

This commit is contained in:
Sacul 2026-02-09 02:08:26 +08:00 committed by GitHub
parent d73634935c
commit cfeede85a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 0 deletions

View file

@ -1374,6 +1374,13 @@ dummy_func(void) {
}
}
op(_GUARD_TOS_SLICE, (tos -- tos)) {
if (sym_matches_type(tos, &PySlice_Type)) {
ADD_OP(_NOP, 0, 0);
}
sym_set_type(tos, &PySlice_Type);
}
op(_GUARD_NOS_NULL, (null, unused -- null, unused)) {
if (sym_is_null(null)) {
ADD_OP(_NOP, 0, 0);

View file

@ -370,6 +370,12 @@
}
case _GUARD_TOS_SLICE: {
JitOptRef tos;
tos = stack_pointer[-1];
if (sym_matches_type(tos, &PySlice_Type)) {
ADD_OP(_NOP, 0, 0);
}
sym_set_type(tos, &PySlice_Type);
break;
}