Improve tracking GC info in call sites
In emitEncodeCallGCregs and emitDecodeCallGCregs, JIT uses instruction operands to encode/decode GC callee save registers for call/branch instructions. Since these operands normally represent the target registers associated with the instruction, it's a bit risky to repurpose them under the assumption they are not used. The aspiration is to make instruction data structure as compact as possible. But certainly we should improve this in the following way.
- Use union to access such information instead of the numeric operand name.
- Add constness and/or assertion so that the operand is initialized only once.
category:implementation theme:gc-info skill-level:intermediate cost:medium
it's a bit risky to repurpose them under the assumption they are not used.
So, we are encoding LIVE gc register data in the location of where the target register is stored in instrDesc:
id->idReg1((regNumber)encodeMask); // Save in idReg1
Therefore, we are assuming that this particular instrDesc will not use idReg1 as a target register for an instruction? If that's the case, I understand why this could be risky as it may be easy to not assume it will not be used that way.
However, not sure how much of a problem it is today or how many cases it hit. Keeping this as future unless someone believes we should clean this up.