paul99/v8m-rb — comment on commit 5e6309a9a108e8751692e6bced5cdc95cdee11fa
File: src/mips/deoptimizer-mips.cc line 862
By paul99:

I really think there needs to be comment here, as this is tricky code. You are using the code in the delay slot, and then jumping to the next instruction, so it is executing linear code. And then to make it more confusing, for larger values of 'i' the below 'Addu()' macro-instr expands to 3 instructions, one of which is in the delay slot. Be nice to explain this a bit more.

Here is a weird trivia, I just learned, the bal() instruction expands to a more generic "bgezal zero, offset", which is conditional, and always true, and the branch is taken. But you can code this as bltzal, zero, offset, which is conditional, and always false, and the branch will never be taken, but the RA register will still be updated. A very weak argument could be made that that is better self-docuementing, as code just continues execution after the branch delay slot.

OK, never mind, I am just insane, none of these weird edge-cases are self-documenting, and however this is done, it should be spelled out in comments.