Commit 5b453ce9 authored by Camil Staps's avatar Camil Staps 🍃

make optimising abc optional

parent ca2c9481
......@@ -1466,7 +1466,8 @@ GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinf
# module_name = mdn.mdn_name
# (proc,ps) = getCurrentProc ps
# cgo = PR_GetCodeGenOptions project
# ps = if cgo.generate_bytecode (ByteCodeGen mdn abc_path project ps) ps
# ps = if cgo.optimise_abc (OptimiseABC mdn abc_path ps) ps
# ps = if cgo.generate_bytecode (ByteCodeGen cgo.optimise_abc mdn abc_path ps) ps
# ((info,abccache,fileinfo), ps) = FI_GetFileInfo proc mdn abccache fileinfo ps
| not outofdate
= (ps,abccache,fileinfo,project,True,info.objpath)
......@@ -1660,15 +1661,12 @@ where
//-- Bytecode generation and linking
ByteCodeGen :: !ModuleDirAndName !Pathname !Project !*GeneralSt -> *GeneralSt
ByteCodeGen mdn abc_path project ps
OptimiseABC :: !ModuleDirAndName !Pathname !*GeneralSt -> *GeneralSt
OptimiseABC mdn abc_path 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
......@@ -1677,9 +1675,18 @@ ByteCodeGen mdn abc_path project ps
| 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
ByteCodeGen :: !Bool !ModuleDirAndName !Pathname !*GeneralSt -> *GeneralSt
ByteCodeGen use_optimised_abc mdn abc_path ps
# (startupdir,ps) = getStup ps
(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 ("Generating bytecode for '" +++ mdn.mdn_name +++ "'.")) ps
# (h,w) = runProcess bcgen [abcopt_path,"-o",bc_path] Nothing ps.gst_world
# (h,w) = runProcess bcgen [if use_optimised_abc abcopt_path abc_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"
......
......@@ -298,10 +298,11 @@ CompilerOptionsTable =
CodeGenOptionsTable :: OptionsTable CodeGenOptions
CodeGenOptionsTable =
{
SimpleOption "CheckStacks" (\a->a.cs) (\v a->{a & cs=v}),
SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v}),
// SimpleOption "KeepABC" (\a->a.kaf) (\v a->{a & kaf=v}),
// SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v})
SimpleOption "CheckStacks" (\a->a.cs) (\v a->{a & cs=v}),
SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v}),
// SimpleOption "KeepABC" (\a->a.kaf) (\v a->{a & kaf=v}),
// SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v})
SimpleOption "OptimiseABC" (\a->a.optimise_abc) (\v a->{a & optimise_abc=v}),
SimpleOption "GenerateByteCode" (\a->a.generate_bytecode) (\v a->{a & generate_bytecode=v})
}
......
......@@ -95,11 +95,12 @@ instance == EditOptions
// The Code Generator Options: default settings for the code generator
:: CodeGenOptions =
{ cs :: !Bool // generate stack checks
, ci :: !Bool // generate index checks
// , kaf :: !Bool // keep abc-files
// , tp :: !Processor
, generate_bytecode :: !Bool // generate ABC bytecode
{ cs :: !Bool // generate stack checks
, ci :: !Bool // generate index checks
// , kaf :: !Bool // keep abc-files
// , tp :: !Processor
, optimise_abc :: !Bool // optimise ABC
, generate_bytecode :: !Bool // generate ABC bytecode
}
instance == CodeGenOptions
......
......@@ -278,12 +278,13 @@ where
// edit options, window pos&size
// The Code Generator Options: default settings for the code generator
:: CodeGenOptions =
{ cs :: !Bool
, ci :: !Bool
// , kaf :: !Bool
// , tp :: !Processor
, generate_bytecode :: !Bool // generate ABC bytecode
:: CodeGenOptions =
{ cs :: !Bool
, ci :: !Bool
// , kaf :: !Bool
// , tp :: !Processor
, optimise_abc :: !Bool
, generate_bytecode :: !Bool
}
instance == CodeGenOptions
......@@ -296,9 +297,10 @@ where
DefCodeGenOptions :: CodeGenOptions;
DefCodeGenOptions =
{ cs = False
, ci = True
{ cs = False
, ci = True
, generate_bytecode = False
, optimise_abc = False
}
// 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