Skip to content

gh-106603: Make uop struct a triple (opcode, oparg, operand) #106794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 17, 2023

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jul 15, 2023

Almost everything that used to go in operand now goes in oparg, except cache entries, which go into operand. This way a uop can have an oparg and a cache entry, which is much more convenient for splitting the more complex CALL specializations into uops. Most of the complexity (and debugging :-( ) went into optimizer.c.

As a side effect, without any extra work, we have four new viable uops:

  • STORE_ATTR (unspecialized, but still)
  • _LOAD_GLOBAL_MODULE
  • _LOAD_GLOBAL_BUILTINS
  • _LOAD_ATTR_INSTANCE_VALUE

The Python API (iterating over a uop executor) now returns triples (opname, oparg, operand).

Comment on lines -652 to +655
inst(STORE_SUBSCR, (counter/1, v, container, sub -- )) {
inst(STORE_SUBSCR, (unused/1, v, container, sub -- )) {
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
_PyStoreSubscrCache *cache = (_PyStoreSubscrCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change simply follows the vast majority of other unspecialized opcodes.

@gvanrossum
Copy link
Member Author

@markshannon Can you review this?

@gvanrossum gvanrossum merged commit 8e9a1a0 into python:main Jul 17, 2023
@gvanrossum gvanrossum deleted the add-oparg branch July 17, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants