diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-02-25 12:11:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 12:11:34 (GMT) |
commit | 0f41aac109c45aa468c432f798947c54d4178b3d (patch) | |
tree | 260fd71fc1a4d46170f254248308e026e33440df /Python/wordcode_helpers.h | |
parent | 18b5dd68c6b616257ae243c0b6bb965ffc885a23 (diff) | |
download | cpython-0f41aac109c45aa468c432f798947c54d4178b3d.zip cpython-0f41aac109c45aa468c432f798947c54d4178b3d.tar.gz cpython-0f41aac109c45aa468c432f798947c54d4178b3d.tar.bz2 |
bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543)
Diffstat (limited to 'Python/wordcode_helpers.h')
-rw-r--r-- | Python/wordcode_helpers.h | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/Python/wordcode_helpers.h b/Python/wordcode_helpers.h deleted file mode 100644 index c8f7a0f..0000000 --- a/Python/wordcode_helpers.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file contains code shared by the compiler and the peephole - optimizer. - */ - -#ifdef WORDS_BIGENDIAN -# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((opcode) << 8) | (oparg))) -#else -# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((oparg) << 8) | (opcode))) -#endif - -/* Minimum number of code units necessary to encode instruction with - EXTENDED_ARGs */ -static int -instrsize(unsigned int oparg) -{ - return oparg <= 0xff ? 1 : - oparg <= 0xffff ? 2 : - oparg <= 0xffffff ? 3 : - 4; -} - -/* Spits out op/oparg pair using ilen bytes. codestr should be pointed at the - desired location of the first EXTENDED_ARG */ -static void -write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode, - unsigned int oparg, int ilen) -{ - switch (ilen) { - case 4: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff); - /* fall through */ - case 3: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff); - /* fall through */ - case 2: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff); - /* fall through */ - case 1: - *codestr++ = PACKOPARG(opcode, oparg & 0xff); - break; - default: - Py_UNREACHABLE(); - } -} |