
On 22/12/19 9:04 am, Soni L. wrote:
switch (op) { [...] case OP_TAILCALL: { adjust_regs(); some_other_stuff(); /* fallthrough */ } case OP_CALL: { make_the_call_happen(); break; } }
Relying on fall-through in a switch is a micro-optimisation that may help make things go faster in C, but not so much in Python, so trying to find a literal translation is probably wrongheaded. I would be inclined to separate it into two independent cases: if op == OP_TAILCALL: adjust_regs() some_other_stuff() elif op == OP_CALL: adjust_regs() some_other_stuff() make_the_call_happen() If the parts being duplicated are more than just one or two calls as above, I would factor them out into a separate function. Decoupling the different branches makes the code easier to read and maintain, and in Python probably doesn't cost anything significant in performance. -- Greg