Repository navigation
Conversation
|
Thank you giveen, this is a nice fold, and the Thaldren evidence for Each one is the map-size product
The likely cause is the symbol count before those functions in |
|
You were right that the packing note was wrong, and it was my mistake. Fixed in 795baf8. The note claimed six of the seven records were the same size at either packing. That is false for two of them. I checked the sizes with the real compiler rather than by hand, in a scratch translation unit that includes the header at both packings and fails to compile if any of them moves, with a negative control to confirm the assertions discriminate. They are not in the header itself: a typedef there would cost symbol ids and could move a later function's registers, which is the thing this repository is careful about. The other three things in the review do not reproduce on a clean build of the rebased branch, and I would like to pin down why before changing anything, because acting on them would be a guess. The other three things in the review do not reproduce on a clean build of the rebased branch, and I would like to pin down why before changing anything, because acting on them would be a guess. The 0x4240c0 mismatch: after The The The What I changed: only the packing note in One thing I cannot check from here: the CI runs for this pull request are still |
|
Thanks giveen, and thanks for the careful reply and the packing fix. Two things to clear up: 1. The other points weren't mine. The packing note, 2. The MD5 still differs here on the rebased head (795baf8). I built it in a fresh worktree on current main, with an empty (0x33 against 0x37 is the low byte of the To rule out a local difference, could you try it from a throwaway worktree of exactly what's pushed? If that shows the shipped MD5 for you, something in our two environments differs and I'd like to know what. If it shows the six bytes, then your working tree probably has a change that never got committed (for example |
|
Friendly check-in, no rush: this is still waiting on the imul operand swap in UpdateFeatures, RemoveAllFeatures and SaveFeatures (my comment above has the offsets). If it's easier, splitting the features.cpp include move out of this PR would let the rest merge right away. Thanks for all the work here. |
Part of #7071
Model: Ares / claude-opus-5
Two rule-2 folds in
src/map: seven records that two files each declared for themselves, with byte-for-byte identical bodies every time. Both files already agreed on every name, so nothing is renamed, and this issue is about the types still named after an address.src/map/unit_bucket.h, included byterrain.cppandterrain_47cc30.cpp, holdsUnitBucket: the map spatial-grid cell,char unknown_0[6]; Unit* first;.src/map/feature_records.h, included byfeatures.cpp,features_421f20.cppandfeatures_4224b0.cpp, holdsAnimSrc,Anim,AnimEntry,FeatureUnit,NameEntry,ListandAnimManager.The layout of
UnitBucketis Thaldren's.data/thaldren/structs.csvhasSpatialBucket, 0xa bytes, withbMaxHeightat +0x0,bMaxHeightScanat +0x1,dwEdgeFlagsat +0x2 (aSpatialBucketEdgeFlags) andpUnitHead, aUnitInstance*, at +0x6. That +0x6 is exactly the member both files use: they walk it as the head of the list of units standing in the cell, and the units link through their own +0x8e. Thaldren names that link too,UnitInstance+0x8epCargoNext, which is thecargoNextboth files use, and +0x82pSpatialBucket, aSpatialBucket*, is the memberterrain.cppcallsspatialBucket. The first six bytes stayunknown_0because nothing insrc/reads them.The
#pragma pack(push, 1)insidefeature_records.his load-bearing and says so.FeatureUnit'sint defsits at +0x92, which is not 4-byte aligned, so the record is only 0x118 bytes at 1-byte packing;AnimEntryandAnimManageralso need it, since theirAnimEntry*andFeatureUnit*sit at +0x2e and +0x14.features.cppalready had all seven inside apack(1)region, andfeatures_421f20.cpphadFeatureUnitinside one. Two records do change size with packing, and the header now says which:Anim(0xc at pack(1), 0xe at default) andAnimSrc(6, then 8).features_4224b0.cpphad both inside itspack(1)region and now gets them at the header's packing, which is a real change to those two records. It is inert: nothing insrc/takessizeofof either or strides by them, both are reached only through pointers, andAnimSrc's two read members,countandkind, stay at +0x0 and +0x2 either way. Thaldren'sGafSequenceis the full 0x30-byte record thatAnimSrcis a narrow view of, so the padded tail was never a layout the original relied on. The sizes and offsets were checked with the real compiler rather than by hand, in a scratch translation unit that includes the header at both packings and fails to compile if any of them moves.features_421f20.cppalso loses an emptypack(push, 1)/pack(pop)pair that existed only to holdAnimEntry.Checks: checkall 57 of 57 MATCH (every function in
terrain.cpp,terrain_47cc30.cpp,features.cpp,features_421f20.cppandfeatures_4224b0.cpp); place.py MD5 8e74a1dffa1f5988624c52048f5b20cd, with and without--no-orig --strict; modules.py --check passes; progress.py still 100.00% matched, 3267 functions, 0 partialLeft out:
Elem_00434020(five copies) andElem_00434360(four). These are the only duplicated names left in the folder: I scanned all 75 names the issue body lists and 27 are still declared somewhere insrc/map, but only these two appear in more than one file.los_tables.hsays at its forward declaration that they stay that way, "declared only: the files that build the tables define it", andlos_tables_433270.cpphas a genuinely differentElem_00434360(an extra vector layer, so the innermost destroy stays out of line), which a shared header could not hold anyway.MapSizeinradar.cpp:77andterrain.cpp:200, andUnitDefin four files: each declaration carries the comment that it stays private because a decorated name has to keep the placeholder, which is the exception the issue allows.map_size.halready exists for the cases where it can be shared.MeteorParamsinmap_list.cpp:86andmeteors.cpp:13: both are namedMeteorParamsalready, so neither is address-named, and rule 2 would only move a name that is already shared.PlayerViewinline_of_sight_481d50.cpp:30andline_of_sight_482270.cpp:46andFeatureTdfParserVectorinfeatures_4224b0.cpp:26andfeatures_422ea0.cpp:31are real rule-2 pairs with identical bodies and no keep comment. They want headers of their own, and each needs aByteMaporTdfFiledeclaration to arrive first, so I left them for a follow-on rather than widen this one past what I could check here.Suspected original bugs: