File tree Expand file tree Collapse file tree 3 files changed +69
-81
lines changed Expand file tree Collapse file tree 3 files changed +69
-81
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ typedef uint16_t _Py_CODEUNIT;
2323# define _Py_MAKECODEUNIT (opcode , oparg ) ((opcode)|((oparg)<<8))
2424#endif
2525
26+ // Use "unsigned char" instead of "uint8_t" here to avoid illegal aliasing:
27+ #define _Py_SET_OPCODE (word , opcode ) (((unsigned char *)&(word))[0] = (opcode))
28+
2629
2730/* Bytecode object */
2831struct PyCodeObject {
Original file line number Diff line number Diff line change @@ -5517,7 +5517,7 @@ opname ## _miss: \
55175517 _Py_CODEUNIT * counter = (_Py_CODEUNIT * )next_instr ; \
55185518 * counter -= 1 ; \
55195519 if (* counter == 0 ) { \
5520- next_instr [-1 ] = _Py_MAKECODEUNIT ( opname ## _ADAPTIVE , _Py_OPARG ( next_instr [ -1 ]) ); \
5520+ _Py_SET_OPCODE ( next_instr [-1 ], opname ## _ADAPTIVE ); \
55215521 STAT_INC (opname , deopt ); \
55225522 * counter = ADAPTIVE_CACHE_BACKOFF ; \
55235523 } \
You can’t perform that action at this time.
0 commit comments