bpo-44525: Split calls into PRECALL and CALL (GH-30011)

* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW.

* Update specialization to handle new CALL opcodes.

* Specialize call to method descriptors.

* Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
This commit is contained in:
Mark Shannon 2021-12-14 18:22:44 +00:00 committed by GitHub
parent d60457a667
commit 9f8f45144b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 395 additions and 236 deletions

View file

@ -839,7 +839,7 @@ if 1:
self.assertNotIn('LOAD_METHOD', instructions)
self.assertNotIn('CALL_METHOD', instructions)
self.assertIn('LOAD_ATTR', instructions)
self.assertIn('CALL_FUNCTION', instructions)
self.assertIn('CALL_NO_KW', instructions)
def test_lineno_procedure_call(self):
def call():
@ -1095,7 +1095,7 @@ f(
)
"""
compiled_code, _ = self.check_positions_against_ast(snippet)
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_FUNCTION',
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_NO_KW',
line=1, end_line=3, column=0, end_column=1)
def test_very_long_line_end_offset(self):
@ -1105,7 +1105,7 @@ f(
snippet = f"g('{long_string}')"
compiled_code, _ = self.check_positions_against_ast(snippet)
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_FUNCTION',
self.assertOpcodeSourcePositionIs(compiled_code, 'CALL_NO_KW',
line=1, end_line=1, column=None, end_column=None)
def test_complex_single_line_expression(self):