-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
GH-98831: Remove all remaining DISPATCH() calls from bytecodes.c #99271
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
Conversation
Also mark those opcodes that have no stack effect as such.
@brandtbucher When you have the benchmark results can you just post them here? So Mark won't have to ask for them. |
Here you go:
|
/* Use BASIC_PUSH as NULL is not a valid object pointer */ | ||
BASIC_PUSH(NULL); | ||
inst(PUSH_NULL, (-- res)) { | ||
res = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that this ought to fail, as we should have NULL
checks in debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but we never had those. In debug mode we check for stack overflow/underflow but not for NULL-ness. (Of course the NULL will wreak havoc if it gets popped by the wrong opcode, bu that's also nothing new.) The code generator still checks for stack over/underflow by calling STACK_SHRINK()/GROW(), so nothing is really changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have typed stack effects, we can auto-generate those sorts of assertions. That would be really nice.
@@ -2642,14 +2631,15 @@ dummy_func( | |||
PyObject *next = PyList_GET_ITEM(seq, it->it_index++); | |||
PUSH(Py_NewRef(next)); | |||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); | |||
DISPATCH(); | |||
goto end_for_iter_list; // End of this instruction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm really counting on the compiler to optimize this for us.
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
python#99271) Also mark those opcodes that have no stack effect as such. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
python#99271) Also mark those opcodes that have no stack effect as such. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Also mark those opcodes that have no stack effect as such (
inst(FOO)
->inst(FOO, (--))
).