From bb4de06d339f5c94f8352c11eadb59d33ce0a722 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Tue, 1 Dec 2026 00:15:18 +0100 Subject: [PATCH] cmake: function-visibility.txt entries for UpdatePriest, UpdatePeasant and UpdateMiller #534 gave the nine /GL units of #515, #516 and #518 that had no entry in cmake/function-visibility.txt one, and left three for a follow-up: UpdatePeasant and UpdateMiller (#533), and UpdatePriest, main's own unit. This adds the three, each at its address, its callees in address order. All three are on cmake/compiler-flags-gl.txt already (UpdatePriest was there before those PRs); that file stays as it is. With OPENSHC_FUNCTION_VISIBILITY_UNITS on, the members of every group leave the /GL list, among them the helpers in the group that holds hasUnitReachedDestination, so a /GL unit without an entry no longer sees them: in main e62246aab7's full build in that mode, the build the real builds below compare against, UpdatePriest reads 72.0% / 68.9%, UpdatePeasant 49.3% / 48.7% and UpdateMiller 51.7% / 46.2% (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses). UpdatePriest's entry names only callees that are already members of the group that holds hasUnitReachedDestination, as #534's do. UpdatePeasant's and UpdateMiller's name members of that group and, each, one more /GL callee that is not in it: getDestination2EqualsGivenCoordinates for UpdatePeasant and standUpIfSeated for UpdateMiller. With the members alone they read 96.0% / 87.1% and 96.5% / 93.0% in an earlier full build of this branch with the option on (below). With that callee they read 100.0%, so it joins the group, and with the option on, CMake takes five more files off the /GL list: the three units, getDestination2EqualsGivenCoordinates and standUpIfSeated. Nothing else moves: getDestination2EqualsGivenCoordinates is called by UpdatePeasant only, and standUpIfSeated by UpdateMiller, standUpAllTribeUnits and updatePeasantSeatingAtBuilding (neither of the last two is on the /GL list or has an entry, so neither saw its body before or sees it now). No other function sees a body it did not see before. The three units' other /GL callees (setDestinationForUnit, resetUnitMovementState, clearHiddenFlagAndUpdatePosition, setWorkplaceBuildingEntryAsTarget, selectNewBlessingTarget, setUnitFacingDirectionTowardsTarget and the rest of their closures) stay opaque to them. Each caller-callee pair is measured as #491's and #534's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone, quick_diff on main e62246aab7, with the data resolvers switched on by tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list by tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are the group's members that the unit calls directly or through another member it calls (commitUnitLocation's callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs, included), not callees reached only through functions outside the group; and, for UpdatePeasant and UpdateMiller, each /GL callee outside the group that they call, one at a time on top of the named members, pasted without its own callees unless it says "with its callees". A callee is listed when leaving it out of the set lowers the ratio; the listed set reads what the whole set reads. quick_diff is stricter than reccmp about register names; the real builds read the units at 100.0%. - UpdatePriest: 0.7534 alone, 0.9986 with its 5. Left out, makeUnitStopWalkingByClearingPathProgressState reads 0.9891, IncrementAndOptionalUpdateAVValueRelated 0.8859, checkIfCitizenUnitIsAliveBasedOnState 0.9510, hasUnitReachedDestination 0.9680, changeDestinationByAmount 0.9850. commitUnitLocation, its callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs change nothing. - UpdatePeasant: 0.5329 alone, 0.9941 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.5880, getDestination2EqualsGivenCoordinates 0.9725, hasUnitReachedDestination 0.9684. Outside the group, on top of the two members, clearHiddenFlagAndUpdatePosition (with its callees) and setDestinationForUnit change nothing. - UpdateMiller: 0.5531 alone, 0.9973 with its 13. Left out, getBuildingResourceAmountByUid reads 0.9722, setupUnitSharingTileIDs 0.9947, standUpIfSeated 0.9913, sitDownIfStanding 0.9953, IncrementAndOptionalUpdateAVValueRelated 0.8442, ConsiderHavingABreakNowUnk 0.9914, SetStateToFreetimeWalking 0.9707, ComputeGoodsProduced 0.9661, checkIfCitizenUnitIsAliveBasedOnState 0.8008, hasUnitReachedDestination 0.9593, setupUnitSharingCurrentTilePosition 0.9947, UpdateWorker_ConsiderTakingABreakUnk 0.9914, commitUnitLocation 0.9947. makeUnitStopWalkingByClearingPathProgressState changes nothing. Outside the group, on top of the twelve members, resetUnitMovementState (with its callees), setDestinationForUnit, setWorkplaceBuildingEntryAsTarget, addResourceToStockpile, buildingIsAccessible, updateBuildingSignpostCounter and getStorageBuildingForResourceTypeAndAmount change nothing; the last four are members of other groups, so with the option on they are off the /GL list already, and naming one would merge two groups. With every .cpp of main as the build list, cmake/function-visibility-units.py makes 25 wrapper units holding 155 source files (150 before): the three units and the two callees join the group that holds hasUnitReachedDestination, and no other file changes group. CMake reads this file only with the option on, so the default build is unchanged. Real builds on main e62246aab7, BUILD_OK and 0 failures each: - full, option on: every .cpp of main with all function and data resolvers on (the 3 files that don't compile there left out: findBestAttackTileByPathCost, resetTileAndClearMoat, TransformAndRenderPercentage), 3,036 files and 3,054 functions, against main e62246aab7 built the same way. Two full builds of the branch's side: one with the three entries without getDestination2EqualsGivenCoordinates and standUpIfSeated (UpdatePriest's as it is now), which reads UpdatePeasant 96.0% / 87.1%, UpdateMiller 96.5% / 93.0% and UpdatePriest 100.0% / 100.0%; and this change, which reads the three 100.0% / 100.0%. Against main nothing else reads differently in either. - small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units of #515, #516 and #518 (nine in #534, three with an entry before it) and these three with their callee closures, standUpAllTribeUnits and updatePeasantSeatingAtBuilding, and every file of a group that touches them, 494 files and 504 functions. All fifteen units read 100.0% / 100.0% in both modes. UpdateFireBallistaBuilding: with the option off, where this file is not read, 100.0% / 100.0% with the 494 files and 99.6% / 95.5% with 492 (without standUpAllTribeUnits and updatePeasantSeatingAtBuilding), so its reading changes with the set of files built; with the option on, 99.6% / 95.5% with the 494 files, and main was not built with those files and the option on, so that case is not settled. It reads 100.0% / 100.0% in both full builds, this change's and main's. Co-Authored-By: Claude Opus 5.5 --- cmake/function-visibility.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cmake/function-visibility.txt b/cmake/function-visibility.txt index 7a92d7420a..d5d50e89bf 100644 --- a/cmake/function-visibility.txt +++ b/cmake/function-visibility.txt @@ -129,6 +129,10 @@ OpenSHC::Map::Units::UpdateBurningMan OpenSHC::Map::Units::UpdateCamel OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination +OpenSHC::Map::Units::UpdatePeasant + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::getDestination2EqualsGivenCoordinates + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateOx OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination @@ -220,6 +224,20 @@ OpenSHC::Map::Units::UpdateDairyFarmer OpenSHC::Map::Units::ComputeGoodsProduced OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination +OpenSHC::Map::Units::UpdateMiller + OpenSHC::Map::Buildings::BuildingsState::getBuildingResourceAmountByUid + OpenSHC::Map::Units::UnitsState::setupUnitSharingTileIDs + OpenSHC::Map::Units::UnitsState::standUpIfSeated + OpenSHC::Map::Units::UnitsState::sitDownIfStanding + OpenSHC::Map::Units::IncrementAndOptionalUpdateAVValueRelated + OpenSHC::Map::Units::ConsiderHavingABreakNowUnk + OpenSHC::Map::Units::SetStateToFreetimeWalking + OpenSHC::Map::Units::ComputeGoodsProduced + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination + OpenSHC::Map::Units::UnitsState::setupUnitSharingCurrentTilePosition + OpenSHC::Map::Units::UpdateWorker_ConsiderTakingABreakUnk + OpenSHC::Map::Units::UnitsState::commitUnitLocation OpenSHC::Map::Units::UpdateCrusaderArcher OpenSHC::Rendering::ViewportRenderState::xyAreValid OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination @@ -254,6 +272,12 @@ OpenSHC::Map::Units::UpdateMinerIronFetcher OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UnitsState::isWorkplaceBuildingOnAdjacentTile +OpenSHC::Map::Units::UpdatePriest + OpenSHC::Map::Units::UnitsState::makeUnitStopWalkingByClearingPathProgressState + OpenSHC::Map::Units::IncrementAndOptionalUpdateAVValueRelated + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination + OpenSHC::Map::Units::UnitsState::changeDestinationByAmount OpenSHC::Map::Units::UpdateDrunkard OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasTunnelerNotFinishedDigging