-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
[draft] Register machine - Add tmps in frame and compiler. Add RETURN_VALUE_R. #101208
Conversation
iritkatriel
commented
Jan 21, 2023
•
edited
Loading
edited
- add tmps to the frame, between the fast locals and the stack.
- add plumbing in the compiler for a 1-arg reg machine, with RETURN_VALUE_R that uses a tmp register.
#define SAME_REGISTER(R1, R2) (((R1).type == (R2).type) && ((R1).value == (R2).value)) | ||
|
||
typedef struct instr_opargs_ { | ||
oparg_t arg1; |
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 variable-length instructions, arg2, arg3 should be added here. Then search this file for arg1 and update all those places to work with the other args as well.
…ace function (in case the latter raises)
@@ -144,7 +144,8 @@ GETITEM(PyObject *v, Py_ssize_t i) { | |||
#define NEXTOPARG() do { \ | |||
_Py_CODEUNIT word = *next_instr; \ | |||
opcode = _Py_OPCODE(word); \ | |||
oparg1 = oparg = _Py_OPARG(word); \ | |||
oparg = _Py_OPARG(word); \ | |||
oparg1 = oparg; \ |
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'm not excited about having two variables. In my own 'long-insts' branch I just count oparg
, oparg2
, oparg3
, ...
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 think the generator currently emits REG(oparg1). We could change that.
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.
Or we could "#define oparg1 oparg".
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 prefer modifying the generator over the macro. REG(oparg1) only occurs once in the generator, explicitly, so it's very easy to change (in fact in ly 'long-instrs' I already changed it.)
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.
You can even cherry-pick 8d06d1b from that branch.