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

貢獻者指南