bpo-45885: Specialize COMPARE_OP (GH-29734)

* Add COMPARE_OP_ADAPTIVE adaptive instruction.

* Add COMPARE_OP_FLOAT_JUMP, COMPARE_OP_INT_JUMP and COMPARE_OP_STR_JUMP specialized instructions.

* Introduce and use _PyUnicode_Equal
This commit is contained in:
Dennis Sweeney 2021-12-03 04:29:12 -07:00 committed by GitHub
parent 99fcf15052
commit 03768c4d13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 289 additions and 60 deletions

78
Include/opcode.h generated
View file

@ -121,43 +121,47 @@ extern "C" {
#define BINARY_OP_MULTIPLY_FLOAT 18
#define BINARY_OP_SUBTRACT_INT 19
#define BINARY_OP_SUBTRACT_FLOAT 20
#define BINARY_SUBSCR_ADAPTIVE 21
#define BINARY_SUBSCR_GETITEM 22
#define BINARY_SUBSCR_LIST_INT 23
#define BINARY_SUBSCR_TUPLE_INT 24
#define BINARY_SUBSCR_DICT 26
#define STORE_SUBSCR_ADAPTIVE 27
#define STORE_SUBSCR_LIST_INT 28
#define STORE_SUBSCR_DICT 29
#define CALL_FUNCTION_ADAPTIVE 34
#define CALL_FUNCTION_BUILTIN_O 36
#define CALL_FUNCTION_BUILTIN_FAST 38
#define CALL_FUNCTION_LEN 39
#define CALL_FUNCTION_ISINSTANCE 40
#define CALL_FUNCTION_PY_SIMPLE 41
#define JUMP_ABSOLUTE_QUICK 42
#define LOAD_ATTR_ADAPTIVE 43
#define LOAD_ATTR_INSTANCE_VALUE 44
#define LOAD_ATTR_WITH_HINT 45
#define LOAD_ATTR_SLOT 46
#define LOAD_ATTR_MODULE 47
#define LOAD_GLOBAL_ADAPTIVE 48
#define LOAD_GLOBAL_MODULE 55
#define LOAD_GLOBAL_BUILTIN 56
#define LOAD_METHOD_ADAPTIVE 57
#define LOAD_METHOD_CACHED 58
#define LOAD_METHOD_CLASS 59
#define LOAD_METHOD_MODULE 62
#define LOAD_METHOD_NO_DICT 63
#define STORE_ATTR_ADAPTIVE 64
#define STORE_ATTR_INSTANCE_VALUE 65
#define STORE_ATTR_SLOT 66
#define STORE_ATTR_WITH_HINT 67
#define LOAD_FAST__LOAD_FAST 75
#define STORE_FAST__LOAD_FAST 76
#define LOAD_FAST__LOAD_CONST 77
#define LOAD_CONST__LOAD_FAST 78
#define STORE_FAST__STORE_FAST 79
#define COMPARE_OP_ADAPTIVE 21
#define COMPARE_OP_FLOAT_JUMP 22
#define COMPARE_OP_INT_JUMP 23
#define COMPARE_OP_STR_JUMP 24
#define BINARY_SUBSCR_ADAPTIVE 26
#define BINARY_SUBSCR_GETITEM 27
#define BINARY_SUBSCR_LIST_INT 28
#define BINARY_SUBSCR_TUPLE_INT 29
#define BINARY_SUBSCR_DICT 34
#define STORE_SUBSCR_ADAPTIVE 36
#define STORE_SUBSCR_LIST_INT 38
#define STORE_SUBSCR_DICT 39
#define CALL_FUNCTION_ADAPTIVE 40
#define CALL_FUNCTION_BUILTIN_O 41
#define CALL_FUNCTION_BUILTIN_FAST 42
#define CALL_FUNCTION_LEN 43
#define CALL_FUNCTION_ISINSTANCE 44
#define CALL_FUNCTION_PY_SIMPLE 45
#define JUMP_ABSOLUTE_QUICK 46
#define LOAD_ATTR_ADAPTIVE 47
#define LOAD_ATTR_INSTANCE_VALUE 48
#define LOAD_ATTR_WITH_HINT 55
#define LOAD_ATTR_SLOT 56
#define LOAD_ATTR_MODULE 57
#define LOAD_GLOBAL_ADAPTIVE 58
#define LOAD_GLOBAL_MODULE 59
#define LOAD_GLOBAL_BUILTIN 62
#define LOAD_METHOD_ADAPTIVE 63
#define LOAD_METHOD_CACHED 64
#define LOAD_METHOD_CLASS 65
#define LOAD_METHOD_MODULE 66
#define LOAD_METHOD_NO_DICT 67
#define STORE_ATTR_ADAPTIVE 75
#define STORE_ATTR_INSTANCE_VALUE 76
#define STORE_ATTR_SLOT 77
#define STORE_ATTR_WITH_HINT 78
#define LOAD_FAST__LOAD_FAST 79
#define STORE_FAST__LOAD_FAST 80
#define LOAD_FAST__LOAD_CONST 81
#define LOAD_CONST__LOAD_FAST 87
#define STORE_FAST__STORE_FAST 88
#define DO_TRACING 255
#ifdef NEED_OPCODE_JUMP_TABLES
static uint32_t _PyOpcode_RelativeJump[8] = {