GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-146381: Constant-fold frozendict subscript lookups via REPLACE_OPCODE_IF_EVALUATES_PURE by corona10 · Pull Request #146490 · python/cpython Conversation
|
|
@Fidget-Spinner |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
main['_START_EXECUTOR', '_MAKE_WARM', '_SET_IP', '_CHECK_PERIODIC', '_CHECK_VALIDITY', '_ITER_CHECK_RANGE', '_GUARD_NOT_EXHAUSTED_RANGE', '_ITER_NEXT_RANGE', '_SET_IP', '_SWAP_FAST_2', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_GUARD_GLOBALS_VERSION', '_LOAD_CONST_INLINE', '_LOAD_CONST_INLINE_BORROW', '_SET_IP', '_BINARY_OP_SUBSCR_DICT', '_POP_TOP_NOP', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_COMPARE_OP_INT', '_POP_TOP_NOP', '_POP_TOP_INT', '_GUARD_BIT_IS_SET_POP_5', '_LOAD_FAST_BORROW_1', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_BINARY_OP_ADD_INT', '_POP_TOP_NOP', '_POP_TOP_NOP', '_SWAP_FAST_1', '_POP_TOP_INT', '_JUMP_TO_TOP', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_ERROR_POP_N', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_EXIT_TRACE'] PR['_START_EXECUTOR', '_MAKE_WARM', '_SET_IP', '_CHECK_PERIODIC', '_CHECK_VALIDITY', '_ITER_CHECK_RANGE', '_GUARD_NOT_EXHAUSTED_RANGE', '_ITER_NEXT_RANGE', '_SET_IP', '_SWAP_FAST_2', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_GUARD_GLOBALS_VERSION', '_LOAD_CONST_INLINE', '_LOAD_CONST_INLINE_BORROW', '_SET_IP', '_BINARY_OP_SUBSCR_FROZEN_DICT', '_POP_TOP_NOP', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_CONST_INLINE_BORROW', '_INSERT_2_LOAD_CONST_INLINE_BORROW', '_POP_TOP_NOP', '_POP_TOP_INT', '_SET_IP', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_FAST_BORROW_1', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_BINARY_OP_ADD_INT', '_POP_TOP_NOP', '_POP_TOP_NOP', '_SWAP_FAST_1', '_POP_TOP_INT', '_JUMP_TO_TOP', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_ERROR_POP_N', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_DEOPT', '_EXIT_TRACE'] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| extern PyTypeObject *_Py_uop_sym_get_type(JitOptRef sym); | ||
| extern JitOptRef _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args); | ||
| extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, Py_ssize_t item); | ||
| extern JitOptRef _Py_uop_sym_frozendict_getitem(JitOptContext *ctx, JitOptRef sym, JitOptRef key); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this function.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return _Py_uop_sym_new_not_null(ctx); | ||
| } | ||
|
|
||
| JitOptRef |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same here, we don't need this function.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| REPLACE_OP(this_instr, _BINARY_OP_SUBSCR_FROZEN_DICT, oparg, 0); | ||
| res = sym_frozendict_getitem(ctx, dict_st, sub_st); |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| REPLACE_OP(this_instr, _BINARY_OP_SUBSCR_FROZEN_DICT, oparg, 0); | |
| res = sym_frozendict_getitem(ctx, dict_st, sub_st); | |
| REPLACE_OPCODE_IF_EVALUATES_PURE(dict_st, sub_st, res); |
Check out what is the generated code in executor_cases.c.h after this :).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| op(_BINARY_OP_SUBSCR_FROZEN_DICT, (dict_st, sub_st -- res, ds, ss)) { | ||
| res = sym_new_not_null(ctx); | ||
| ds = dict_st; | ||
| ss = sub_st; | ||
| REPLACE_OPCODE_IF_EVALUATES_PURE(dict_st, sub_st, res); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertEqual(res, TIER2_THRESHOLD) | ||
| self.assertIsNotNone(ex) | ||
| uops = get_opnames(ex) | ||
| self.assertIn("_BINARY_OP_SUBSCR_FROZEN_DICT", uops) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
After the correct replacement, this should just become POP_TOP_LOAD_CONST...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@Fidget-Spinner ['_START_EXECUTOR', '_MAKE_WARM', '_SET_IP', '_CHECK_PERIODIC', '_CHECK_VALIDITY', '_ITER_CHECK_RANGE', '_GUARD_NOT_EXHAUSTED_RANGE', '_ITER_NEXT_RANGE', '_SET_IP', '_SWAP_FAST_2', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_GUARD_GLOBALS_VERSION', '_LOAD_CONST_INLINE', '_LOAD_CONST_INLINE_BORROW', '_SET_IP', '_INSERT_2_LOAD_CONST_INLINE_BORROW', '_POP_TOP_NOP', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_CONST_INLINE_BORROW', '_INSERT_2_LOAD_CONST_INLINE_BORROW', '_POP_TOP_NOP', '_POP_TOP_INT', '_SET_IP', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_FAST_BORROW_1', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_BINARY_OP_ADD_INT', '_POP_TOP_NOP', '_POP_TOP_NOP', '_SWAP_FAST_1', '_POP_TOP_INT', '_JUMP_TO_TOP', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_ERROR_POP_N', '_DEOPT', '_DEOPT', '_DEOPT', '_EXIT_TRACE'] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The power of the JIT optimizer :).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…CE_OPCODE_IF_EVALUATES_PURE (pythongh-146490)
…CE_OPCODE_IF_EVALUATES_PURE (pythongh-146490)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.