bpo-43693: Compute deref offsets in compiler (gh-25152)

Merges locals and cells into a single array.
Saves a pointer in the interpreter and means that we don't need the LOAD_CLOSURE opcode any more

https://bugs.python.org/issue43693
This commit is contained in:
Mark Shannon 2021-06-04 01:03:54 +01:00 committed by GitHub
parent 35002aa8f6
commit b2bf2bc1ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 222 additions and 209 deletions

View file

@ -378,14 +378,11 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
elif op in hasjrel:
argval = offset + 2 + arg*2
argrepr = "to " + repr(argval)
elif op in haslocal:
elif op in haslocal or op in hasfree:
argval, argrepr = _get_name_info(arg, varname_from_oparg)
elif op in hascompare:
argval = cmp_op[arg]
argrepr = argval
elif op in hasfree:
argval, argrepr = _get_name_info(arg, varname_from_oparg,
cell=True)
elif op == FORMAT_VALUE:
argval, argrepr = FORMAT_VALUE_CONVERTERS[arg & 0x3]
argval = (argval, bool(arg & 0x4))