Currently our DSL has two separate but similar bits of syntax for super- and macro instructions:
super(X) = A + B;
macro(X) = A + B;
These differ in that super() inserts some code between components:
<prologue>
{
<code for A>
}
NEXTOPARG();
next_instr++;
{
<code for B>
}
<epilogue>
whereas macro() doesn't (omitting NEXTOPARG(); next_instr++;).
(There are some other differences, in particular macros allow interspersing cache effects between the components.)
It turns out it is possible to rewrite any super-instruction of this form as a macro:
where JOIN is a micro-op defined roughly like this:
op(JOIN, (word/1 --)) {
oparg = _Py_OPARG(word);
}
Given the limited use we have for super-instructions and the code duplication in the code generator to handle both, this seems a nice win.
Note: Eventually we may need to bring super() back into the DSL, but for a different use case.
Currently our DSL has two separate but similar bits of syntax for super- and macro instructions:
These differ in that
super()inserts some code between components:whereas
macro()doesn't (omittingNEXTOPARG(); next_instr++;).(There are some other differences, in particular macros allow interspersing cache effects between the components.)
It turns out it is possible to rewrite any super-instruction of this form as a macro:
where
JOINis a micro-op defined roughly like this:Given the limited use we have for super-instructions and the code duplication in the code generator to handle both, this seems a nice win.
Note: Eventually we may need to bring
super()back into the DSL, but for a different use case.