gh-115999: Add free-threaded specialization for SEND (gh-127426)

No additional thread safety changes are required.  Note that sending to
a generator that is shared between threads is currently not safe in the
free-threaded build.
This commit is contained in:
Neil Schemenauer 2024-12-03 10:25:12 -08:00 committed by GitHub
parent 13b68e1a61
commit 276cd66ccb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 50 additions and 15 deletions

View file

@ -1117,7 +1117,7 @@ dummy_func(
};
specializing op(_SPECIALIZE_SEND, (counter/1, receiver, unused -- receiver, unused)) {
#if ENABLE_SPECIALIZATION
#if ENABLE_SPECIALIZATION_FT
if (ADAPTIVE_COUNTER_TRIGGERS(counter)) {
next_instr = this_instr;
_Py_Specialize_Send(receiver, next_instr);
@ -1125,7 +1125,7 @@ dummy_func(
}
OPCODE_DEFERRED_INC(SEND);
ADVANCE_ADAPTIVE_COUNTER(this_instr[1].counter);
#endif /* ENABLE_SPECIALIZATION */
#endif /* ENABLE_SPECIALIZATION_FT */
}
op(_SEND, (receiver, v -- receiver, retval)) {