KEMBAR78
bpo-47120: make POP_JUMP_IF_NONE/NOT_NONE relative by iritkatriel · Pull Request #32359 · python/cpython · GitHub
Skip to content

Conversation

@iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Apr 6, 2022

@iritkatriel
Copy link
Member Author

The case of POP_JUMP_IF_TRUE/IF_FALSE is more complicated because of the COMPARE_OP specialisations. I suggest we do it separately (my current patch doesn't work unless I turn off specialization, debugging).

@markshannon
Copy link
Member

The FORWARD jumps don't need to include CHECK_EVAL_BREAKER(), so I think you'll need to implement each instruction independently and not use JUMP_TO_INSTRUCTION.

@markshannon
Copy link
Member

Which means the forwards jumps can be made simpler

TARGET(POP_JUMP_FORWARD_IF_NOT_NONE) {
    PyObject *value = POP();
    if (value != Py_None) {
        JUMPBY(oparg);
    }
    Py_DECREF(value);
    DISPATCH();
}

@iritkatriel
Copy link
Member Author

The case of POP_JUMP_IF_TRUE/IF_FALSE is more complicated because of the COMPARE_OP specialisations. I suggest we do it separately (my current patch doesn't work unless I turn off specialization, debugging).

I fixed it now, it was the usual +-1 business. I'll make a separate PR for that, it will be easier to review that way. We can merge magic number later.

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

👍

@iritkatriel
Copy link
Member Author

This will be merged as part of #32400

@iritkatriel iritkatriel closed this Apr 8, 2022
@iritkatriel iritkatriel deleted the jump_if branch May 20, 2022 11:18
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.

4 participants