Eliminate insGroup overflow allocation platform differences
#12.303 aperta il 20 mar 2019
Metriche repository
- Star
- (17.886 star)
- Metriche merge PR
- (Merge medio 12g 11h) (661 PR mergiate in 30 g)
Descrizione
Currently, instruction groups are filled with variable-sized instructions (instrDescs) until full. If code in the same basic block is still being generated, the instructions are copied to a new location, and an "overflow" or "emitAdd" group is added to continue collecting generated instructions.
Instruction groups appear in generated asm diffs as labels marked "emitAdd", although they don't contribute to generated code differences.
Instruction groups are also used to split arm32/arm64 function fragments at large boundaries (or under stress), e.g., https://github.com/dotnet/coreclr/issues/22169.
Because the size of instrDescs differs between Debug and non-Debug builds, and between different platforms (including potentially cross-bitness and native-bitness compilations, where a native-sized host pointer is included), the number of instrDescs that fill the insGroup can differ between platforms/flavors. This can create unnecessary differences between flavors/platforms.
Instead, change the allocation scheme to always allocate enough space for a given, fixed number of instructions, of any type. Then, when that number is reached, create an overflow IG. This way, the "overflow"/"emitAdd" IGs will be created in exactly the same place (between the same two generated instructions) independent of flavor/platform. This will reduce flavor/platform differences.
category:implementation theme:emitter skill-level:intermediate cost:small