From e61d00123c41d74f98cd06b63768be12d9b6348a Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Wed, 16 Sep 2026 09:17:30 -0400 Subject: [PATCH] [Feat] (MG_Backend, MG_Remote/Server): construct BackendObject_Remote directly in the split hook and bracket PipeApplier::ApplyOne with ScopedApplierEntry - the two merge-time hunks (ID-59) --- MobileGL/MG_Backend/Init.cpp | 23 ++++++++------------ MobileGL/MG_Remote/Server/PipeApplier.cpp | 9 ++++++++ MobileGL/MG_Remote/Server/ServerLoop.cpp | 26 ----------------------- 3 files changed, 18 insertions(+), 40 deletions(-) diff --git a/MobileGL/MG_Backend/Init.cpp b/MobileGL/MG_Backend/Init.cpp index 451b9423..b019690b 100644 --- a/MobileGL/MG_Backend/Init.cpp +++ b/MobileGL/MG_Backend/Init.cpp @@ -20,15 +20,14 @@ #endif #if MOBILEGL_BUILD_DISAGGREGATED -namespace MobileGL::MG_Remote::Client { - // PACKAGE c1's, DECLARED HERE RATHER THAN INCLUDED. The client's BackendObject_Remote is - // c1's file and does not exist while v1 is written, so v1 ships a WEAK definition of this - // beside ServerLoop that aborts by name. c1's strong definition displaces it at link time - // with no edit to this file - and until then the hook cannot silently succeed, which is the - // only property that matters: a split lane that installed a WORKING monolith backend object - // here would render correctly for entirely the wrong reason (ARCHITECTURE.md 10.3). - UniquePtr CreateRemoteBackendObject(); -} // namespace MobileGL::MG_Remote::Client +// [p5/v1-joint PREVIEW EDIT - the merge-time form of v1's hook, c1-v1 8.2's exact order.] The +// weak CreateRemoteBackendObject placeholder v1 shipped for a c1-less tree is DELETED at the +// merge: the integration test links the STATIC MobileGL_s archive, and an archive member is +// only pulled to satisfy an UNDEFINED reference - the weak definition in ServerLoop.cpp.o +// already satisfied it, so BackendObject_Remote.cpp.o was never linked at all and the joint +// build aborted in the placeholder (~/w7/p5-v1-joint-preflight.log). Direct construction +// needs no factory and no weak symbol. +#include #endif namespace MobileGL::MG_Backend { @@ -160,11 +159,7 @@ namespace MobileGL::MG_Backend { // 4. and only now the CLIENT's backend object in the one global that holds it. // Table 3: pActiveBackendObject holds BackendObject_Remote and the server's // BackendObject_DirectGLES stays private to ServerLoop. - pActiveBackendObject = MG_Remote::Client::CreateRemoteBackendObject(); - if (!pActiveBackendObject) { - MGLOG_E("MG_Remote: CreateRemoteBackendObject returned null"); - return false; - } + pActiveBackendObject = MakeUnique(); return true; } } // namespace diff --git a/MobileGL/MG_Remote/Server/PipeApplier.cpp b/MobileGL/MG_Remote/Server/PipeApplier.cpp index a50451b2..7b2e8c0c 100644 --- a/MobileGL/MG_Remote/Server/PipeApplier.cpp +++ b/MobileGL/MG_Remote/Server/PipeApplier.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -365,6 +366,14 @@ namespace MobileGL::MG_Remote::Server { "Attach once before its first pop"); std::abort(); } + // R-1's INVARIANT, THE SERVER'S HALF (table 3's gPipeInputs row, c1-v1 8.1). The flag + // is raised for the WHOLE of this function and not only around DecodeAndApply: the + // stamp below and LeaveApplier at the end are both writes to gPipeInputs, and the client + // asserts the flag is down before it publishes (ClientSession::EmitAndWait), so a + // bracket that excluded either would leave a real write outside the check. It is + // dropped before this function returns, and s1's SessionConsumer::ApplyOne publishes + // appliedSeq only after that - so by the time the client is runnable the flag is down. + const Client::ClientSession::ScopedApplierEntry insideApplier; // ORDER IS THE CONTRACT'S: stamp, then apply. The stamp is what makes any server-side // read of gPipeInputs legal at all (PipeApplier.h's block 1), so a record applied // before it aborts on the FIRST field inside SyncRenderState. diff --git a/MobileGL/MG_Remote/Server/ServerLoop.cpp b/MobileGL/MG_Remote/Server/ServerLoop.cpp index f0a4bc2f..a427cc17 100644 --- a/MobileGL/MG_Remote/Server/ServerLoop.cpp +++ b/MobileGL/MG_Remote/Server/ServerLoop.cpp @@ -858,29 +858,3 @@ namespace MobileGL::MG_Remote::Server { } } // namespace MobileGL::MG_Remote::Server - -// --------------------------------------------------------------------------------- -// The weak placeholder for package c1's remote backend object -// --------------------------------------------------------------------------------- -// -// MG_Backend/Init.cpp's hook calls MG_Remote::Client::CreateRemoteBackendObject(), which is -// c1's BackendObject_Remote and does not exist while v1 is written. A WEAK definition here -// lets v1 compile, link and be tested today, and c1's strong definition displaces it at link -// time with no edit anywhere. -// -// IT ABORTS BY NAME AND DOES NOT RETURN A WORKING MONOLITH OBJECT. That distinction is the -// whole point: a placeholder that handed back a BackendObject_DirectGLES would give a lane -// called "split" a correct picture produced entirely by the monolith path, which is -// ARCHITECTURE.md 10.3's failure and the one this phase exists to make impossible. -#if defined(__GNUC__) || defined(__clang__) -namespace MobileGL::MG_Remote::Client { - __attribute__((weak)) UniquePtr CreateRemoteBackendObject() { - MGLOG_F("MGPipe: Fatal{UnimplementedRemoteBackendObject} - MG_Backend::Init()'s split " - "hook asked for the client's BackendObject_Remote and only v1's weak " - "placeholder is linked in. That object is package c1's (BRIEF 5); until it " - "lands there is no client role, and this build refuses to substitute the " - "monolith backend for it"); - std::abort(); - } -} // namespace MobileGL::MG_Remote::Client -#endif