Commit f74e6f9d authored by Camil Staps's avatar Camil Staps 🐧

Patch _system.abc correctly for callgraph profiling

parent 057a42f5
......@@ -76,6 +76,7 @@ PatchSystemABC ::
!Bool //
!Pathname //
!Bool //
!Bool
!*Files // Input filesystem
->
( !Bool //
......
......@@ -427,8 +427,8 @@ where
// patch abc file of system module for change in profiling settings
PatchSystemABC :: !Int !Bool !Pathname /*!Bool*/ !Bool !*Files -> (!Bool, !*Files)
PatchSystemABC version doPatch abcPath /*memoryProfile*/ timeProfile files
PatchSystemABC :: !Int !Bool !Pathname /*!Bool*/ !Bool !Bool !*Files -> (!Bool, !*Files)
PatchSystemABC version doPatch abcPath /*memoryProfile*/ timeProfile callgraphProfile files
| not doPatch
= (True, files)
# (opened, file, files)
......@@ -466,8 +466,14 @@ where
patchLine line
# (found, offset) = findOptionStringOffset line
| found
= (found, {copy line & /*[offset+NoMemoryProfileMask] = if memoryProfile '0' '1',*/
[offset+NoTimeProfileMask] = if timeProfile '0' '1'})
# line = copy line
//# line & [offset+NoMemoryProfileMask] = if memoryProfile '0' '1'
# line & [offset+NoTimeProfileMask] = if timeProfile '0' '1'
| offset+CallgraphProfileOffset < size line &&
(line.[offset+CallgraphProfileOffset]=='0' || line.[offset+CallgraphProfileOffset]=='1')
# line & [offset+CallgraphProfileOffset] = if callgraphProfile '1' '0'
= (True, line)
= (not callgraphProfile, line)
= (False, line)
copy array
......
......@@ -832,13 +832,15 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
= FI_GetFileInfo tp system_mdn abccache fileinfo ps
# wantstp = ao.profiling //&& (not co.neverTimeProfile)
# compile = /*mp <> info.abcOptions.abcMemoryProfile ||*/ wantstp <> modinfo.abcOptions.abcTimeProfile
# compile = /*mp <> info.abcOptions.abcMemoryProfile ||*/
wantstp <> modinfo.abcOptions.abcTimeProfile ||
ao.callgraphProfiling <> modinfo.abcOptions.abcCallgraphProfile
# lines = if (be_verbose && compile)
(Level3 ["["+++system_abc+++",]: compiled with different options"])
(Level3 [])
# ps = verboseInfo be_verbose lines ps
# (version,ps) = getCurrentVers ps
# (patched, ps) = accFiles (PatchSystemABC version compile full_sys /*ao.memoryProfiling*/ wantstp) ps
# (patched, ps) = accFiles (PatchSystemABC version compile full_sys /*ao.memoryProfiling*/ wantstp ao.callgraphProfiling) ps
| not patched
# line = Level3 ["Error: ["+++system_abc+++",]: could not be patched."]
# ps = showInfo line ps
......@@ -1143,12 +1145,14 @@ UpdateDependencies force mdn rest compinfo dircache ds ps`
# ps = showInfo line ps
= (ps, dircache, False, False, rest, compinfo, ds, False)
# wantstp = tp && (not co.neverTimeProfile)
# compile = /*mp <> info.abcOptions.abcMemoryProfile ||*/ wantstp <> info.abcOptions.abcTimeProfile
# compile = /*mp <> info.abcOptions.abcMemoryProfile ||*/
wantstp <> info.abcOptions.abcTimeProfile ||
ao.callgraphProfiling <> info.abcOptions.abcCallgraphProfile
# lines = (Level3 (if (verbose && compile) ["["+++module_name+++".abc,]: System module compiled with different options"] []))
# ps = verboseInfo verbose lines ps
| compile
# abcPath = ModuleDirAndNameToABCSystemPathname mdn
# (patched, ps) = accFiles (PatchSystemABC version True abcPath /*ao.memoryProfiling*/ wantstp) ps
# (patched, ps) = accFiles (PatchSystemABC version True abcPath /*ao.memoryProfiling*/ wantstp ao.callgraphProfiling) ps
| patched
# ((abcdate,fileinfo), ps)
= accFiles (FI_UpdateAbcDate module_name abcPath wantstp ds.fileinfo) ps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment