diff options
author | Mark Shannon <mark@hotpy.org> | 2023-11-07 09:42:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-07 09:42:39 (GMT) |
commit | 931f4438c92ec0eb2aa894092a91749f1d5bd216 (patch) | |
tree | 4cf62037b26667fa59ddf85da24641319fe2353a /Python | |
parent | 13405ecffda6c66d6a5cf2a22dff892c108c69db (diff) | |
download | cpython-931f4438c92ec0eb2aa894092a91749f1d5bd216.zip cpython-931f4438c92ec0eb2aa894092a91749f1d5bd216.tar.gz cpython-931f4438c92ec0eb2aa894092a91749f1d5bd216.tar.bz2 |
GH-111485: Allow arbitrary annotations on instructions and micro-ops. (GH-111697)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/abstract_interp_cases.c.h | 4 | ||||
-rw-r--r-- | Python/bytecodes.c | 31 | ||||
-rw-r--r-- | Python/executor_cases.c.h | 18 |
3 files changed, 18 insertions, 35 deletions
diff --git a/Python/abstract_interp_cases.c.h b/Python/abstract_interp_cases.c.h index c80b5ec..c6ebea0 100644 --- a/Python/abstract_interp_cases.c.h +++ b/Python/abstract_interp_cases.c.h @@ -242,10 +242,6 @@ break; } - case _SPECIALIZE_UNPACK_SEQUENCE: { - break; - } - case _UNPACK_SEQUENCE: { STACK_SHRINK(1); STACK_GROW(oparg); diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 7c8ee7b..8e1d318 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -50,6 +50,11 @@ #define family(name, ...) static int family_##name #define pseudo(name) static int pseudo_##name +/* Annotations */ +#define guard +#define override +#define specializing + // Dummy variables for stack effects. static PyObject *value, *value1, *value2, *left, *right, *res, *sum, *prod, *sub; static PyObject *container, *start, *stop, *v, *lhs, *rhs, *res2; @@ -312,7 +317,7 @@ dummy_func( TO_BOOL_STR, }; - op(_SPECIALIZE_TO_BOOL, (counter/1, value -- value)) { + specializing op(_SPECIALIZE_TO_BOOL, (counter/1, value -- value)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -537,7 +542,7 @@ dummy_func( BINARY_SUBSCR_TUPLE_INT, }; - op(_SPECIALIZE_BINARY_SUBSCR, (counter/1, container, sub -- container, sub)) { + specializing op(_SPECIALIZE_BINARY_SUBSCR, (counter/1, container, sub -- container, sub)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -689,7 +694,7 @@ dummy_func( STORE_SUBSCR_LIST_INT, }; - op(_SPECIALIZE_STORE_SUBSCR, (counter/1, container, sub -- container, sub)) { + specializing op(_SPECIALIZE_STORE_SUBSCR, (counter/1, container, sub -- container, sub)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -974,7 +979,7 @@ dummy_func( SEND_GEN, }; - op(_SPECIALIZE_SEND, (counter/1, receiver, unused -- receiver, unused)) { + specializing op(_SPECIALIZE_SEND, (counter/1, receiver, unused -- receiver, unused)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -1208,7 +1213,7 @@ dummy_func( UNPACK_SEQUENCE_LIST, }; - op(_SPECIALIZE_UNPACK_SEQUENCE, (counter/1, seq -- seq)) { + specializing op(_SPECIALIZE_UNPACK_SEQUENCE, (counter/1, seq -- seq)) { #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr = this_instr; @@ -1277,7 +1282,7 @@ dummy_func( STORE_ATTR_WITH_HINT, }; - op(_SPECIALIZE_STORE_ATTR, (counter/1, owner -- owner)) { + specializing op(_SPECIALIZE_STORE_ATTR, (counter/1, owner -- owner)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -1404,7 +1409,7 @@ dummy_func( LOAD_GLOBAL_BUILTIN, }; - op(_SPECIALIZE_LOAD_GLOBAL, (counter/1 -- )) { + specializing op(_SPECIALIZE_LOAD_GLOBAL, (counter/1 -- )) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -1744,7 +1749,7 @@ dummy_func( LOAD_SUPER_ATTR_METHOD, }; - op(_SPECIALIZE_LOAD_SUPER_ATTR, (counter/1, global_super, class, unused -- global_super, class, unused)) { + specializing op(_SPECIALIZE_LOAD_SUPER_ATTR, (counter/1, global_super, class, unused -- global_super, class, unused)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION int load_method = oparg & 1; @@ -1860,7 +1865,7 @@ dummy_func( LOAD_ATTR_NONDESCRIPTOR_NO_DICT, }; - op(_SPECIALIZE_LOAD_ATTR, (counter/1, owner -- owner)) { + specializing op(_SPECIALIZE_LOAD_ATTR, (counter/1, owner -- owner)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -2182,7 +2187,7 @@ dummy_func( COMPARE_OP_STR, }; - op(_SPECIALIZE_COMPARE_OP, (counter/1, left, right -- left, right)) { + specializing op(_SPECIALIZE_COMPARE_OP, (counter/1, left, right -- left, right)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -2506,7 +2511,7 @@ dummy_func( FOR_ITER_GEN, }; - op(_SPECIALIZE_FOR_ITER, (counter/1, iter -- iter)) { + specializing op(_SPECIALIZE_FOR_ITER, (counter/1, iter -- iter)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -3000,7 +3005,7 @@ dummy_func( CALL_ALLOC_AND_ENTER_INIT, }; - op(_SPECIALIZE_CALL, (counter/1, callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) { + specializing op(_SPECIALIZE_CALL, (counter/1, callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { @@ -3865,7 +3870,7 @@ dummy_func( top = Py_NewRef(bottom); } - op(_SPECIALIZE_BINARY_OP, (counter/1, lhs, rhs -- lhs, rhs)) { + specializing op(_SPECIALIZE_BINARY_OP, (counter/1, lhs, rhs -- lhs, rhs)) { TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index df7ddf2..d9e9ad1 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -871,24 +871,6 @@ break; } - case _SPECIALIZE_UNPACK_SEQUENCE: { - PyObject *seq; - seq = stack_pointer[-1]; - uint16_t counter = (uint16_t)next_uop[-1].operand; - #if ENABLE_SPECIALIZATION - if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - next_instr = this_instr; - _Py_Specialize_UnpackSequence(seq, next_instr, oparg); - DISPATCH_SAME_OPARG(); - } - STAT_INC(UNPACK_SEQUENCE, deferred); - DECREMENT_ADAPTIVE_COUNTER(this_instr[1].cache); - #endif /* ENABLE_SPECIALIZATION */ - (void)seq; - (void)counter; - break; - } - case _UNPACK_SEQUENCE: { PyObject *seq; seq = stack_pointer[-1]; |