Verified Commit ca2c9481 authored by Camil Staps's avatar Camil Staps
Browse files

Add options for ABC optimisation, bytecode generation and bytecode linking

parent ee702065
...@@ -63,6 +63,9 @@ getCurrentSlibs :: !*GeneralSt -> (!(List String),!*GeneralSt) ...@@ -63,6 +63,9 @@ getCurrentSlibs :: !*GeneralSt -> (!(List String),!*GeneralSt)
getCurrentObjts :: !*GeneralSt -> (!(List String),!*GeneralSt) getCurrentObjts :: !*GeneralSt -> (!(List String),!*GeneralSt)
getCurrentComp :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentComp :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentCgen :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentCgen :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentAbcOpt :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBCgen :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBClink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentDynl :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentDynl :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentVers :: !*GeneralSt -> (!Int,!*GeneralSt) getCurrentVers :: !*GeneralSt -> (!Int,!*GeneralSt)
......
...@@ -178,6 +178,21 @@ getCurrentCgen ps ...@@ -178,6 +178,21 @@ getCurrentCgen ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_cgen,ps) = (ct.target_cgen,ps)
getCurrentAbcOpt :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentAbcOpt ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_abcopt,ps)
getCurrentBCgen :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBCgen ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bcgen,ps)
getCurrentBClink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBClink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bclink,ps)
getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentLink ps getCurrentLink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
......
...@@ -179,6 +179,9 @@ getCurrentObjts :: !*(PSt *General) -> (!(List String),!*PSt *General) ...@@ -179,6 +179,9 @@ getCurrentObjts :: !*(PSt *General) -> (!(List String),!*PSt *General)
getCurrentComp :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentComp :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentCgen :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General) getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General)
......
...@@ -440,6 +440,21 @@ getCurrentCgen ps ...@@ -440,6 +440,21 @@ getCurrentCgen ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_cgen,ps) = (ct.target_cgen,ps)
getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentAbcOpt ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_abcopt,ps)
getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCgen ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bcgen,ps)
getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBClink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bclink,ps)
getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentLink ps getCurrentLink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
......
...@@ -20,6 +20,8 @@ import PmAbcMagic,PmFileInfo,PmDirCache ...@@ -20,6 +20,8 @@ import PmAbcMagic,PmFileInfo,PmDirCache
import Platform import Platform
from StdLibMisc import :: Date{..}, :: Time{..} from StdLibMisc import :: Date{..}, :: Time{..}
import System.Process
verboseInfo verbose info ps :== verbi verbose info ps verboseInfo verbose info ps :== verbi verbose info ps
where where
verbi verbose info ps verbi verbose info ps
...@@ -813,6 +815,8 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj ...@@ -813,6 +815,8 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
# ps = showInfo line ps # ps = showInfo line ps
= continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps)
# ps = if (PR_GetByteCodePath project <> "") (ByteCodeLink fileinfo project ps) ps
# execpath = PR_GetExecPath project # execpath = PR_GetExecPath project
# prj_path` = PR_GetRootDir project # prj_path` = PR_GetRootDir project
# execpath = fulPath app_path prj_path` execpath # execpath = fulPath app_path prj_path` execpath
...@@ -1461,6 +1465,8 @@ GenCodeTheProjectModule :: !Bool !Bool !CodeGenerateAsmOrCode !ModuleDirAndName ...@@ -1461,6 +1465,8 @@ GenCodeTheProjectModule :: !Bool !Bool !CodeGenerateAsmOrCode !ModuleDirAndName
GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinfo project ps GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinfo project ps
# module_name = mdn.mdn_name # module_name = mdn.mdn_name
# (proc,ps) = getCurrentProc ps # (proc,ps) = getCurrentProc ps
# cgo = PR_GetCodeGenOptions project
# ps = if cgo.generate_bytecode (ByteCodeGen mdn abc_path project ps) ps
# ((info,abccache,fileinfo), ps) = FI_GetFileInfo proc mdn abccache fileinfo ps # ((info,abccache,fileinfo), ps) = FI_GetFileInfo proc mdn abccache fileinfo ps
| not outofdate | not outofdate
= (ps,abccache,fileinfo,project,True,info.objpath) = (ps,abccache,fileinfo,project,True,info.objpath)
...@@ -1472,7 +1478,6 @@ GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinf ...@@ -1472,7 +1478,6 @@ GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinf
ao = PR_GetApplicationOptions project ao = PR_GetApplicationOptions project
timeprofile = ao.profiling && (not neverTimeProfile) timeprofile = ao.profiling && (not neverTimeProfile)
obj_path = ModuleDirAndNameToObjSystemPathname proc mdn obj_path = ModuleDirAndNameToObjSystemPathname proc mdn
cgo = PR_GetCodeGenOptions project
# (obj_path,res,compiler_process_ids,ps) = CodeGen cgen use_compiler_process_ids updateErrorWindow genAsmOrCode abc_path obj_path timeprofile cgo proc ao startupdir compiler_process_ids ps # (obj_path,res,compiler_process_ids,ps) = CodeGen cgen use_compiler_process_ids updateErrorWindow genAsmOrCode abc_path obj_path timeprofile cgo proc ao startupdir compiler_process_ids ps
# ps = setCompilerProcessIds compiler_process_ids ps # ps = setCompilerProcessIds compiler_process_ids ps
| genAsmOrCode == CodeGeneration && res | genAsmOrCode == CodeGeneration && res
...@@ -1652,3 +1657,52 @@ where ...@@ -1652,3 +1657,52 @@ where
# (startupdir,ps) = getStup ps # (startupdir,ps) = getStup ps
# (_,ps) = ClearCompilerCache ccstring startupdir ps # (_,ps) = ClearCompilerCache ccstring startupdir ps
-> ps -> ps
//-- Bytecode generation and linking
ByteCodeGen :: !ModuleDirAndName !Pathname !Project !*GeneralSt -> *GeneralSt
ByteCodeGen mdn abc_path project ps
# (startupdir,ps) = getStup ps
(abcopt,ps) = getCurrentAbcOpt ps
abcopt = startupdir +++ DirSeparatorString +++ abcopt
(bcgen,ps) = getCurrentBCgen ps
bcgen = startupdir +++ DirSeparatorString +++ bcgen
# abcopt_path = abc_path % (0,size abc_path-4) +++ "opt.abc"
bc_path = abc_path % (0,size abc_path-4) +++ "bc"
# ps = showInfo (Level2 ("Optimising ABC for '" +++ mdn.mdn_name +++ "'.")) ps
# (h,w) = runProcess abcopt [abc_path,"-o",abcopt_path] Nothing ps.gst_world
| isError h = abort "failed to execute the ABC optimiser\n"
# (r,w) = waitForProcess (fromOk h) w
| isError r = abort "failed to wait for the ABC optimiser\n"
| fromOk r <> 0 = abort ("ABC optimiser failed with non-zero exit code " +++ toString (fromOk r) +++ "\n")
# ps & gst_world = w
# ps = showInfo (Level2 ("Generating bytecode for '" +++ mdn.mdn_name +++ "'.")) ps
# (h,w) = runProcess bcgen [abcopt_path,"-o",bc_path] Nothing ps.gst_world
| isError h = abort "failed to execute the bytecode generator\n"
# (r,w) = waitForProcess (fromOk h) w
| isError r = abort "failed to wait for the bytecode generator\n"
| fromOk r <> 0 = abort ("bytecode generator failed with non-zero exit code " +++ toString (fromOk r) +++ "\n")
# ps & gst_world = w
= ps
ByteCodeLink :: !FileInfoCache !Project !*GeneralSt -> *GeneralSt
ByteCodeLink fileinfo project ps
# (startupdir,ps) = getStup ps
(bclink,ps) = getCurrentBClink ps
bclink = startupdir +++ DirSeparatorString +++ bclink
# bcpath = fulPath startupdir (PR_GetRootDir project) (PR_GetByteCodePath project)
(abcpaths,fileinfo) = FI_GetAbcFiles fileinfo
abcpaths = [p % (0,size p-4) +++ "bc" \\ p <|- abcpaths]
# ps = showInfo (Level2 ("Linking bytecode for '" +++ RemovePath bcpath +++ "'")) ps
# (h,w) = runProcess bclink (abcpaths ++ ["-o",bcpath]) Nothing ps.gst_world
| isError h = abort "failed to execute the bytecode linker\n"
# (r,w) = waitForProcess (fromOk h) w
| isError r = abort "failed to wait for the bytecode linker\n"
| fromOk r <> 0 = abort ("bytecode linker failed with non-zero exit code " +++ toString (fromOk r) +++ "\n")
# ps & gst_world = w
= ps
...@@ -14,6 +14,9 @@ EnvsFileName :== "IDEEnvs" ...@@ -14,6 +14,9 @@ EnvsFileName :== "IDEEnvs"
, target_stat :: !List String // static libraries , target_stat :: !List String // static libraries
, target_comp :: !String // compiler , target_comp :: !String // compiler
, target_cgen :: !String // code generator , target_cgen :: !String // code generator
, target_abcopt :: !String // abc optimiser
, target_bcgen :: !String // bytecode generator
, target_bclink :: !String // bytecode linker
, target_link :: !String // static/eager linker , target_link :: !String // static/eager linker
, target_dynl :: !String // dynamic linker , target_dynl :: !String // dynamic linker
, target_vers :: !Int // abc version , target_vers :: !Int // abc version
......
...@@ -27,6 +27,9 @@ t_StdEnv ...@@ -27,6 +27,9 @@ t_StdEnv
, target_stat :: !List String // static libraries , target_stat :: !List String // static libraries
, target_comp :: !String // compiler , target_comp :: !String // compiler
, target_cgen :: !String // code generator , target_cgen :: !String // code generator
, target_abcopt :: !String // abc optimiser
, target_bcgen :: !String // bytecode generator
, target_bclink :: !String // bytecode linker
, target_link :: !String // static/eager linker , target_link :: !String // static/eager linker
, target_dynl :: !String // dynamic linker , target_dynl :: !String // dynamic linker
, target_vers :: !Int // abc version , target_vers :: !Int // abc version
...@@ -129,6 +132,9 @@ emptyTarget = ...@@ -129,6 +132,9 @@ emptyTarget =
, target_stat = Nil , target_stat = Nil
, target_comp = "" , target_comp = ""
, target_cgen = "" , target_cgen = ""
, target_abcopt = ""
, target_bcgen = ""
, target_bclink = ""
, target_link = "" , target_link = ""
, target_dynl = "" , target_dynl = ""
, target_vers = 42 , target_vers = 42
...@@ -159,6 +165,9 @@ TargetTable = ...@@ -159,6 +165,9 @@ TargetTable =
, ListOption "EnvironmentStaticLibs" (PathOption) "" (\a-> a.target_stat) (\v a->{a & target_stat= v}) , ListOption "EnvironmentStaticLibs" (PathOption) "" (\a-> a.target_stat) (\v a->{a & target_stat= v})
, SimpleOption "EnvironmentCompiler" (\a->a.target_comp) (\v a->{a & target_comp=v}) , SimpleOption "EnvironmentCompiler" (\a->a.target_comp) (\v a->{a & target_comp=v})
, SimpleOption "EnvironmentCodeGen" (\a->a.target_cgen) (\v a->{a & target_cgen=v}) , SimpleOption "EnvironmentCodeGen" (\a->a.target_cgen) (\v a->{a & target_cgen=v})
, SimpleOption "EnvironmentABCOptimise" (\a->a.target_abcopt) (\v a->{a & target_abcopt=v})
, SimpleOption "EnvironmentByteCodeGen" (\a->a.target_bcgen) (\v a->{a & target_bcgen=v})
, SimpleOption "EnvironmentByteCodeLink" (\a->a.target_bclink) (\v a->{a & target_bclink=v})
, SimpleOption "EnvironmentLinker" (\a->a.target_link) (\v a->{a & target_link=v}) , SimpleOption "EnvironmentLinker" (\a->a.target_link) (\v a->{a & target_link=v})
, SimpleOption "EnvironmentDynLink" (\a->a.target_dynl) (\v a->{a & target_dynl=v}) , SimpleOption "EnvironmentDynLink" (\a->a.target_dynl) (\v a->{a & target_dynl=v})
, SimpleOption "EnvironmentVersion" (\a->toString a.target_vers) (\v a->{a & target_vers=toInt v}) , SimpleOption "EnvironmentVersion" (\a->toString a.target_vers) (\v a->{a & target_vers=toInt v})
...@@ -196,6 +205,9 @@ t_StdEnv20 ...@@ -196,6 +205,9 @@ t_StdEnv20
, target_stat = Nil , target_stat = Nil
, target_comp = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "CleanCompiler.exe" "cocl" , target_comp = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "CleanCompiler.exe" "cocl"
, target_cgen = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "CodeGenerator.exe" "cg" , target_cgen = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "CodeGenerator.exe" "cg"
, target_abcopt = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ABCOptimiser.exe" "abcopt"
, target_bcgen = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeGenerator.exe" "bcgen"
, target_bclink = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeLinker.exe" "bclink"
, target_link = IF_MACOSX "/usr/bin/gcc" (compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "StaticLinker.exe" "linker") , target_link = IF_MACOSX "/usr/bin/gcc" (compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "StaticLinker.exe" "linker")
, target_dynl = "Tools"+++DirSeparatorString+++"Dynamics"+++DirSeparatorString+++"DynamicLinker.exe" , target_dynl = "Tools"+++DirSeparatorString+++"Dynamics"+++DirSeparatorString+++"DynamicLinker.exe"
, target_vers = 920 , target_vers = 920
...@@ -234,4 +246,4 @@ where ...@@ -234,4 +246,4 @@ where
libs` = symAppPaths stup libs libs` = symAppPaths stup libs
objs` = symAppPaths stup objs objs` = symAppPaths stup objs
stat` = symAppPaths stup stat stat` = symAppPaths stup stat
\ No newline at end of file
...@@ -25,6 +25,7 @@ FI_GetFileInfo :: !Processor !ModuleDirAndName !ABCCache !FileInfoCache !*env - ...@@ -25,6 +25,7 @@ FI_GetFileInfo :: !Processor !ModuleDirAndName !ABCCache !FileInfoCache !*env -
FI_UpdateAbcDate :: !Modulename !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files) FI_UpdateAbcDate :: !Modulename !Pathname !Bool !FileInfoCache !*Files -> ((!DATE,!FileInfoCache), !*Files)
FI_UpdateObjDate :: !Modulename !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files) FI_UpdateObjDate :: !Modulename !Pathname !FileInfoCache !*Files -> (!FileInfoCache, !*Files)
FI_UpdateFileInfo :: !Modulename !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache FI_UpdateFileInfo :: !Modulename !(FileInfo -> FileInfo) !FileInfoCache -> FileInfoCache
FI_GetAbcFiles :: !FileInfoCache -> (!List Pathname, !FileInfoCache)
FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache) FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache)
YoungestObj :: !DATE !FileInfoCache -> DATE YoungestObj :: !DATE !FileInfoCache -> DATE
...@@ -88,6 +88,11 @@ FI_UpdateObjDate module_name objPath fileInfo files ...@@ -88,6 +88,11 @@ FI_UpdateObjDate module_name objPath fileInfo files
fileInfo = FI_UpdateFileInfo module_name update fileInfo fileInfo = FI_UpdateFileInfo module_name update fileInfo
= (fileInfo,files) = (fileInfo,files)
FI_GetAbcFiles :: !FileInfoCache -> (!List Pathname, !FileInfoCache)
FI_GetAbcFiles fileinfo
# abcpaths = Map (\{abcpath}->abcpath) fileinfo
= (abcpaths,fileinfo)
FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache) FI_GetCleanModules :: !Pathname !StaticLibInfo !FileInfoCache -> (!List Pathname, !FileInfoCache)
FI_GetCleanModules system_obj_path libsinfo fileinfo FI_GetCleanModules system_obj_path libsinfo fileinfo
# clmodpaths = Map (\{objpath}->objpath) fileinfo # clmodpaths = Map (\{objpath}->objpath) fileinfo
......
...@@ -28,6 +28,7 @@ ProjectFileVersion :== "1.4" ...@@ -28,6 +28,7 @@ ProjectFileVersion :== "1.4"
, pg_staticLibInfo :: StaticLibInfo , pg_staticLibInfo :: StaticLibInfo
, pg_target :: String // specify used environment , pg_target :: String // specify used environment
, pg_execpath :: String // move to ApplicationOptions , pg_execpath :: String // move to ApplicationOptions
, pg_bytecode_path :: String
, pg_dynamic :: !ProjectDynamicInfo , pg_dynamic :: !ProjectDynamicInfo
, pg_root_directory :: !String , pg_root_directory :: !String
, pg_precompile :: !Maybe String // experiment: move to LinkOptions , pg_precompile :: !Maybe String // experiment: move to LinkOptions
......
...@@ -20,6 +20,7 @@ ProjectFileVersion :== "1.4" ...@@ -20,6 +20,7 @@ ProjectFileVersion :== "1.4"
, pg_staticLibInfo :: StaticLibInfo , pg_staticLibInfo :: StaticLibInfo
, pg_target :: String , pg_target :: String
, pg_execpath :: String , pg_execpath :: String
, pg_bytecode_path :: String
, pg_dynamic :: !ProjectDynamicInfo , pg_dynamic :: !ProjectDynamicInfo
, pg_root_directory :: !String , pg_root_directory :: !String
, pg_precompile :: !Maybe String , pg_precompile :: !Maybe String
...@@ -104,6 +105,7 @@ ProjectGlobalOptionsTable = ...@@ -104,6 +105,7 @@ ProjectGlobalOptionsTable =
{ project_root_option { project_root_option
, target_option , target_option
, SimpleWithStringConversionOption convert_exec_path_separators_and_extension "Exec" (\a->a.pg_execpath) (\v a->{a & pg_execpath=v}) , SimpleWithStringConversionOption convert_exec_path_separators_and_extension "Exec" (\a->a.pg_execpath) (\v a->{a & pg_execpath=v})
, SimpleWithStringConversionOption convert_path_separators "ByteCode" (\a->a.pg_bytecode_path) (\v a->{a & pg_bytecode_path=v})
, code_gen_option , code_gen_option
, application_option , application_option
, link_option , link_option
...@@ -297,9 +299,10 @@ CodeGenOptionsTable :: OptionsTable CodeGenOptions ...@@ -297,9 +299,10 @@ CodeGenOptionsTable :: OptionsTable CodeGenOptions
CodeGenOptionsTable = CodeGenOptionsTable =
{ {
SimpleOption "CheckStacks" (\a->a.cs) (\v a->{a & cs=v}), SimpleOption "CheckStacks" (\a->a.cs) (\v a->{a & cs=v}),
SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v}) SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v}),
// SimpleOption "KeepABC" (\a->a.kaf) (\v a->{a & kaf=v}), // SimpleOption "KeepABC" (\a->a.kaf) (\v a->{a & kaf=v}),
// SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v}) // SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v})
SimpleOption "GenerateByteCode" (\a->a.generate_bytecode) (\v a->{a & generate_bytecode=v})
} }
instance fromString Int instance fromString Int
......
...@@ -107,6 +107,8 @@ PR_SetTarget :: !String !Project -> Project ...@@ -107,6 +107,8 @@ PR_SetTarget :: !String !Project -> Project
PR_GetExecPath :: !Project -> String PR_GetExecPath :: !Project -> String
PR_SetExecPath :: !String !Project -> Project PR_SetExecPath :: !String !Project -> Project
PR_GetByteCodePath :: !Project -> String
SL_Add :: !String !StaticLibInfo -> StaticLibInfo SL_Add :: !String !StaticLibInfo -> StaticLibInfo
SL_Rem :: ![String] !String !String !StaticLibInfo -> StaticLibInfo SL_Rem :: ![String] !String !String !StaticLibInfo -> StaticLibInfo
SL_Libs :: !StaticLibInfo -> List String SL_Libs :: !StaticLibInfo -> List String
......
...@@ -41,6 +41,7 @@ Unmodified :== False; ...@@ -41,6 +41,7 @@ Unmodified :== False;
, relative_root_directory :: !String // string of '.'s, relative to .prj file , relative_root_directory :: !String // string of '.'s, relative to .prj file
, root_directory :: !String , root_directory :: !String
, execpath :: !String // move to app_opts , execpath :: !String // move to app_opts
, bytecode_path :: !String
, prec :: !Maybe String // " (precompile command) , prec :: !Maybe String // " (precompile command)
, posl :: !Maybe String // " (postlink command) , posl :: !Maybe String // " (postlink command)
} }
...@@ -76,6 +77,7 @@ PR_InitProject = ...@@ -76,6 +77,7 @@ PR_InitProject =
, root_directory = "" , root_directory = ""
, prec = Nothing , prec = Nothing
, posl = Nothing , posl = Nothing
, bytecode_path = EmptyPathname
} }
PR_GetExecPath :: !Project -> String PR_GetExecPath :: !Project -> String
...@@ -84,6 +86,9 @@ PR_GetExecPath {execpath} = execpath ...@@ -84,6 +86,9 @@ PR_GetExecPath {execpath} = execpath
PR_SetExecPath :: !String !Project -> Project PR_SetExecPath :: !String !Project -> Project
PR_SetExecPath pth prj = {prj & execpath = pth} PR_SetExecPath pth prj = {prj & execpath = pth}
PR_GetByteCodePath :: !Project -> String
PR_GetByteCodePath {bytecode_path} = bytecode_path
DefStaticLibInfo = DefStaticLibInfo =
{ sLibs = Nil { sLibs = Nil
, sDcls = Nil , sDcls = Nil
...@@ -589,7 +594,7 @@ SetProject applicationDir project_file_dir ...@@ -589,7 +594,7 @@ SetProject applicationDir project_file_dir
{ pg_codegen, pg_application { pg_codegen, pg_application
, pg_projectPaths, pg_link, pg_mainModuleInfo={name, info}, pg_otherModules , pg_projectPaths, pg_link, pg_mainModuleInfo={name, info}, pg_otherModules
, pg_target, pg_staticLibInfo, pg_execpath, pg_dynamic , pg_target, pg_staticLibInfo, pg_execpath, pg_dynamic
, pg_root_directory, pg_precompile, pg_postlink , pg_root_directory, pg_precompile, pg_postlink, pg_bytecode_path
} }
# project_dir = make_project_dir (size pg_root_directory) project_file_dir # project_dir = make_project_dir (size pg_root_directory) project_file_dir
# paths = ExpandPaths applicationDir project_dir pg_projectPaths # paths = ExpandPaths applicationDir project_dir pg_projectPaths
...@@ -600,13 +605,14 @@ SetProject applicationDir project_file_dir ...@@ -600,13 +605,14 @@ SetProject applicationDir project_file_dir
# project = PR_SetStaticLibsInfo staticLibInfo project # project = PR_SetStaticLibsInfo staticLibInfo project
# project = PR_SetTarget pg_target project # project = PR_SetTarget pg_target project
# exepath = ExpandPath applicationDir project_dir pg_execpath # exepath = ExpandPath applicationDir project_dir pg_execpath
# bytecode_path = if (pg_bytecode_path=="") "" (ExpandPath applicationDir project_dir pg_bytecode_path)
# project = PR_SetExecPath exepath project # project = PR_SetExecPath exepath project
// default of used appopts in exe are ok isn't right :-( // default of used appopts in exe are ok isn't right :-(
# pg_postlink = case pg_postlink of # pg_postlink = case pg_postlink of
Just post_link -> Just (ExpandPath applicationDir project_dir post_link) Just post_link -> Just (ExpandPath applicationDir project_dir post_link)
Nothing -> Nothing Nothing -> Nothing
= {project & relative_root_directory = pg_root_directory, root_directory = project_dir, dynamic_info = pg_dynamic, = {project & relative_root_directory = pg_root_directory, root_directory = project_dir, dynamic_info = pg_dynamic,
prec = pg_precompile, posl = pg_postlink} prec = pg_precompile, posl = pg_postlink, bytecode_path = bytecode_path}
where where
addModules Nil project_dir project addModules Nil project_dir project
= project = project
...@@ -636,6 +642,7 @@ GetProject applicationDir project ...@@ -636,6 +642,7 @@ GetProject applicationDir project
, pg_staticLibInfo = staticLibInfo , pg_staticLibInfo = staticLibInfo
, pg_target = target , pg_target = target
, pg_execpath = exepath project_dir , pg_execpath = exepath project_dir
, pg_bytecode_path = bytecodepath project_dir
, pg_dynamic = project.dynamic_info , pg_dynamic = project.dynamic_info
, pg_root_directory = project.relative_root_directory , pg_root_directory = project.relative_root_directory
, pg_precompile = project.prec , pg_precompile = project.prec
...@@ -645,6 +652,9 @@ where ...@@ -645,6 +652,9 @@ where
exepath project_dir exepath project_dir
# xp = PR_GetExecPath project # xp = PR_GetExecPath project
= symPath applicationDir project_dir xp = symPath applicationDir project_dir xp
bytecodepath project_dir
# bcp = PR_GetByteCodePath project
= if (bcp=="") "" (symPath applicationDir project_dir bcp)
getModule project_dir name getModule project_dir name
# info = PR_GetModuleInfo name project # info = PR_GetModuleInfo name project
......
...@@ -99,6 +99,7 @@ instance == EditOptions ...@@ -99,6 +99,7 @@ instance == EditOptions
, ci :: !Bool // generate index checks , ci :: !Bool // generate index checks
// , kaf :: !Bool // keep abc-files // , kaf :: !Bool // keep abc-files
// , tp :: !Processor // , tp :: !Processor
, generate_bytecode :: !Bool // generate ABC bytecode
} }
instance == CodeGenOptions instance == CodeGenOptions
......
...@@ -283,6 +283,7 @@ where ...@@ -283,6 +283,7 @@ where
, ci :: !Bool , ci :: !Bool
// , kaf :: !Bool // , kaf :: !Bool
// , tp :: !Processor // , tp :: !Processor
, generate_bytecode :: !Bool // generate ABC bytecode
} }
instance == CodeGenOptions instance == CodeGenOptions
...@@ -290,12 +291,14 @@ where ...@@ -290,12 +291,14 @@ where
(==) :: !CodeGenOptions !CodeGenOptions -> Bool (==) :: !CodeGenOptions !CodeGenOptions -> Bool
(==) cg1 cg2 (==) cg1 cg2
= cg1.cs == cg2.cs && = cg1.cs == cg2.cs &&
cg1.ci == cg2.ci cg1.ci == cg2.ci &&
cg1.generate_bytecode == cg2.generate_bytecode
DefCodeGenOptions :: CodeGenOptions; DefCodeGenOptions :: CodeGenOptions;
DefCodeGenOptions = DefCodeGenOptions =
{ cs = False { cs = False
, ci = True , ci = True
, generate_bytecode = False
} }
// The Application Options: default settings for the application. // The Application Options: default settings for the application.
......
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