Skip to content

Commit 2bbd47a

Browse files
call the functions sym instead of ref
1 parent 4d9a68e commit 2bbd47a

File tree

8 files changed

+787
-787
lines changed

8 files changed

+787
-787
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ PyJitRef_AsSymbolBorrow(JitOptRef ref)
235235
return JIT_BITS_TO_PTR_MASKED(ref);
236236
}
237237

238-
bool _Py_uop_sym_is_immortal(JitOptSymbol *sym);
238+
bool _Py_uop_symbol_is_immortal(JitOptSymbol *sym);
239239

240240
static inline JitOptRef
241241
PyJitRef_FromSymbolBorrow(JitOptSymbol *sym)
@@ -246,7 +246,7 @@ PyJitRef_FromSymbolBorrow(JitOptSymbol *sym)
246246
static inline JitOptRef
247247
PyJitRef_FromSymbolSteal(JitOptSymbol *sym)
248248
{
249-
if (sym == NULL || _Py_uop_sym_is_immortal(sym)) {
249+
if (sym == NULL || _Py_uop_symbol_is_immortal(sym)) {
250250
return PyJitRef_FromSymbolBorrow(sym);
251251
}
252252
return (JitOptRef){.bits=(uintptr_t)sym};
@@ -311,31 +311,31 @@ typedef struct _JitOptContext {
311311
JitOptRef locals_and_stack[MAX_ABSTRACT_INTERP_SIZE];
312312
} JitOptContext;
313313

314-
extern bool _Py_uop_ref_is_null(JitOptRef sym);
315-
extern bool _Py_uop_ref_is_not_null(JitOptRef sym);
316-
extern bool _Py_uop_ref_is_const(JitOptContext *ctx, JitOptRef sym);
317-
extern PyObject *_Py_uop_ref_get_const(JitOptContext *ctx, JitOptRef sym);
318-
extern JitOptRef _Py_uop_ref_new_unknown(JitOptContext *ctx);
319-
extern JitOptRef _Py_uop_ref_new_not_null(JitOptContext *ctx);
320-
extern JitOptRef _Py_uop_ref_new_type(
314+
extern bool _Py_uop_sym_is_null(JitOptRef sym);
315+
extern bool _Py_uop_sym_is_not_null(JitOptRef sym);
316+
extern bool _Py_uop_sym_is_const(JitOptContext *ctx, JitOptRef sym);
317+
extern PyObject *_Py_uop_sym_get_const(JitOptContext *ctx, JitOptRef sym);
318+
extern JitOptRef _Py_uop_sym_new_unknown(JitOptContext *ctx);
319+
extern JitOptRef _Py_uop_sym_new_not_null(JitOptContext *ctx);
320+
extern JitOptRef _Py_uop_sym_new_type(
321321
JitOptContext *ctx, PyTypeObject *typ);
322-
extern JitOptRef _Py_uop_ref_new_const(JitOptContext *ctx, PyObject *const_val);
323-
extern JitOptRef _Py_uop_ref_new_null(JitOptContext *ctx);
324-
extern bool _Py_uop_ref_has_type(JitOptRef sym);
325-
extern bool _Py_uop_ref_matches_type(JitOptRef sym, PyTypeObject *typ);
326-
extern bool _Py_uop_ref_matches_type_version(JitOptRef sym, unsigned int version);
327-
extern void _Py_uop_ref_set_null(JitOptContext *ctx, JitOptRef sym);
328-
extern void _Py_uop_ref_set_non_null(JitOptContext *ctx, JitOptRef sym);
329-
extern void _Py_uop_ref_set_type(JitOptContext *ctx, JitOptRef sym, PyTypeObject *typ);
330-
extern bool _Py_uop_ref_set_type_version(JitOptContext *ctx, JitOptRef sym, unsigned int version);
331-
extern void _Py_uop_ref_set_const(JitOptContext *ctx, JitOptRef sym, PyObject *const_val);
332-
extern bool _Py_uop_ref_is_bottom(JitOptRef sym);
333-
extern int _Py_uop_ref_truthiness(JitOptContext *ctx, JitOptRef sym);
334-
extern PyTypeObject *_Py_uop_ref_get_type(JitOptRef sym);
335-
extern JitOptRef _Py_uop_ref_new_tuple(JitOptContext *ctx, int size, JitOptRef *args);
336-
extern JitOptRef _Py_uop_ref_tuple_getitem(JitOptContext *ctx, JitOptRef sym, int item);
337-
extern int _Py_uop_ref_tuple_length(JitOptRef sym);
338-
extern JitOptRef _Py_uop_ref_new_truthiness(JitOptContext *ctx, JitOptRef value, bool truthy);
322+
extern JitOptRef _Py_uop_sym_new_const(JitOptContext *ctx, PyObject *const_val);
323+
extern JitOptRef _Py_uop_sym_new_null(JitOptContext *ctx);
324+
extern bool _Py_uop_sym_has_type(JitOptRef sym);
325+
extern bool _Py_uop_sym_matches_type(JitOptRef sym, PyTypeObject *typ);
326+
extern bool _Py_uop_sym_matches_type_version(JitOptRef sym, unsigned int version);
327+
extern void _Py_uop_sym_set_null(JitOptContext *ctx, JitOptRef sym);
328+
extern void _Py_uop_sym_set_non_null(JitOptContext *ctx, JitOptRef sym);
329+
extern void _Py_uop_sym_set_type(JitOptContext *ctx, JitOptRef sym, PyTypeObject *typ);
330+
extern bool _Py_uop_sym_set_type_version(JitOptContext *ctx, JitOptRef sym, unsigned int version);
331+
extern void _Py_uop_sym_set_const(JitOptContext *ctx, JitOptRef sym, PyObject *const_val);
332+
extern bool _Py_uop_sym_is_bottom(JitOptRef sym);
333+
extern int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef sym);
334+
extern PyTypeObject *_Py_uop_sym_get_type(JitOptRef sym);
335+
extern JitOptRef _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args);
336+
extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, int item);
337+
extern int _Py_uop_sym_tuple_length(JitOptRef sym);
338+
extern JitOptRef _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptRef value, bool truthy);
339339

340340
extern void _Py_uop_abstractcontext_init(JitOptContext *ctx);
341341
extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx);

Lib/test/test_generated_cases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ def test_overridden_abstract_args(self):
20122012
20132013
case OP2: {
20142014
JitOptRef out;
2015-
out = ref_new_not_null(ctx);
2015+
out = sym_new_not_null(ctx);
20162016
stack_pointer[-1] = out;
20172017
break;
20182018
}
@@ -2037,7 +2037,7 @@ def test_no_overridden_case(self):
20372037
output = """
20382038
case OP: {
20392039
JitOptRef out;
2040-
out = ref_new_not_null(ctx);
2040+
out = sym_new_not_null(ctx);
20412041
stack_pointer[-1] = out;
20422042
break;
20432043
}

Python/optimizer_analysis.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -315,33 +315,33 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
315315
INST->operand0 = OPERAND;
316316

317317
/* Shortened forms for convenience, used in optimizer_bytecodes.c */
318-
#define ref_is_not_null _Py_uop_ref_is_not_null
319-
#define ref_is_const _Py_uop_ref_is_const
320-
#define ref_get_const _Py_uop_ref_get_const
321-
#define ref_new_unknown _Py_uop_ref_new_unknown
322-
#define ref_new_not_null _Py_uop_ref_new_not_null
323-
#define ref_new_type _Py_uop_ref_new_type
324-
#define ref_is_null _Py_uop_ref_is_null
325-
#define ref_new_const _Py_uop_ref_new_const
326-
#define ref_new_null _Py_uop_ref_new_null
327-
#define ref_has_type _Py_uop_ref_has_type
328-
#define ref_get_type _Py_uop_ref_get_type
329-
#define ref_matches_type _Py_uop_ref_matches_type
330-
#define ref_matches_type_version _Py_uop_ref_matches_type_version
331-
#define ref_set_null(SYM) _Py_uop_ref_set_null(ctx, SYM)
332-
#define ref_set_non_null(SYM) _Py_uop_ref_set_non_null(ctx, SYM)
333-
#define ref_set_type(SYM, TYPE) _Py_uop_ref_set_type(ctx, SYM, TYPE)
334-
#define ref_set_type_version(SYM, VERSION) _Py_uop_ref_set_type_version(ctx, SYM, VERSION)
335-
#define ref_set_const(SYM, CNST) _Py_uop_ref_set_const(ctx, SYM, CNST)
336-
#define ref_is_bottom _Py_uop_ref_is_bottom
337-
#define ref_truthiness _Py_uop_ref_truthiness
318+
#define sym_is_not_null _Py_uop_sym_is_not_null
319+
#define sym_is_const _Py_uop_sym_is_const
320+
#define sym_get_const _Py_uop_sym_get_const
321+
#define sym_new_unknown _Py_uop_sym_new_unknown
322+
#define sym_new_not_null _Py_uop_sym_new_not_null
323+
#define sym_new_type _Py_uop_sym_new_type
324+
#define sym_is_null _Py_uop_sym_is_null
325+
#define sym_new_const _Py_uop_sym_new_const
326+
#define sym_new_null _Py_uop_sym_new_null
327+
#define sym_has_type _Py_uop_sym_has_type
328+
#define sym_get_type _Py_uop_sym_get_type
329+
#define sym_matches_type _Py_uop_sym_matches_type
330+
#define sym_matches_type_version _Py_uop_sym_matches_type_version
331+
#define sym_set_null(SYM) _Py_uop_sym_set_null(ctx, SYM)
332+
#define sym_set_non_null(SYM) _Py_uop_sym_set_non_null(ctx, SYM)
333+
#define sym_set_type(SYM, TYPE) _Py_uop_sym_set_type(ctx, SYM, TYPE)
334+
#define sym_set_type_version(SYM, VERSION) _Py_uop_sym_set_type_version(ctx, SYM, VERSION)
335+
#define sym_set_const(SYM, CNST) _Py_uop_sym_set_const(ctx, SYM, CNST)
336+
#define sym_is_bottom _Py_uop_sym_is_bottom
337+
#define sym_truthiness _Py_uop_sym_truthiness
338338
#define frame_new _Py_uop_frame_new
339339
#define frame_pop _Py_uop_frame_pop
340-
#define ref_new_tuple _Py_uop_ref_new_tuple
341-
#define ref_tuple_getitem _Py_uop_ref_tuple_getitem
342-
#define ref_tuple_length _Py_uop_ref_tuple_length
343-
#define ref_is_immortal _Py_uop_ref_is_immortal
344-
#define ref_new_truthiness _Py_uop_ref_new_truthiness
340+
#define sym_new_tuple _Py_uop_sym_new_tuple
341+
#define sym_tuple_getitem _Py_uop_sym_tuple_getitem
342+
#define sym_tuple_length _Py_uop_sym_tuple_length
343+
#define sym_is_immortal _Py_uop_sym_is_immortal
344+
#define sym_new_truthiness _Py_uop_sym_new_truthiness
345345

346346
static int
347347
optimize_to_bool(
@@ -350,16 +350,16 @@ optimize_to_bool(
350350
JitOptRef value,
351351
JitOptRef *result_ptr)
352352
{
353-
if (ref_matches_type(value, &PyBool_Type)) {
353+
if (sym_matches_type(value, &PyBool_Type)) {
354354
REPLACE_OP(this_instr, _NOP, 0, 0);
355355
*result_ptr = value;
356356
return 1;
357357
}
358-
int truthiness = ref_truthiness(ctx, value);
358+
int truthiness = sym_truthiness(ctx, value);
359359
if (truthiness >= 0) {
360360
PyObject *load = truthiness ? Py_True : Py_False;
361361
REPLACE_OP(this_instr, _POP_TOP_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)load);
362-
*result_ptr = ref_new_const(ctx, load);
362+
*result_ptr = sym_new_const(ctx, load);
363363
return 1;
364364
}
365365
return 0;
@@ -386,10 +386,10 @@ lookup_attr(JitOptContext *ctx, _PyUOpInstruction *this_instr,
386386
if (lookup) {
387387
int opcode = _Py_IsImmortal(lookup) ? immortal : mortal;
388388
REPLACE_OP(this_instr, opcode, 0, (uintptr_t)lookup);
389-
return ref_new_const(ctx, lookup);
389+
return sym_new_const(ctx, lookup);
390390
}
391391
}
392-
return ref_new_not_null(ctx);
392+
return sym_new_not_null(ctx);
393393
}
394394

395395
/* _PUSH_FRAME/_RETURN_VALUE's operand can be 0, a PyFunctionObject *, or a

0 commit comments

Comments
 (0)