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;
23
23
# define _Py_MAKECODEUNIT (opcode , oparg ) ((opcode)|((oparg)<<8))
24
24
#endif
25
25
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
+
26
29
27
30
/* Bytecode object */
28
31
struct PyCodeObject {
Original file line number Diff line number Diff line change @@ -5517,7 +5517,7 @@ opname ## _miss: \
5517
5517
_Py_CODEUNIT * counter = (_Py_CODEUNIT * )next_instr ; \
5518
5518
* counter -= 1 ; \
5519
5519
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 ); \
5521
5521
STAT_INC (opname , deopt ); \
5522
5522
* counter = ADAPTIVE_CACHE_BACKOFF ; \
5523
5523
} \
You can’t perform that action at this time.
0 commit comments