Skip to content

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jan 21, 2023

  • 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;
Copy link
Member Author

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.

opcode = _Py_OPCODE(word); \
oparg1 = oparg = _Py_OPARG(word); \
oparg = _Py_OPARG(word); \
oparg1 = oparg; \
Copy link
Member

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, ...

Copy link
Member Author

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.

Copy link
Member Author

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".

Copy link
Member

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.)

Copy link
Member

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.

@iritkatriel iritkatriel deleted the add_tmps branch April 3, 2023 17:47
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.

3 participants