mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
GH-131798: Split up and optimize CALL_STR_1 in the JIT (GH-132849)
This commit is contained in:
parent
c7a7aa9a57
commit
0a387b311e
10 changed files with 276 additions and 161 deletions
|
@ -855,6 +855,16 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_CALL_STR_1, (unused, unused, arg -- res)) {
|
||||
if (sym_matches_type(arg, &PyUnicode_Type)) {
|
||||
// e.g. str('foo') or str(foo) where foo is known to be a string
|
||||
res = arg;
|
||||
}
|
||||
else {
|
||||
res = sym_new_type(ctx, &PyUnicode_Type);
|
||||
}
|
||||
}
|
||||
|
||||
op(_GUARD_IS_TRUE_POP, (flag -- )) {
|
||||
if (sym_is_const(ctx, flag)) {
|
||||
PyObject *value = sym_get_const(ctx, flag);
|
||||
|
@ -1021,6 +1031,13 @@ dummy_func(void) {
|
|||
sym_set_const(callable, (PyObject *)&PyType_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_CALLABLE_STR_1, (callable, unused, unused -- callable, unused, unused)) {
|
||||
if (sym_get_const(ctx, callable) == (PyObject *)&PyUnicode_Type) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
}
|
||||
sym_set_const(callable, (PyObject *)&PyUnicode_Type);
|
||||
}
|
||||
|
||||
// END BYTECODES //
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue