[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)

This commit is contained in:
2026-09-16 09:18:10 -04:00
parent 65a403284c
commit e61d00123c
3 changed files with 18 additions and 40 deletions
+9 -14
View File
@@ -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<MG_Backend::BackendObject> 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 <MG_Remote/Client/BackendObject_Remote.h>
#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<MG_Remote::Client::BackendObject_Remote>();
return true;
}
} // namespace
@@ -14,6 +14,7 @@
#include <Config.h>
#include <MG_Backend/MGPipe/PipeInputs.h>
#include <MG_Remote/Client/ClientSession.h>
#include <MG_Pipe/PipeApply.h>
#include <MG_Util/Converters/GLToMG/TextureEnumConverter.h>
#include <MG_Util/Debug/Log.h>
@@ -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.
-26
View File
@@ -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<MG_Backend::BackendObject> 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