mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-17 15:03:25 +09:00
[Feature] (P13 W5 S7): the record arm is built into every library, so monolith without MG_Remote runs it too.
This commit is contained in:
+5
-9
@@ -554,15 +554,11 @@ if (MOBILEGL_BUILD_DISAGGREGATED AND
|
||||
endif()
|
||||
|
||||
# P13 W5 (notes/p13/W5-DESIGN.md): THE RECORD ARM'S OWN GUARD. A plain variable, not an option and
|
||||
# not a cache entry, so no build tree can keep a stale value (W3a's lesson): it equals
|
||||
# MOBILEGL_BUILD_DISAGGREGATED while the record arm's guards are reclassified one by one - every
|
||||
# such commit leaves both library shapes byte-identical - and one later commit sets it on for every
|
||||
# build (the library without MG_Remote then runs the record arm). Always defined, to 0 or 1.
|
||||
if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
set(MOBILEGL_BUILD_RECORD_ARM ON)
|
||||
else()
|
||||
set(MOBILEGL_BUILD_RECORD_ARM OFF)
|
||||
endif()
|
||||
# not a cache entry, so no build tree can keep a stale value (W3a's lesson). It equalled
|
||||
# MOBILEGL_BUILD_DISAGGREGATED while the record arm's guards were reclassified one by one; since S7
|
||||
# it is on for every build, so the library without MG_Remote (the FCL-embedded one) runs the record
|
||||
# arm too. S8 removes the variable and the guards it still names. Always defined, to 0 or 1.
|
||||
set(MOBILEGL_BUILD_RECORD_ARM ON)
|
||||
|
||||
message(STATUS "MobileGL: PipeInputs push ON, appending the MGPipe fill sources")
|
||||
list(APPEND SOURCE_FILES
|
||||
|
||||
@@ -40,11 +40,17 @@ def build_proof(build, mode):
|
||||
raise RuntimeError('library appears stripped; symbol absence would prove nothing')
|
||||
remote = sum('MG_Remote' in line for line in symbols.splitlines())
|
||||
applier = sum('MGPipeApply' in line for line in symbols.splitlines())
|
||||
if (mode == 'disaggregated' and (not remote or not applier)) or (mode == 'monolith' and remote):
|
||||
raise RuntimeError(f'{mode} symbol mismatch: MG_Remote={remote}, MGPipeApply={applier}')
|
||||
# P13 W5 (D6): THE POSITIVE HALF. Both shapes run the record arm, so both must carry its code
|
||||
# (namespace MG_Record: the verb port, the record verb sink, the staged stores). Without this
|
||||
# a monolith library that silently stopped compiling the record arm would still pass on
|
||||
# "no MG_Remote" alone.
|
||||
record = sum('MG_Record' in line for line in symbols.splitlines())
|
||||
if (mode == 'disaggregated' and (not remote or not applier)) or (mode == 'monolith' and remote) or not record:
|
||||
raise RuntimeError(f'{mode} symbol mismatch: MG_Remote={remote}, MGPipeApply={applier}, MG_Record={record}')
|
||||
return {'mode': mode, 'source_sha': subprocess.check_output(['git', '-C', str(ROOT), 'rev-parse', 'HEAD'], text=True).strip(),
|
||||
'library': str(library), 'sha256': hashlib.sha256(library.read_bytes()).hexdigest(),
|
||||
'defined_symbols': len(symbols.splitlines()), 'remote_symbols': remote, 'applier_symbols': applier,
|
||||
'record_symbols': record,
|
||||
'production_compilation': definitions}
|
||||
|
||||
|
||||
@@ -122,9 +128,11 @@ def self_test():
|
||||
else:
|
||||
raise AssertionError('missing server log passed the runtime log proof')
|
||||
(build / 'libMobileGL.so').write_bytes(b'checker fixture, not a real runtime')
|
||||
normal = ''.join(f'00000000 T fixture{i}\n' for i in range(1000))
|
||||
bare = ''.join(f'00000000 T fixture{i}\n' for i in range(1000))
|
||||
normal = bare + '00000000 T MG_Record_fixture\n'
|
||||
pushed = normal + '00000000 T MGPipeApply_fixture\n'
|
||||
remote = pushed + '00000000 T MG_Remote_fixture\n'
|
||||
unrecorded = bare + '00000000 T MGPipeApply_fixture\n00000000 T MG_Remote_fixture\n'
|
||||
for mode, flags, symbols, succeeds in (
|
||||
('monolith', '', normal, True),
|
||||
('monolith', '-DMOBILEGL_PIPE_PUSH=1', pushed, True),
|
||||
@@ -136,6 +144,9 @@ def self_test():
|
||||
('monolith', '', remote, False),
|
||||
('monolith', '-DMOBILEGL_BUILD_DISAGGREGATED=1', pushed, False),
|
||||
('monolith', '', '00000000 T stripped\n', False),
|
||||
# P13 W5 (D6): a library without the record arm is red in either shape.
|
||||
('monolith', '', bare + '00000000 T MGPipeApply_fixture\n', False),
|
||||
('disaggregated', '-DMOBILEGL_BUILD_DISAGGREGATED=1', unrecorded, False),
|
||||
):
|
||||
(build / 'compile_commands.json').write_text(json.dumps([
|
||||
{'file': '/fixture/MobileGL/ConfigLoader.cpp', 'command': f'clang++ {flags} -c ConfigLoader.cpp'}]))
|
||||
|
||||
Reference in New Issue
Block a user