Commits on Source (5)
-
Rodrigo Mesquita authored
To achieve object determinism, we need to prevent the non-deterministic uniques from leaking into the object code. We can do this by deterministically renaming the non-external uniques in the Cmm groups that are yielded right after StgToCmm. The key to deterministic renaming is observing that the order of declarations, instructions, and data in the Cmm groups are already deterministic (modulo other determinism bugs), regardless of the uniques. We traverse the Cmm AST in this deterministic order and rename the uniques, incrementally, in the order they are found, thus making them deterministic. This renaming is guarded by -fobject-determinism which is disabled by default for now. This is one of the key passes for object determinism. Read about the overview of object determinism and a more detailed explanation of this pass in: * Note [Object determinism] * Note [Renaming uniques deterministically] Significantly closes the gap to #12935
Verifiedbec9f340 -
Rodrigo Mesquita authored
Part of our strategy in producing deterministic objects, namely, renaming all Cmm uniques in order, depend on the object code produced having a deterministic order (say, A_closure always comes before B_closure). However, the use of LabelMaps in the Cmm representation invalidated this requirement because the LabelMaps elements would already be in a non-deterministic order (due to the original uniques), and the renaming in sequence wouldn't work because of that non-deterministic order. Therefore, we now start off with lists in CmmGroup (which preserve the original order), and convert them into LabelMaps (for performance in the code generator) after the uniques of the list elements have been renamed. See Note [DCmmGroup vs CmmGroup or: Deterministic Info Tables] and #12935.
Verifieda96081f1 -
Rodrigo Mesquita authored
This unique was leaking as part of the profiling description in info tables when profiling was enabled, despite not providing information relevant to the profile.
Verified45de906a -
Rodrigo Mesquita authored
In order to produce deterministic objects when compiling with -distinct-constructor-tables, we also have to update the data constructor map to be backed by a deterministic unique map (UDFM) rather than a non-deterministic one (UniqMap).
Verified52c39590 -
Rodrigo Mesquita authored
Fixes object determinism when using -finfo-table-map Make sure to also deterministically rename the IPE map (as per Note [Renaming uniques deterministically]), and to use a deterministic unique supply when creating new labels for the IPE information to guarantee deterministic objects when IPE information is requested. Note that the Cmm group produced in generateCgIPEStub must /not/ be renamed because renaming uniques is not idempotent, and the references to the previously renamed code in the IPE Cmm group would be renamed twice and become invalid references to non-existent symbols. We do need to det-rename the InfoTableMap that is created in the conversion from Core to Stg. This is not a problem since that map won't refer any already renamed names (since it was created before the renaming).
Verifiedbea3b26c
Showing
- compiler/GHC/Cmm.hs 90 additions, 8 deletionscompiler/GHC/Cmm.hs
- compiler/GHC/Cmm/CLabel.hs 43 additions, 2 deletionscompiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Dataflow/Graph.hs 21 additions, 20 deletionscompiler/GHC/Cmm/Dataflow/Graph.hs
- compiler/GHC/Cmm/Graph.hs 4 additions, 4 deletionscompiler/GHC/Cmm/Graph.hs
- compiler/GHC/Cmm/Info/Build.hs 4 additions, 0 deletionscompiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/LayoutStack.hs 13 additions, 7 deletionscompiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Parser.y 10 additions, 3 deletionscompiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Pipeline.hs 2 additions, 3 deletionscompiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/Switch.hs 6 additions, 1 deletioncompiler/GHC/Cmm/Switch.hs
- compiler/GHC/Cmm/ThreadSanitizer.hs 2 additions, 1 deletioncompiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/Cmm/UniqueRenamer.hs 284 additions, 0 deletionscompiler/GHC/Cmm/UniqueRenamer.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs 2 additions, 2 deletionscompiler/GHC/CmmToAsm/Reg/Liveness.hs
- compiler/GHC/Driver/Config/StgToCmm.hs 1 addition, 0 deletionscompiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/Flags.hs 4 additions, 0 deletionscompiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/GenerateCgIPEStub.hs 16 additions, 3 deletionscompiler/GHC/Driver/GenerateCgIPEStub.hs
- compiler/GHC/Driver/Main.hs 20 additions, 8 deletionscompiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Session.hs 2 additions, 0 deletionscompiler/GHC/Driver/Session.hs
- compiler/GHC/Stg/Debug.hs 6 additions, 6 deletionscompiler/GHC/Stg/Debug.hs
- compiler/GHC/StgToCmm.hs 76 additions, 8 deletionscompiler/GHC/StgToCmm.hs
- compiler/GHC/StgToCmm/CgUtils.hs 2 additions, 1 deletioncompiler/GHC/StgToCmm/CgUtils.hs
compiler/GHC/Cmm/UniqueRenamer.hs
0 → 100644