[Refactor] (P13 W5 S5): the data-arm predicates, their latch and MOBILEGL_PIPE_DATA_ARM follow the record arm instead of the transport.

This commit is contained in:
2026-10-06 13:00:28 -04:00
parent ad47dc8c6f
commit b1978890b4
2 changed files with 46 additions and 38 deletions
+10 -6
View File
@@ -745,6 +745,14 @@ namespace MobileGL::MG_Config {
return Transport == TransportMode::Spawn && Ipc.Surface == IpcSurface::Server;
}
#else
// The whole point: in a build without MG_Remote this folds at compile time, so
// `if (MG_Config::Transport != MG_Config::TransportMode::Monolith)` in Init.cpp is a
// discarded statement and the pull build gains no symbol, no branch and no byte.
inline constexpr TransportMode Transport = TransportMode::Monolith;
#endif
#if MOBILEGL_BUILD_RECORD_ARM
// P13 W4: THE DATA-ARM QUESTION - do the backends read RECORDS (the applier's twins, the staged
// stores, the verb's own handles) rather than frontend objects? Under a wire the answer has
// always been yes; P13 makes it yes for monolith too ("monolith is the push variant"), one
@@ -765,12 +773,8 @@ namespace MobileGL::MG_Config {
return Transport == TransportMode::Monolith && MonolithTakesRecordArm;
}
#else
// The whole point: in a build without MG_Remote this folds at compile time, so
// `if (MG_Config::Transport != MG_Config::TransportMode::Monolith)` in Init.cpp is a
// discarded statement and the pull build gains no symbol, no branch and no byte.
inline constexpr TransportMode Transport = TransportMode::Monolith;
// P13 W4: a build without MG_Remote stays on the frontend arm until W5 moves the record arm
// out of the disaggregated gating (ID-P13-1 / A2).
// A build without the record arm reads frontend objects everywhere (the negative control a
// library built with MOBILEGL_BUILD_RECORD_ARM=0 keeps until W6 deletes the frontend arms).
inline constexpr Bool DataArmIsRecord() { return false; }
inline constexpr Bool RecordArmAliasesFrontend() { return false; }
#endif
+36 -32
View File
@@ -38,9 +38,9 @@ namespace MobileGL::MG_Config {
String TransportEndpoint;
Bool SplitTransportRequestedByConfig = false;
IpcTable Ipc;
Bool MonolithTakesRecordArm = false;
#endif
#if MOBILEGL_BUILD_RECORD_ARM
Bool MonolithTakesRecordArm = false;
RecordArmTable RecordArm;
#endif
} // namespace MobileGL::MG_Config
@@ -459,37 +459,6 @@ namespace MobileGL::MG_ConfigLoader {
// rather than silent, because the failure this avoids is a P6 lane that set
// MOBILEGL_TRANSPORT=spawn, fell back to monolith, and went green on the wrong arm.
// The mode is left at Monolith so nothing half-initializes.
// P13 W4 (Config.h DataArmIsRecord). Read after InitTransport: `frontend` names monolith's
// arm only - a wire has no frontend objects on its server half to read, so there it is
// ignored by name rather than half-honoured.
inline void InitDataArm() {
String value;
QueryEnvVariable("MOBILEGL_PIPE_DATA_ARM", value, "record");
String lowered = value;
std::transform(lowered.begin(), lowered.end(), lowered.begin(),
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
// P13 W4: both backends' monolith runs the record arm - Espryt's from W4a, family by family;
// Magma's at its single flip (its verb entry points pick one arm for every family at once).
const Bool backendReady = MG_Config::ActiveBackendType == BackendType::DirectGLES ||
MG_Config::ActiveBackendType == BackendType::DirectVulkan;
MG_Config::MonolithTakesRecordArm = backendReady;
if (lowered.empty() || lowered == "record") return;
if (lowered == "frontend") {
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) {
MGLOG_W("Config: MOBILEGL_PIPE_DATA_ARM=frontend is ignored under a transport - the "
"record arm is the only arm a wire has");
return;
}
MG_Config::MonolithTakesRecordArm = false;
MGLOG_I("Config: MOBILEGL_PIPE_DATA_ARM=frontend - monolith reads frontend objects in "
"the record families switched so far");
return;
}
MGLOG_W("Config: Ignoring invalid env variable MOBILEGL_PIPE_DATA_ARM='%s'; expected "
"record|frontend, using record",
value.c_str());
}
inline void InitTransport() {
String value;
QueryEnvVariable("MOBILEGL_TRANSPORT", value, "monolith");
@@ -710,6 +679,37 @@ namespace MobileGL::MG_ConfigLoader {
#endif
#if MOBILEGL_BUILD_RECORD_ARM
// P13 W4 (Config.h DataArmIsRecord). Read after InitTransport: `frontend` names monolith's
// arm only - a wire has no frontend objects on its server half to read, so there it is
// ignored by name rather than half-honoured.
inline void InitDataArm() {
String value;
QueryEnvVariable("MOBILEGL_PIPE_DATA_ARM", value, "record");
String lowered = value;
std::transform(lowered.begin(), lowered.end(), lowered.begin(),
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
// P13 W4: both backends' monolith runs the record arm - Espryt's from W4a, family by family;
// Magma's at its single flip (its verb entry points pick one arm for every family at once).
const Bool backendReady = MG_Config::ActiveBackendType == BackendType::DirectGLES ||
MG_Config::ActiveBackendType == BackendType::DirectVulkan;
MG_Config::MonolithTakesRecordArm = backendReady;
if (lowered.empty() || lowered == "record") return;
if (lowered == "frontend") {
if (MG_Config::Transport != MG_Config::TransportMode::Monolith) {
MGLOG_W("Config: MOBILEGL_PIPE_DATA_ARM=frontend is ignored under a transport - the "
"record arm is the only arm a wire has");
return;
}
MG_Config::MonolithTakesRecordArm = false;
MGLOG_I("Config: MOBILEGL_PIPE_DATA_ARM=frontend - monolith reads frontend objects in "
"the record families switched so far");
return;
}
MGLOG_W("Config: Ignoring invalid env variable MOBILEGL_PIPE_DATA_ARM='%s'; expected "
"record|frontend, using record",
value.c_str());
}
// P13 W5: the record arm's knobs (Config.h RecordArmTable), in every build that has the arm.
inline void InitRecordArm() {
MG_Config::RecordArmTable& ipc = MG_Config::RecordArm;
@@ -747,7 +747,11 @@ namespace MobileGL::MG_ConfigLoader {
// After InitFeatures, so the one line InitIpc logs is the last word on this run's
// configuration, and before the accepted-env map is destroyed just below.
InitTransport();
#endif
#if MOBILEGL_BUILD_RECORD_ARM
InitDataArm();
#endif
#if MOBILEGL_BUILD_DISAGGREGATED
InitIpc();
#endif