MinecraftForge / ForgeFlower

Forge's modifications to FernFlower. Fixing various bugs/inconsistencies. Main Repo: https://github.com/MinecraftForge/FernFlower
Apache License 2.0
80 stars 44 forks source link

Replace SformsFastMap shallow copy with deep copy #126

Closed jaskarth closed 1 year ago

jaskarth commented 1 year ago

This PR fixes an invisible bug where SSA(U)ConstructorSparseEx would create and use shallow copies of SFormsFastMap objects, which can cause silent pollution of the backing set datastructure. This can be seen as the constructor used to create shallow copies doesn't actually clone the FastSparseSets, but rather creates new arrays to hold them and passes it to the newly created object. This manifests in Minecraft as the elimination of assignments that have no further usages, as can be seen in the 1.19.2 diff. While this bug doesn't cause any adverse semantic differences, I think it's still beneficial to have the assignments as they appear in the bytecode.