Close unit_export_function_values exactly: units.obj reaches 178/11/0

Census 177/12/0 -> 178/11/0 code, data stays 129/0/0. This is the last owner
reachable by a known lever.

unit_export_function_values needs a _ReadWriteBarrier() between the two getter
calls and the pointer initialisations. Without it the preamble hoists one
pointer above the deferred cdecl cleanup and splits lea edi,[eax+0x198] into
mov+add, leaving four LCS blocks; 70 admissible shapes were measured inert
(a 64-way cross product of pointer spellings, count forms, statement orders and
C89 declaration styles, plus six structural forms). With it the owner is
byte-exact at 384/18.

The declaration pair follows the form already used elsewhere in this tree, in
source/game/players.c, source/objects/object_shadows.c and
source/rasterizer/xbox/rasterizer_xbox_hardware_geometry.c. Compiles clean with
no warnings; the intrinsic emits no code.

Landed on the project owner's explicit direction, who judged the exact owner
worth the construct.

Wave gates: /Zs exit 0 with no warnings; contained deletion with a dry run
proving exactly one CL edge; one emission; owner gate pinned to b97d95fe shows
exactly one changed owner of 220, the intended one; determinism replay
identical across all 220 owners.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jonas VolmanandClaude Fable 5 committed 2026-08-27 20:24:20 -07:00
1 parent b97d95fe79
commit ddb5c2402a
1 file changed
+4
+4
View File
@@ -1231,6 +1231,9 @@ enum
NUMBER_OF_UNIT_FUNCTION_MODES,
};
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
void unit_export_function_values(
long unit_index)
{
@@ -1242,6 +1245,7 @@ void unit_export_function_values(
unit = unit_get(unit_index);
unit_definition = unit_definition_get(unit->definition_index);
_ReadWriteBarrier();
function_value = unit->object.incoming_function_values;
function_mode = unit_definition->unit.function_modes;
function_count = NUMBEROF(unit->object.incoming_function_values);