Skip to content

Commit

Permalink
Merge branch 'main' into makefile
Browse files Browse the repository at this point in the history
* main:
  pythonGH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (pythonGH-100753)
  pythonGH-100766: Note that locale.LC_MESSAGES is not universal (pythonGH-100702)
  • Loading branch information
carljm committed Jan 5, 2023
2 parents 7abb0e4 + f20c553 commit 64553ee
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 95 deletions.
3 changes: 3 additions & 0 deletions Doc/library/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ The :mod:`locale` module defines the following exception and functions:
system, like those returned by :func:`os.strerror` might be affected by this
category.

This value may not be available on operating systems not conforming to the
POSIX standard, most notably Windows.


.. data:: LC_NUMERIC

Expand Down
20 changes: 10 additions & 10 deletions Include/internal/pycore_opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 16 additions & 17 deletions Include/opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Lib/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ def pseudo_op(name, op, real_ops):
# These will always push [unbound method, self] onto the stack.
"LOAD_ATTR_METHOD_LAZY_DICT",
"LOAD_ATTR_METHOD_NO_DICT",
"LOAD_ATTR_METHOD_WITH_DICT",
"LOAD_ATTR_METHOD_WITH_VALUES",
],
"LOAD_CONST": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove the LOAD_ATTR_METHOD_WITH_DICT specialized instruction. Stats show it
is not useful.
29 changes: 1 addition & 28 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2605,33 +2605,6 @@ dummy_func(
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
}

// error: LOAD_ATTR has irregular stack effect
inst(LOAD_ATTR_METHOD_WITH_DICT) {
/* Can be either a managed dict, or a tp_dictoffset offset.*/
assert(cframe.use_tracing == 0);
PyObject *self = TOP();
PyTypeObject *self_cls = Py_TYPE(self);
_PyLoadMethodCache *cache = (_PyLoadMethodCache *)next_instr;

DEOPT_IF(self_cls->tp_version_tag != read_u32(cache->type_version),
LOAD_ATTR);
/* Treat index as a signed 16 bit value */
Py_ssize_t dictoffset = self_cls->tp_dictoffset;
assert(dictoffset > 0);
PyDictObject **dictptr = (PyDictObject**)(((char *)self)+dictoffset);
PyDictObject *dict = *dictptr;
DEOPT_IF(dict == NULL, LOAD_ATTR);
DEOPT_IF(dict->ma_keys->dk_version != read_u32(cache->keys_version),
LOAD_ATTR);
STAT_INC(LOAD_ATTR, hit);
PyObject *res = read_obj(cache->descr);
assert(res != NULL);
assert(_PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR));
SET_TOP(Py_NewRef(res));
PUSH(self);
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
}

// error: LOAD_ATTR has irregular stack effect
inst(LOAD_ATTR_METHOD_NO_DICT) {
assert(cframe.use_tracing == 0);
Expand Down Expand Up @@ -3517,7 +3490,7 @@ family(load_attr) = {
LOAD_ATTR, LOAD_ATTR_CLASS,
LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, LOAD_ATTR_INSTANCE_VALUE, LOAD_ATTR_MODULE,
LOAD_ATTR_PROPERTY, LOAD_ATTR_SLOT, LOAD_ATTR_WITH_HINT,
LOAD_ATTR_METHOD_LAZY_DICT, LOAD_ATTR_METHOD_NO_DICT, LOAD_ATTR_METHOD_WITH_DICT,
LOAD_ATTR_METHOD_LAZY_DICT, LOAD_ATTR_METHOD_NO_DICT,
LOAD_ATTR_METHOD_WITH_VALUES };
family(load_global) = {
LOAD_GLOBAL, LOAD_GLOBAL_BUILTIN,
Expand Down
27 changes: 0 additions & 27 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Python/opcode_targets.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,8 @@ PyObject *descr, DescriptorClassification kind)
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_HAS_MANAGED_DICT);
goto fail;
case OFFSET_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
_py_set_opcode(instr, LOAD_ATTR_METHOD_WITH_DICT);
break;
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
goto fail;
case LAZY_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
_py_set_opcode(instr, LOAD_ATTR_METHOD_LAZY_DICT);
Expand Down

0 comments on commit 64553ee

Please sign in to comment.