Verified Commit 75200b87 authored by Camil Staps's avatar Camil Staps
Browse files

Patch _system.abc correctly for callgraph profiling

parent 057a42f5
...@@ -76,6 +76,7 @@ PatchSystemABC :: ...@@ -76,6 +76,7 @@ PatchSystemABC ::
!Bool // !Bool //
!Pathname // !Pathname //
!Bool // !Bool //
!Bool
!*Files // Input filesystem !*Files // Input filesystem
-> ->
( !Bool // ( !Bool //
......
...@@ -427,8 +427,8 @@ where ...@@ -427,8 +427,8 @@ where
// patch abc file of system module for change in profiling settings // patch abc file of system module for change in profiling settings
PatchSystemABC :: !Int !Bool !Pathname /*!Bool*/ !Bool !*Files -> (!Bool, !*Files) PatchSystemABC :: !Int !Bool !Pathname /*!Bool*/ !Bool !Bool !*Files -> (!Bool, !*Files)
PatchSystemABC version doPatch abcPath /*memoryProfile*/ timeProfile files PatchSystemABC version doPatch abcPath /*memoryProfile*/ timeProfile callgraphProfile files
| not doPatch | not doPatch
= (True, files) = (True, files)
# (opened, file, files) # (opened, file, files)
...@@ -466,8 +466,15 @@ where ...@@ -466,8 +466,15 @@ where
patchLine line patchLine line
# (found, offset) = findOptionStringOffset line # (found, offset) = findOptionStringOffset line
| found | found
= (found, {copy line & /*[offset+NoMemoryProfileMask] = if memoryProfile '0' '1',*/ # line = copy line
[offset+NoTimeProfileMask] = if timeProfile '0' '1'}) //# line & [offset+NoMemoryProfileMask] = if memoryProfile '0' '1'
# line & [offset+NoTimeProfileMask] = if timeProfile '0' '1'
| callgraphProfile
| offset+CallgraphProfileOffset >= size line-1
= (False, line)
# line & [offset+CallgraphProfileOffset] = if callgraphProfile '1' '0'
= (True, line)
= (True, line)
= (False, line) = (False, line)
copy array copy array
......
...@@ -832,13 +832,15 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj ...@@ -832,13 +832,15 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
= FI_GetFileInfo tp system_mdn abccache fileinfo ps = FI_GetFileInfo tp system_mdn abccache fileinfo ps
# wantstp = ao.profiling //&& (not co.neverTimeProfile) # 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) # lines = if (be_verbose && compile)
(Level3 ["["+++system_abc+++",]: compiled with different options"]) (Level3 ["["+++system_abc+++",]: compiled with different options"])
(Level3 []) (Level3 [])
# ps = verboseInfo be_verbose lines ps # ps = verboseInfo be_verbose lines ps
# (version,ps) = getCurrentVers 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 | not patched
# line = Level3 ["Error: ["+++system_abc+++",]: could not be patched."] # line = Level3 ["Error: ["+++system_abc+++",]: could not be patched."]
# ps = showInfo line ps # ps = showInfo line ps
...@@ -1143,12 +1145,14 @@ UpdateDependencies force mdn rest compinfo dircache ds ps` ...@@ -1143,12 +1145,14 @@ UpdateDependencies force mdn rest compinfo dircache ds ps`
# ps = showInfo line ps # ps = showInfo line ps
= (ps, dircache, False, False, rest, compinfo, ds, False) = (ps, dircache, False, False, rest, compinfo, ds, False)
# wantstp = tp && (not co.neverTimeProfile) # 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"] [])) # lines = (Level3 (if (verbose && compile) ["["+++module_name+++".abc,]: System module compiled with different options"] []))
# ps = verboseInfo verbose lines ps # ps = verboseInfo verbose lines ps
| compile | compile
# abcPath = ModuleDirAndNameToABCSystemPathname mdn # 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 | patched
# ((abcdate,fileinfo), ps) # ((abcdate,fileinfo), ps)
= accFiles (FI_UpdateAbcDate module_name abcPath wantstp ds.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