From 9847e462ddfbb0e9bd5564eeedb5ec654fd1666c Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 30 Nov 2026 19:06:28 +0100 Subject: [PATCH] cmake: function-visibility.txt entries for the /GL units of #515, #516 and #518 #515, #516 and #518 put twelve units on cmake/compiler-flags-gl.txt. UpdateCamel, UpdateLady and UpdateFireEater have an entry here already and read 100.0% with OPENSHC_FUNCTION_VISIBILITY_UNITS on; the other nine have none. In that mode 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: the nine read 37.7% to 65.7% in main ff7e56eea0's full build in that mode, the build the real builds below compare against. Each gets an entry at its address, its callees in address order. The /GL lines stay as they are. Each entry names only callees that are already members of the group that holds hasUnitReachedDestination, so the nine join that group and nothing else moves: no other function leaves the /GL list, and no other function sees a body it did not see before. The nine's other /GL callees (setDestinationForUnit, moveToFreeTileNearby, acquireShootTarget, shootProjectile and the rest of their closures) stay opaque to them, and they read 100.0% / 100.0% that way (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses). Naming each unit's whole /GL callee closure instead would put 28 more functions in that group: with every .cpp of main as the build list, cmake/function-visibility-units.py then makes 22 wrapper units holding 178 source files, against 25 holding 141 on main (the nine units and 28 of their callees join, and three smaller groups merge in). Those 28 would leave the /GL list for main's callers that have no entry (processUnitMove, exitLadder, unitClimbing, UpdateHorseArcher_DoShooting and others). Each caller-callee pair is measured as #491's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone, quick_diff on main ff7e56eea0. The data resolvers were switched on with tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list with 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 (so indirect ones too: commitUnitLocation's two callees for UpdateTunneler, ConsiderHavingABreakNowUnk behind UpdateWorker_ConsiderTakingABreakUnk for UpdateWheatFarmer), not callees reached only through functions outside the group. A callee is listed when leaving it out of that 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 each unit at 100.0%. - UpdateMother: 0.5668 alone, 0.9918 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7900, hasUnitReachedDestination 0.8918, changeDestinationByAmount 0.8994. - UpdateChild: 0.5564 alone, 0.9993 with its 4. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.8294, hasUnitReachedDestination 0.9153, hasTunnelerNotFinishedDigging 0.9881, changeDestinationByAmount 0.9976. - UpdateTunneler: 0.6433 alone, 0.9897 with its 2. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7619, hasUnitReachedDestination 0.6726. commitUnitLocation and its callees setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs change nothing. - UpdateWheatFarmer: 0.4115 alone, 0.9988 with its 8. Left out, IncrementAndOptionalUpdateAVValueRelated reads 0.7775, ConsiderHavingABreakNowUnk 0.9838, SetStateToFreetimeWalking 0.9898, ComputeGoodsProduced 0.9784, checkIfCitizenUnitIsAliveBasedOnState 0.8193, hasUnitReachedDestination 0.9462, changeDestinationByAmount 0.9130, UpdateWorker_ConsiderTakingABreakUnk 0.9838. - UpdateCrusaderArcher: 0.6723 alone, 0.9869 with its 3. Left out, xyAreValid reads 0.9709, hasUnitReachedDestination 0.7176, changeDestinationByAmount 0.9853. - UpdateCrossbowman: 0.6537 alone, 0.9964 with hasUnitReachedDestination. - UpdateLadderman: 0.4106 alone, 0.9938 with hasUnitReachedDestination. - UpdateArabianArcher: 0.5843 alone, 0.9944 with hasUnitReachedDestination. - UpdateFireThrower: 0.6844 alone, 0.9965 with hasUnitReachedDestination. makeUnitStopWalkingByClearingPathProgressState, which UpdateMother, UpdateChild and UpdateWheatFarmer call, changes nothing for any of them. With every .cpp of main as the build list, cmake/function-visibility-units.py now makes 25 wrapper units holding 150 source files (141 before): the nine 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 of this change on main ff7e56eea0, BUILD_OK and 0 failures each: - full, option on: every .cpp of main with all function and data resolvers on (the 12 files that don't compile since #509's sync left out), 3,025 files and 3,043 functions, against main ff7e56eea0 built the same way. The nine read 100.0% / 100.0% (main: 37.7% to 65.7%); nothing else reads differently. - small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units and UpdatePriest with their callee closures, and every file of a group that touches them, 485 files and 495 functions. All twelve read 100.0% / 100.0% in both modes; UpdatePriest, which has no entry, 100.0% off and 72.0% / 68.9% on, as on main. Co-Authored-By: Claude Opus 5.5 --- cmake/function-visibility.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cmake/function-visibility.txt b/cmake/function-visibility.txt index f141a0d4d5..7a92d7420a 100644 --- a/cmake/function-visibility.txt +++ b/cmake/function-visibility.txt @@ -158,6 +158,15 @@ OpenSHC::Map::Units::UpdateLady OpenSHC::Map::Units::UpdateBatteringRam OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UnitsState::deselectUnit +OpenSHC::Map::Units::UpdateMother + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination + OpenSHC::Map::Units::UnitsState::changeDestinationByAmount +OpenSHC::Map::Units::UpdateChild + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination + OpenSHC::Map::Units::UnitsState::hasTunnelerNotFinishedDigging + OpenSHC::Map::Units::UnitsState::changeDestinationByAmount OpenSHC::Map::Units::UpdateJuggler OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination @@ -167,6 +176,9 @@ OpenSHC::Map::Units::UpdateFireEater OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UnitsState::hasTunnelerNotFinishedDigging OpenSHC::Map::Units::UnitsState::changeDestinationByAmount +OpenSHC::Map::Units::UpdateTunneler + OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateQuarryMason OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UpdatePitchman @@ -180,6 +192,15 @@ OpenSHC::Map::Units::UpdatePitchman OpenSHC::Map::Units::UnitsState::setupUnitSharingCurrentTilePosition OpenSHC::Map::Units::UpdateWorker_ConsiderTakingABreakUnk OpenSHC::Map::Units::UnitsState::commitUnitLocation +OpenSHC::Map::Units::UpdateWheatFarmer + 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::changeDestinationByAmount + OpenSHC::Map::Units::UpdateWorker_ConsiderTakingABreakUnk OpenSHC::Map::Units::UpdateHopsFarmer OpenSHC::Map::Units::IncrementAndOptionalUpdateAVValueRelated OpenSHC::Map::Units::SetStateToFreetimeWalking @@ -199,6 +220,12 @@ OpenSHC::Map::Units::UpdateDairyFarmer OpenSHC::Map::Units::ComputeGoodsProduced OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination +OpenSHC::Map::Units::UpdateCrusaderArcher + OpenSHC::Rendering::ViewportRenderState::xyAreValid + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination + OpenSHC::Map::Units::UnitsState::changeDestinationByAmount +OpenSHC::Map::Units::UpdateCrossbowman + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdatePikeman OpenSHC::Rendering::ViewportRenderState::xyAreValid OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination @@ -211,6 +238,8 @@ OpenSHC::Map::Units::UpdateSwordsman OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateKnight OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination +OpenSHC::Map::Units::UpdateLadderman + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateEngineer OpenSHC::Rendering::ViewportRenderState::xyAreValid OpenSHC::Synchrony::GameSynchronyState::isAIPlayer @@ -255,12 +284,16 @@ OpenSHC::Map::Units::UpdateCageDog OpenSHC::Map::Units::UnitsState::checkIfCitizenUnitIsAliveBasedOnState OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UnitsState::tryAttackUnitID +OpenSHC::Map::Units::UpdateArabianArcher + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateSlave OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateAssassin OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateArabianSwordsman OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination +OpenSHC::Map::Units::UpdateFireThrower + OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UpdateFireBallista OpenSHC::Map::Units::UnitsState::hasUnitReachedDestination OpenSHC::Map::Units::UnitsState::deselectUnit