Skip to content

Commit ff97d94

Browse files
committed
Remove sym_has_type
1 parent c492ac7 commit ff97d94

File tree

5 files changed

+12
-33
lines changed

5 files changed

+12
-33
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ extern JitOptSymbol *_Py_uop_sym_new_type(
266266
JitOptContext *ctx, PyTypeObject *typ);
267267
extern JitOptSymbol *_Py_uop_sym_new_const(JitOptContext *ctx, PyObject *const_val);
268268
extern JitOptSymbol *_Py_uop_sym_new_null(JitOptContext *ctx);
269-
extern bool _Py_uop_sym_has_type(JitOptSymbol *sym);
270269
extern bool _Py_uop_sym_matches_type(JitOptSymbol *sym, PyTypeObject *typ);
271270
extern bool _Py_uop_sym_matches_type_version(JitOptSymbol *sym, unsigned int version);
272271
extern void _Py_uop_sym_set_null(JitOptContext *ctx, JitOptSymbol *sym);

Python/optimizer_analysis.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
324324
#define sym_is_null _Py_uop_sym_is_null
325325
#define sym_new_const _Py_uop_sym_new_const
326326
#define sym_new_null _Py_uop_sym_new_null
327-
#define sym_has_type _Py_uop_sym_has_type
328327
#define sym_get_type _Py_uop_sym_get_type
329328
#define sym_matches_type _Py_uop_sym_matches_type
330329
#define sym_matches_type_version _Py_uop_sym_matches_type_version

Python/optimizer_bytecodes.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame;
2121
#define sym_matches_type _Py_uop_sym_matches_type
2222
#define sym_matches_type_version _Py_uop_sym_matches_type_version
2323
#define sym_get_type _Py_uop_sym_get_type
24-
#define sym_has_type _Py_uop_sym_has_type
2524
#define sym_set_null(SYM) _Py_uop_sym_set_null(ctx, SYM)
2625
#define sym_set_non_null(SYM) _Py_uop_sym_set_non_null(ctx, SYM)
2726
#define sym_set_type(SYM, TYPE) _Py_uop_sym_set_type(ctx, SYM, TYPE)
@@ -872,8 +871,9 @@ dummy_func(void) {
872871
}
873872

874873
op(_CALL_TYPE_1, (unused, unused, arg -- res)) {
875-
if (sym_has_type(arg)) {
876-
res = sym_new_const(ctx, (PyObject *)sym_get_type(arg));
874+
PyObject *type = (PyObject *)sym_get_type(arg);
875+
if (type) {
876+
res = sym_new_const(ctx, type);
877877
}
878878
else {
879879
res = sym_new_not_null(ctx);
@@ -914,7 +914,7 @@ dummy_func(void) {
914914
assert(value != NULL);
915915
eliminate_pop_guard(this_instr, !Py_IsNone(value));
916916
}
917-
else if (sym_has_type(val)) {
917+
else if (sym_get_type(val)) {
918918
assert(!sym_matches_type(val, &_PyNone_Type));
919919
eliminate_pop_guard(this_instr, true);
920920
}
@@ -927,7 +927,7 @@ dummy_func(void) {
927927
assert(value != NULL);
928928
eliminate_pop_guard(this_instr, Py_IsNone(value));
929929
}
930-
else if (sym_has_type(val)) {
930+
else if (sym_get_type(val)) {
931931
assert(!sym_matches_type(val, &_PyNone_Type));
932932
eliminate_pop_guard(this_instr, false);
933933
}

Python/optimizer_cases.c.h

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_symbols.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -439,26 +439,6 @@ _Py_uop_sym_get_type_version(JitOptSymbol *sym)
439439
Py_UNREACHABLE();
440440
}
441441

442-
bool
443-
_Py_uop_sym_has_type(JitOptSymbol *sym)
444-
{
445-
JitSymType tag = sym->tag;
446-
switch(tag) {
447-
case JIT_SYM_NULL_TAG:
448-
case JIT_SYM_TYPE_VERSION_TAG:
449-
case JIT_SYM_BOTTOM_TAG:
450-
case JIT_SYM_NON_NULL_TAG:
451-
case JIT_SYM_UNKNOWN_TAG:
452-
return false;
453-
case JIT_SYM_KNOWN_CLASS_TAG:
454-
case JIT_SYM_KNOWN_VALUE_TAG:
455-
case JIT_SYM_TUPLE_TAG:
456-
case JIT_SYM_TRUTHINESS_TAG:
457-
return true;
458-
}
459-
Py_UNREACHABLE();
460-
}
461-
462442
bool
463443
_Py_uop_sym_matches_type(JitOptSymbol *sym, PyTypeObject *typ)
464444
{

0 commit comments

Comments
 (0)