[Refactor] (P13 W5 S8): MOBILEGL_BUILD_RECORD_ARM is folded away - the record arm is unconditional - and retired_switches keeps it from coming back.

This commit is contained in:
2026-10-06 15:03:11 -04:00
parent a0b9ca0772
commit 7fb18840dc
91 changed files with 46 additions and 2725 deletions
+1 -55
View File
@@ -1205,65 +1205,11 @@ namespace {
// always true) and the production-path probe pair in MG_Test/SanityTest.cpp and
// MG_Test/Buffer/SplitBufferTest.cpp, both of which go red when the producer is
// deleted. This skip is what the build-verify-split lane exists to make visible.
#elif MOBILEGL_BUILD_RECORD_ARM
#else
// P13 W5: the producer is the record arm's (BufferObject::NotePersistentMapStateChanged),
// so the wire is retired wherever that arm is built (PipeApply.cpp's pin follows it).
GTEST_SKIP() << "P5 gave HasLiveHostWrites a producer, so the always-false wire is retired "
"wherever the record arm is built; PinLiveHostWritesNamesABuffer replaces it";
#elif !MGTEST_HAVE_FORK
GTEST_SKIP() << "no fork on this platform; the wire's verdict is std::abort()";
#else
ApplierGuard guard;
const MGPipeHandle res{8, 4};
const Uint8 bytes[64] = {};
MGPipeApplyResourceCreate(BufferDesc(res, 0, 55));
MGPipeApplyResourceRespecify(BufferDesc(res, 256, 55), nullptr);
// The negative control: with the flag clear the same call is silent and answers
// normally, so what follows is the flag firing and not the call.
EXPECT_EQ(MGPipeApplyMapPersistent(BufferHandle(res), 256, bytes), nullptr);
EXPECT_EQ(ReadLog().find("PipeLiveHostWrites"), std::string::npos);
struct Drive {
MGPipeHandle Res;
const char* Call;
};
const Drive drives[] = {
{res, "map_persistent"}, {res, "resource_respecify"}, {res, "resource_subdata"},
{res, "resource_flush_range"}, {res, "resource_readback"},
};
for (const Drive& drive : drives) {
const ChildResult child = RunInChild([&drive, &bytes]() {
// Set in the CHILD: the parent's applier must stay honest for the next drive.
MGPipeApplier().Resources[drive.Res.Slot].HasLiveHostWrites = true;
const String call = drive.Call;
if (call == "map_persistent") {
MGPipeApplyMapPersistent(MGPHandleOnly{drive.Res, static_cast<Uint32>(MGPipeKind::Buffer), 0},
256, bytes);
} else if (call == "resource_respecify") {
MGPResourceDesc desc{};
desc.Resource = drive.Res;
desc.Width = 256;
desc.GlNameForDiag = 55;
MGPipeApplyResourceRespecify(desc, nullptr);
} else if (call == "resource_subdata") {
MGPSubData record{};
record.Res = drive.Res;
MGPipeSetSubDataBufferRange(record, 0, 64);
MGPipeApplyResourceSubData(record, bytes);
} else if (call == "resource_flush_range") {
MGPipeApplyResourceFlushRange(MGPFlushRange{drive.Res, 0, 64, 0, 0}, bytes);
} else {
MGPipeApplyResourceReadback(MGPReadback{drive.Res, 0, 256});
}
});
EXPECT_TRUE(DiedOfAbort(child))
<< drive.Call << ": " << DescribeStatus(child) << "; log: " << child.Log;
const std::string wanted =
std::string("Fatal{PipeLiveHostWrites} ") + drive.Call + " {slot=8, gen=4}";
EXPECT_NE(child.Log.find(wanted), std::string::npos)
<< "wanted \"" << wanted << "\"; log: " << child.Log;
}
#endif
}
@@ -529,14 +529,10 @@ TEST(ProgramArtifactsCodec, AVersionMismatchIsRefused) {
// TProgram, which is null for every archived instance by construction and points into an arena
// no archive owns. A codec arm for it would be a use-after-free waiting for a cache hit.
TEST(ProgramArtifactsCodec, TheTablesVisitEveryMemberExceptTheLiveProgram) {
#if MOBILEGL_BUILD_RECORD_ARM
// P7 OQ-8: 59 members, 58 visited. The 59th is still the live TProgram; the 58th is
// storageBlocks, which follows the record arm's guard (ProgramArtifacts.h).
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<LinkArtifacts>(), 58u);
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<StorageBlockReflection>(), 3u);
#else
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<LinkArtifacts>(), 57u);
#endif
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<SpirvArtifacts>(), 8u);
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<ResourceReflection>(), 14u);
EXPECT_EQ(ProgramArtifactsVisitedFieldCount<XfbVarying>(), 11u);
@@ -81,14 +81,10 @@ namespace {
EXPECT_EQ(CountFields<TypeFacts>(), 20u);
EXPECT_EQ(CountFields<ResourceReflection>(), 14u);
EXPECT_EQ(CountFields<XfbVarying>(), 11u);
#if MOBILEGL_BUILD_RECORD_ARM
// P7 OQ-8 added LinkArtifacts::storageBlocks and its own three-field table; since P13 W5
// the member follows the record arm (ProgramArtifacts.h), which every library builds.
EXPECT_EQ(CountFields<StorageBlockReflection>(), 3u);
EXPECT_EQ(CountFields<LinkArtifacts>(), 58u);
#else
EXPECT_EQ(CountFields<LinkArtifacts>(), 57u);
#endif
EXPECT_EQ(CountFields<SpirvArtifacts>(), 8u);
}
@@ -24,18 +24,14 @@ namespace MobileGL::MG_Test {
class ScopedMonolithFrontendArm {
public:
ScopedMonolithFrontendArm() : m_savedTable(MG_Backend::gBackendFunctionsTable) {
#if MOBILEGL_BUILD_RECORD_ARM
m_saved = MG_Config::MonolithTakesRecordArm;
MG_Config::MonolithTakesRecordArm = false;
if (MG_Config::Transport == MG_Config::TransportMode::Monolith && MG_Backend::pActiveBackendObject) {
MG_Backend::gBackendFunctionsTable = MG_Backend::pActiveBackendObject->GetBackendFunctions();
}
#endif
}
~ScopedMonolithFrontendArm() {
#if MOBILEGL_BUILD_RECORD_ARM
MG_Config::MonolithTakesRecordArm = m_saved;
#endif
MG_Backend::gBackendFunctionsTable = m_savedTable;
}
ScopedMonolithFrontendArm(const ScopedMonolithFrontendArm&) = delete;