dotnet/runtime

Eliminate insGroup overflow allocation platform differences

Open

#12,303 创建于 2019年3月20日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)C# (5,445 fork)batch import
area-CodeGen-coreclrhelp wanted

仓库指标

Star
 (17,886 star)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

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

贡献者指南