GH-131798: Split up and optimize CALL_STR_1 in the JIT (GH-132849)
This commit is contained in:
@@ -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 //
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user