Verified Commit 894fccdb authored by Camil Staps's avatar Camil Staps 🚀

Add Application/Profile/Callgraph option to project files

parent 02bfb2a1
......@@ -12,7 +12,7 @@ import PmTypes
//ifWindows w o :== o
standardStaticLibraries :: !Processor !LinkMethod -> List String
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
:: CompilerProcessIds
......@@ -43,6 +43,7 @@ instance == CompilerMsg
:: ProjectCompilerOptions = {
pco_memory_profiling :: !Bool,
pco_time_profiling :: !Bool,
pco_callgraph_profiling :: !Bool,
pco_desc_exl :: !Bool,
pco_dynamics :: !Bool,
pco_link_dynamic :: !Bool
......
......@@ -59,10 +59,12 @@ standardStaticLibraries processor method
LM_Static -> (Nil)
LM_Dynamic -> (Nil)
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces profiling processor use_64_bit_processor
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces callgraph_profiling profiling processor use_64_bit_processor
| stack_traces
= ( MakeObjPathname processor "_startupTrace" :! rest)
| callgraph_profiling
= ( MakeObjPathname processor "_startupProfileGraph" :! rest)
| profiling
= ( MakeObjPathname processor "_startupProfile" :! rest)
// otherwise
......@@ -179,6 +181,7 @@ Compile cocl` use_compiler_process_psn write_module_times errwin typewin compile
compileOrCheckSyntax
project_compiler_options.pco_memory_profiling
project_compiler_options.pco_time_profiling
project_compiler_options.pco_callgraph_profiling
project_compiler_options.pco_link_dynamic
co
+++ " -sl"
......@@ -227,10 +230,10 @@ where
= ""
= " -clear_cache"
CompileStartCommand :: !String !Bool !(WindowFun *env) !CompileOrCheckSyntax !Pathname !(List Pathname) !Int !Bool !Bool !Bool
CompileStartCommand :: !String !Bool !(WindowFun *env) !CompileOrCheckSyntax !Pathname !(List Pathname) !Int !Bool !Bool !Bool !Bool
!CompilerOptions !Pathname !CompilerProcessIds !*env
-> (!Bool, !CompilerProcessIds,!*env) | FileEnv env
CompileStartCommand cocl write_module_times errwin compileOrCheckSyntax path paths slot projectMemoryProfiling projectTimeProfiling projectEagerOrDynamic
CompileStartCommand cocl write_module_times errwin compileOrCheckSyntax path paths slot projectMemoryProfiling projectTimeProfiling projectCallgraphProfiling projectEagerOrDynamic
co=:{CompilerOptions | listTypes} startupdir compiler_psns ps
# (cocl,compiler_full_path,signature) = mangleCompiler cocl startupdir
......@@ -254,6 +257,7 @@ where
compileOrCheckSyntax
projectMemoryProfiling
projectTimeProfiling
projectCallgraphProfiling
projectEagerOrDynamic
co
+++ " -sl"
......@@ -354,8 +358,8 @@ ReadErrorAndWarningMessages file
= (if is_import_error (Patherror path) path_error,True,Strip string:!errlist,file3)
MakeCompilerOptionsString :: !CompileOrCheckSyntax !Bool !Bool !Bool !CompilerOptions -> String
MakeCompilerOptionsString compileOrCheckSyntax projectMemoryProfiling projectTimeProfiling projectEagerOrDynamic
MakeCompilerOptionsString :: !CompileOrCheckSyntax !Bool !Bool !Bool !Bool !CompilerOptions -> String
MakeCompilerOptionsString compileOrCheckSyntax projectMemoryProfiling projectTimeProfiling projectCallgraphProfiling projectEagerOrDynamic
{neverMemoryProfile, neverTimeProfile,sa,gw,gc,listTypes,attr,reuseUniqueNodes}
= options
where
......@@ -368,6 +372,10 @@ where
| not neverTimeProfile && projectTimeProfiling
= " -pt"
= ""
callgraphProfileSwitch
| not neverTimeProfile && projectCallgraphProfiling
= " -pg"
= ""
dynamicLinkSwitch
| projectEagerOrDynamic
= " -exl"
......@@ -405,7 +413,7 @@ where
= " -ou"
= ""
options = checksyntax +++ timeProfileSwitch +++ memoryProfileSwitch +++ dynamicLinkSwitch +++ strictness +++
options = checksyntax +++ timeProfileSwitch +++ callgraphProfileSwitch +++ memoryProfileSwitch +++ dynamicLinkSwitch +++ strictness +++
warnings +++ comments +++listtypes+++show_attr+++reuse+++" "
......
......@@ -26,6 +26,7 @@ import PmCallBack
:: ProjectCompilerOptions = {
pco_memory_profiling :: !Bool,
pco_time_profiling :: !Bool,
pco_callgraph_profiling :: !Bool,
pco_desc_exl :: !Bool,
pco_dynamics :: !Bool,
pco_generic_fusion :: !Bool,
......@@ -38,7 +39,7 @@ instance == CodeGenerateAsmOrCode
NoCompilerProcessIds :: CompilerProcessIds
standardStaticLibraries :: !Processor !LinkMethod -> List String
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
CompileHandleExitCode :: !Int !String !String !Int !(WindowFun *env) !(WindowFun *env) !ModuleDirAndName
......
......@@ -57,10 +57,11 @@ standardStaticLibraries :: !Processor !LinkMethod -> List String
standardStaticLibraries _ method
= Nil
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces profiling _ use_64_bit_processor
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces callgraph_profiling profiling _ use_64_bit_processor
#! startup_file = if stack_traces "_startupTrace.o"
(if profiling "_startupProfile.o" "_startup.o")
(if callgraph_profiling "_startupProfileGraph.o"
(if profiling "_startupProfile.o" "_startup.o"))
= (startup_file :! "_system.o" :! Nil)
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
......@@ -752,9 +753,9 @@ concat_args [arg:args] = arg+++" "+++concat_args args
makeCompilerOptionsArguments :: !CompileOrCheckSyntax !Bool !ProjectCompilerOptions !CompilerOptions -> [String]
makeCompilerOptionsArguments compileOrCheckSyntax write_module_times
{pco_memory_profiling,pco_time_profiling,pco_desc_exl,pco_dynamics,pco_generic_fusion,pco_link_dynamic}
{pco_memory_profiling,pco_time_profiling,pco_callgraph_profiling,pco_desc_exl,pco_dynamics,pco_generic_fusion,pco_link_dynamic}
{neverMemoryProfile,neverTimeProfile,sa,gw,gc,listTypes,attr,reuseUniqueNodes,fusion}
= write_module_times_arg ++ checksyntax ++ timeProfileSwitch ++ memoryProfileSwitch ++ descExlSwitch ++ dynamicsSwitch
= write_module_times_arg ++ checksyntax ++ timeProfileSwitch ++ callgraphProfileSwitch ++ memoryProfileSwitch ++ descExlSwitch ++ dynamicsSwitch
++ strictness ++ warnings ++ comments ++ listtypes ++ show_attr ++ reuse ++ fusion_arg
where
write_module_times_arg
......@@ -769,6 +770,10 @@ where
| not neverTimeProfile && pco_time_profiling
= ["-pt"]
= []
callgraphProfileSwitch
| not neverTimeProfile && pco_callgraph_profiling
= ["-pg"]
= []
descExlSwitch = if (pco_desc_exl || pco_link_dynamic) ["-exl"] []
dynamicsSwitch = if (pco_dynamics || pco_link_dynamic) ["-dynamics"] []
strictness
......
......@@ -11,6 +11,7 @@ from PmDirCache import :: DirCache
:: ABCOptions =
{ abcDescriptors :: !Bool
, abcTimeProfile :: !Bool
, abcCallgraphProfile :: !Bool
, abcStrictnessAnalysis :: !Bool
, abcGiveWarnings :: !Bool //.
, abcExportLocalLabels :: !Bool
......
......@@ -22,6 +22,7 @@ from StdLibMisc import :: Date{..}, :: Time{..}
:: ABCOptions =
{ abcDescriptors :: !Bool
, abcTimeProfile :: !Bool
, abcCallgraphProfile :: !Bool
, abcStrictnessAnalysis :: !Bool
, abcGiveWarnings :: !Bool
, abcExportLocalLabels :: !Bool
......@@ -37,6 +38,7 @@ DefaultABCOptions :: ABCOptions;
DefaultABCOptions =
{ abcDescriptors = False
, abcTimeProfile = False
, abcCallgraphProfile = False
, abcStrictnessAnalysis = True
, abcGiveWarnings = False
, abcExportLocalLabels = False
......@@ -72,9 +74,10 @@ FusionOffset :== 9;
Abc64BitsOffset :==10;
DynamicsBitsOffset :==11;
GenericFusionOffset :==12;
CallgraphProfileOffset :==13;
MinimumNrOfOptions :== 9;
NrOfOptions :== 13;
NrOfOptions :== 14;
ParseABCInfoAndDependencies :: !Pathname !DATE !ABCCache !Files -> (!((!Bool, !Bool, !Int, !ABCOptions),(!List Modulename, !Maybe ModuleDate, !List ModuleDate, !List LinkObjFileName, !List LinkLibraryName),!ABCCache),!Files)
ParseABCInfoAndDependencies path date abccache files
......@@ -165,7 +168,8 @@ StringToCompilerOptions start end opt
abcFusion = start+FusionOffset<end && opt.[start+FusionOffset]=='1',
abcGenericFusion = start+GenericFusionOffset<end && opt.[start+GenericFusionOffset]=='1',
abc64Bits = start+Abc64BitsOffset<end && opt.[start+Abc64BitsOffset]=='1',
abcDynamics = start+DynamicsBitsOffset<end && opt.[start+DynamicsBitsOffset]=='1'
abcDynamics = start+DynamicsBitsOffset<end && opt.[start+DynamicsBitsOffset]=='1',
abcCallgraphProfile = start+CallgraphProfileOffset<end && opt.[start+CallgraphProfileOffset]=='1'
};
ProjectABCFile :: !Int !String -> Bool;
......
......@@ -898,7 +898,7 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
// runtime objects and dynamic libs
# stdl = Concat sys_libs (standardStaticLibraries tp lo.method)
# stdo = Concat sys_objs (standardObjectFiles ao.stack_traces ao.profiling tp use_64_bit_processor)
# stdo = Concat sys_objs (standardObjectFiles ao.stack_traces ao.callgraphProfiling ao.profiling tp use_64_bit_processor)
# (stdoOk,ofiles,abcPathsCache, ps)
= case ao.standard_rte of
True -> GetPathNames (Map (\x->("", x)) stdo) Nil srcpaths abcPathsCache ps
......@@ -1207,6 +1207,7 @@ UpdateDependencies force mdn rest compinfo dircache ds ps`
# project_compiler_options = { pco_memory_profiling=ao.memoryProfiling,
pco_time_profiling=ao.profiling,
pco_callgraph_profiling=ao.callgraphProfiling,
pco_desc_exl=ao.desc_exl,
pco_dynamics=ao.dynamics,
pco_generic_fusion=ao.generic_fusion,
......@@ -1368,6 +1369,7 @@ CTPMcommon module_name project ps
# link_dynamic = case (PR_GetLinkOptions project).method of LM_Static -> False; LM_Dynamic -> True
# project_compiler_options = { pco_memory_profiling=ao.memoryProfiling,
pco_time_profiling=ao.profiling,
pco_callgraph_profiling=ao.callgraphProfiling,
pco_desc_exl=ao.desc_exl,
pco_dynamics=ao.dynamics,
pco_generic_fusion=ao.generic_fusion,
......@@ -1516,6 +1518,8 @@ check_module_options modname info=:{version,abcOptions} co project_compiler_opti
= incorrect_option modname "Export local labels or link dynamic"
| abcOptions.abcTimeProfile <> expectedTimeProfile
= incorrect_option modname "Time Profiling"
| abcOptions.abcCallgraphProfile <> expectedCallgraphProfile
= incorrect_option modname "Callgraph Profiling"
| abcOptions.abcDescriptors <> expectedDescriptors
= incorrect_option modname "Generate descriptors or heap profiling"
| abcOptions.abcStrictnessAnalysis <> expectedStrictnessAnalysis
......@@ -1535,6 +1539,7 @@ check_module_options modname info=:{version,abcOptions} co project_compiler_opti
where
expectedDescriptors = project_compiler_options.pco_desc_exl || project_compiler_options.pco_link_dynamic || (project_compiler_options.pco_memory_profiling && (not co.neverMemoryProfile))
expectedTimeProfile = project_compiler_options.pco_time_profiling && (not co.neverTimeProfile)
expectedCallgraphProfile = project_compiler_options.pco_callgraph_profiling
expectedStrictnessAnalysis = co.sa
expectedExportLocalLabels = project_compiler_options.pco_desc_exl || project_compiler_options.pco_link_dynamic
expectedGenerateComments = co.gc
......
......@@ -373,6 +373,7 @@ ApplicationProfileOptionsTable =
SimpleOption "Memory" (\a->a.memoryProfiling) (\v a->{a & memoryProfiling=v}),
SimpleOption "MemoryMinimumHeapSize" (\a->a.memoryProfilingMinimumHeapSize) (\v a->{a & memoryProfilingMinimumHeapSize=v}),
SimpleOption "Time" (\a->a.profiling) (\v a->{a & profiling=v}),
SimpleOption "Callgraph" (\a->a.callgraphProfiling) (\v a->{a & callgraphProfiling=v}),
SimpleOption "Stack" (\a->a.stack_traces) (\v a->{a & stack_traces=v}),
SimpleOption "Dynamics" (\a->a.dynamics) (\v a->{a & dynamics=v}),
SimpleOption "GenericFusion" (\a->a.generic_fusion) (\v a->{a & generic_fusion=v}),
......
......@@ -133,6 +133,7 @@ DefCodeGenOptions :: CodeGenOptions
, memoryProfiling :: !Bool
, memoryProfilingMinimumHeapSize :: !Int
, profiling :: !Bool // time profiling
, callgraphProfiling :: !Bool
, stack_traces :: !Bool // stack traces
, dynamics :: !Bool
, generic_fusion :: !Bool
......
......@@ -329,6 +329,7 @@ DefCodeGenOptions =
, memoryProfiling :: !Bool
, memoryProfilingMinimumHeapSize :: !Int
, profiling :: !Bool
, callgraphProfiling :: !Bool
, stack_traces :: !Bool
, dynamics :: !Bool
, generic_fusion :: !Bool
......@@ -356,6 +357,7 @@ DefApplicationOptions =
, memoryProfiling = False
, memoryProfilingMinimumHeapSize = 0
, profiling = False
, callgraphProfiling = False
, stack_traces = False
, dynamics = False
, generic_fusion = False
......
......@@ -27,6 +27,7 @@ import PmCallBack
:: ProjectCompilerOptions = {
pco_memory_profiling :: !Bool,
pco_time_profiling :: !Bool,
pco_callgraph_profiling :: !Bool,
pco_desc_exl :: !Bool,
pco_dynamics :: !Bool,
pco_generic_fusion :: !Bool,
......@@ -39,7 +40,7 @@ instance == CodeGenerateAsmOrCode
NoCompilerProcessIds :: CompilerProcessIds
standardStaticLibraries :: !Processor !LinkMethod -> List String
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
CompileHandleExitCode :: !Int !String !String !Int !(WindowFun *env) !(WindowFun *env) !ModuleDirAndName
......
......@@ -57,10 +57,11 @@ standardStaticLibraries :: !Processor !LinkMethod -> List String
standardStaticLibraries _ method
= Nil
standardObjectFiles :: !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces profiling _ use_64_bit_processor
standardObjectFiles :: !Bool !Bool !Bool !Processor !Bool -> List String
standardObjectFiles stack_traces callgraph_profiling profiling _ use_64_bit_processor
#! startup_file = if stack_traces "_startupTrace.o"
(if profiling "_startupProfile.o" "_startup.o")
(if callgraph_profiling "_startupProfileGraph.o"
(if profiling "_startupProfile.o" "_startup.o"))
= (startup_file :! "_system.o" :! Nil)
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
......@@ -788,9 +789,9 @@ concat_args [arg:args] = arg+++" "+++concat_args args
makeCompilerOptionsArguments :: !CompileOrCheckSyntax !Bool !ProjectCompilerOptions !CompilerOptions -> [String]
makeCompilerOptionsArguments compileOrCheckSyntax write_module_times
{pco_memory_profiling,pco_time_profiling,pco_desc_exl,pco_dynamics,pco_generic_fusion,pco_link_dynamic}
{pco_memory_profiling,pco_time_profiling,pco_callgraph_profiling,pco_desc_exl,pco_dynamics,pco_generic_fusion,pco_link_dynamic}
{neverMemoryProfile,neverTimeProfile,sa,gw,gc,listTypes,attr,reuseUniqueNodes,fusion}
= write_module_times_arg ++ checksyntax ++ timeProfileSwitch ++ memoryProfileSwitch ++ descExlSwitch ++ dynamicsSwitch
= write_module_times_arg ++ checksyntax ++ timeProfileSwitch ++ callgraphProfileSwitch ++ memoryProfileSwitch ++ descExlSwitch ++ dynamicsSwitch
++ strictness ++ warnings ++ comments ++ listtypes ++ show_attr ++ reuse ++ fusion_arg
where
write_module_times_arg
......@@ -805,6 +806,10 @@ where
| not neverTimeProfile && pco_time_profiling
= ["-pt"]
= []
callgraphProfileSwitch
| not neverTimeProfile && pco_callgraph_profiling
= ["-pg"]
= []
descExlSwitch = if (pco_desc_exl || pco_link_dynamic) ["-exl"] []
dynamicsSwitch = if (pco_dynamics || pco_link_dynamic) ["-dynamics"] []
strictness
......
......@@ -42,6 +42,7 @@ instance == CompilerMsg
:: ProjectCompilerOptions = {
pco_memory_profiling :: !Bool,
pco_time_profiling :: !Bool,
pco_callgraph_profiling :: !Bool,
pco_desc_exl :: !Bool,
pco_dynamics :: !Bool,
pco_generic_fusion :: !Bool,
......
......@@ -162,6 +162,7 @@ where
:: ProjectCompilerOptions = {
pco_memory_profiling :: !Bool,
pco_time_profiling :: !Bool,
pco_callgraph_profiling :: !Bool,
pco_desc_exl :: !Bool,
pco_dynamics :: !Bool,
pco_generic_fusion :: !Bool,
......@@ -465,10 +466,10 @@ ReadErrorAndWarningMessages file
MakeCompilerOptionsString :: !CompileOrCheckSyntax !ProjectCompilerOptions !CompilerOptions -> String
MakeCompilerOptionsString compileOrCheckSyntax
{pco_memory_profiling,pco_time_profiling,pco_desc_exl,pco_generic_fusion,pco_dynamics,pco_link_dynamic}
{pco_memory_profiling,pco_time_profiling,pco_callgraph_profiling,pco_desc_exl,pco_generic_fusion,pco_dynamics,pco_link_dynamic}
{neverMemoryProfile, neverTimeProfile,sa,gw,gc,listTypes,attr,reuseUniqueNodes,fusion}
= (add_dynamics_option (add_fusion_option (add_exl_option
(checksyntax +++ timeProfileSwitch +++ memoryProfileSwitch +++ strictness +++ warnings +++ comments +++listtypes+++show_attr+++reuse)
(checksyntax +++ timeProfileSwitch +++ callgraphProfileSwitch +++ memoryProfileSwitch +++ strictness +++ warnings +++ comments +++listtypes+++show_attr+++reuse)
))) +++" "
where
memoryProfileSwitch
......@@ -479,6 +480,10 @@ where
| not neverTimeProfile && pco_time_profiling
= " -pt"
= ""
callgraphProfileSwitch
| not neverTimeProfile && pco_callgraph_profiling
= " -pg"
= ""
strictness
| sa
= ""
......
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