import assert from'node:assert/strict';import{compiledCandidate as baseCompiled,physicalCase as basePhysical,checked}from'./acquire-release-artifacts.mjs';import{progressSymbols}from'./smp-progress-capture.mjs'; export{artifact,checked,read}from'./acquire-release-artifacts.mjs'; export function compiledCandidate(candidate){const result=baseCompiled(candidate),{symbols,compiled}=result,image=checked(candidate.artifacts.image),start=symbols._image_start.address; const load=(name,s)=>{assert.ok(s,name);symbols[name]=s;const at=s.address-start;compiled[name]=at>=0&&at+s.size<=image.length?Buffer.from(image.subarray(at,at+s.size)):Buffer.alloc(s.size);if(at+s.size>image.length)assert.ok(s.address>=symbols.__bss_start.address&&s.address+s.size<=symbols.__bss_end.address);}; for(const[name,size]of Object.entries(progressSymbols)){assert.equal(symbols[name]?.size,size,name);load(name,symbols[name]);} for(const[key,parts]of[['progressCycle',['8progress5cycle']],['progressDrive',['8progress5drive']],['progressRound',['8progress5round']],['progressObserve',['8progress7observe']],['progressMonitor',['runtime12smp_progress','7Monitor7observe']]]){const names=Object.keys(symbols).filter(n=>parts.every(p=>n.includes(p))&&symbols[n].size>0);assert.equal(names.length,1,key);load(key,symbols[names[0]]);} // LLVM's outliner inserts one additional extraction in frameCycle and renames // the publication thunks. Bind these actual targets from the drive's BLs. for(const[key,at]of[['publicationReusableCall',724],['publicationBusyCall',880],['publicationClose',1576]]){const op=compiled.publicationDrive.readUInt32LE(at);assert.equal((op&0xfc000000)>>>0,0x94000000);const address=symbols.publicationDrive.address+at+((op<<6)>>4),names=Object.keys(symbols).filter(n=>n.startsWith('OUTLINED_FUNCTION_')&&symbols[n].address===address);assert.equal(names.length,1,key);load(key,symbols[names[0]]);} return result; } export function physicalCase(candidate,diagnostic){return{...basePhysical(candidate,diagnostic),...compiledCandidate(candidate),progress:diagnostic.progress};}