summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-06-17 16:00:16 (GMT)
committerGitHub <noreply@github.com>2023-06-17 16:00:16 (GMT)
commit14d01262dad02579b3dffe5965f640ce21c38896 (patch)
treed3e4dc72599c95f5dc3b3dd7eec5a1f4f3d673b0 /Include
parent34e93d3998bab8acd651c50724eb1977f4860a08 (diff)
downloadcpython-14d01262dad02579b3dffe5965f640ce21c38896.zip
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.gz
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.bz2
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_opcode.h13
-rw-r--r--Include/internal/pycore_opcode_utils.h26
-rw-r--r--Include/opcode.h19
3 files changed, 1 insertions, 57 deletions
diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h
index d680039..5935823 100644
--- a/Include/internal/pycore_opcode.h
+++ b/Include/internal/pycore_opcode.h
@@ -12,24 +12,11 @@ extern "C" {
#include "opcode.h"
-extern const uint32_t _PyOpcode_Jump[9];
-
extern const uint8_t _PyOpcode_Caches[256];
extern const uint8_t _PyOpcode_Deopt[256];
#ifdef NEED_OPCODE_TABLES
-const uint32_t _PyOpcode_Jump[9] = {
- 0U,
- 0U,
- 536870912U,
- 135020544U,
- 4163U,
- 0U,
- 0U,
- 0U,
- 48U,
-};
const uint8_t _PyOpcode_Caches[256] = {
[BINARY_SUBSCR] = 1,
diff --git a/Include/internal/pycore_opcode_utils.h b/Include/internal/pycore_opcode_utils.h
index d80b3c1..50ff2af 100644
--- a/Include/internal/pycore_opcode_utils.h
+++ b/Include/internal/pycore_opcode_utils.h
@@ -15,10 +15,7 @@ extern "C" {
#define IS_WITHIN_OPCODE_RANGE(opcode) \
(((opcode) >= 0 && (opcode) <= MAX_REAL_OPCODE) || \
- IS_PSEUDO_OPCODE(opcode))
-
-#define IS_JUMP_OPCODE(opcode) \
- is_bit_set_in_table(_PyOpcode_Jump, opcode)
+ IS_PSEUDO_INSTR(opcode))
#define IS_BLOCK_PUSH_OPCODE(opcode) \
((opcode) == SETUP_FINALLY || \
@@ -55,27 +52,6 @@ extern "C" {
(opcode) == RAISE_VARARGS || \
(opcode) == RERAISE)
-#define LOG_BITS_PER_INT 5
-#define MASK_LOW_LOG_BITS 31
-
-static inline int
-is_bit_set_in_table(const uint32_t *table, int bitindex) {
- /* Is the relevant bit set in the relevant word? */
- /* 512 bits fit into 9 32-bits words.
- * Word is indexed by (bitindex>>ln(size of int in bits)).
- * Bit within word is the low bits of bitindex.
- */
- if (bitindex >= 0 && bitindex < 512) {
- uint32_t word = table[bitindex >> LOG_BITS_PER_INT];
- return (word >> (bitindex & MASK_LOW_LOG_BITS)) & 1;
- }
- else {
- return 0;
- }
-}
-
-#undef LOG_BITS_PER_INT
-#undef MASK_LOW_LOG_BITS
/* Flags used in the oparg for MAKE_FUNCTION */
#define MAKE_FUNCTION_DEFAULTS 0x01
diff --git a/Include/opcode.h b/Include/opcode.h
index c6ffaee..43a1806 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -50,7 +50,6 @@ extern "C" {
#define SETUP_ANNOTATIONS 85
#define LOAD_LOCALS 87
#define POP_EXCEPT 89
-#define HAVE_ARGUMENT 90
#define STORE_NAME 90
#define DELETE_NAME 91
#define UNPACK_SEQUENCE 92
@@ -219,22 +218,6 @@ extern "C" {
#define UNPACK_SEQUENCE_TWO_TUPLE 160
#define SEND_GEN 161
-#define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\
- || ((op) == JUMP) \
- || ((op) == JUMP_NO_INTERRUPT) \
- || ((op) == LOAD_METHOD) \
- || ((op) == LOAD_SUPER_METHOD) \
- || ((op) == LOAD_ZERO_SUPER_METHOD) \
- || ((op) == LOAD_ZERO_SUPER_ATTR) \
- || ((op) == STORE_FAST_MAYBE_NULL) \
- )
-
-#define HAS_CONST(op) (false\
- || ((op) == LOAD_CONST) \
- || ((op) == RETURN_CONST) \
- || ((op) == KW_NAMES) \
- )
-
#define NB_ADD 0
#define NB_AND 1
#define NB_FLOOR_DIVIDE 2
@@ -265,8 +248,6 @@ extern "C" {
/* Defined in Lib/opcode.py */
#define ENABLE_SPECIALIZATION 1
-#define IS_PSEUDO_OPCODE(op) (((op) >= MIN_PSEUDO_OPCODE) && ((op) <= MAX_PSEUDO_OPCODE))
-
#ifdef __cplusplus
}
#endif