Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Clean up theCALL sequence #105848

Closed
Closed
Assignees
brandtbucher
Labels
3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetriagedThe issue has been accepted as valid by a triager.
@brandtbucher

Description

@brandtbucher

The bytecode sequence for calls has gotten better in 3.12, but I think it can still be improved in a couple of ways:

  • First, we can start either pushingNULL or a tuple ofkwnames onto the stack immediately before calls, rather than sometimes stashingkwnames away in a local eval loop variable via theKW_NAMES opcode. Thisshould free up a register around calls, and it's nice to do anyways since it makes the bytecode more regular (and the stack is really where this sort of stuff belongs).
  • Once that is done, we can use the low bit of theCALL oparg to indicate whether or not to expectkwnames on the stack. This should get rid of lots of newPUSH_NULL/CALL pairs.
  • Separate from the above, but still sort of related: it's a bit awkward that our method call optimization either leaves[callable, self, args...] or[NULL, callable, args...] on the stack, since it means thatCALL (and most of its specializations) have to do an awkward swap in order to load the "correct" callable. This can be simplified by always entering calls with[callable, self_or_null, args...] on the stack, so that the callable is always in the same position.

After this is all said and done, theCALL stack effect will look something like:

inst(CALL, (counter/1,cache/2,callable,self_or_null,args[oparg >>1],kwnamesif (oparg&1)--res)) {// ...}

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetriagedThe issue has been accepted as valid by a triager.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp