diff --git a/src/Configuration.jl b/src/Configuration.jl index bc0dc8104c..04cfceb908 100644 --- a/src/Configuration.jl +++ b/src/Configuration.jl @@ -187,6 +187,7 @@ const CHECK_BOUNDS_DEFAULT = nothing const MATH_MODE_DEFAULT = nothing const STARTUP_FILE_DEFAULT = "no" const HISTORY_FILE_DEFAULT = "no" +const HEAP_SIZE_HINT_DEFAULT = nothing function roughly_the_number_of_physical_cpu_cores() # https://gist.github.com/fonsp/738fe244719cae820245aa479e7b4a8d @@ -233,6 +234,7 @@ These options will be passed as command line argument to newly launched processe - `inline::Union{Nothing,String} = $INLINE_DEFAULT` - `check_bounds::Union{Nothing,String} = $CHECK_BOUNDS_DEFAULT` - `math_mode::Union{Nothing,String} = $MATH_MODE_DEFAULT` +- `heap_size_hint::Union{Nothing,String} = $HEAP_SIZE_HINT_DEFAULT` - `startup_file::Union{Nothing,String} = "$STARTUP_FILE_DEFAULT"` By default, the startup file isn't loaded in notebooks. - `history_file::Union{Nothing,String} = "$HISTORY_FILE_DEFAULT"` By default, the history isn't loaded in notebooks. - `threads::Union{Nothing,String,Int} = default_number_of_threads()` @@ -253,6 +255,7 @@ These options will be passed as command line argument to newly launched processe inline::Union{Nothing,String} = INLINE_DEFAULT check_bounds::Union{Nothing,String} = CHECK_BOUNDS_DEFAULT math_mode::Union{Nothing,String} = MATH_MODE_DEFAULT + heap_size_hint::Union{Nothing,String} = HEAP_SIZE_HINT_DEFAULT # notebook specified options # the followings are different from @@ -319,6 +322,7 @@ function from_flat_kwargs(; inline::Union{Nothing,String} = INLINE_DEFAULT, check_bounds::Union{Nothing,String} = CHECK_BOUNDS_DEFAULT, math_mode::Union{Nothing,String} = MATH_MODE_DEFAULT, + heap_size_hint::Union{Nothing,String} = HEAP_SIZE_HINT_DEFAULT, startup_file::Union{Nothing,String} = STARTUP_FILE_DEFAULT, history_file::Union{Nothing,String} = HISTORY_FILE_DEFAULT, threads::Union{Nothing,String,Int} = default_number_of_threads(), @@ -370,6 +374,7 @@ function from_flat_kwargs(; inline, check_bounds, math_mode, + heap_size_hint, startup_file, history_file, threads, @@ -397,11 +402,16 @@ end function _convert_to_flags(options::CompilerOptions)::Vector{String} option_list = String[] + exclude_list = String[] + + if VERSION < v"1.9" + push!(exclude_list, "--heap-size-hint") + end for name in fieldnames(CompilerOptions) flagname = string("--", replace(String(name), "_" => "-")) value = getfield(options, name) - if value !== nothing + if value !== nothing && flagname ∉ exclude_list push!(option_list, string(flagname, "=", value)) end end diff --git a/test/Configuration.jl b/test/Configuration.jl index 37630b3847..452a3a2839 100644 --- a/test/Configuration.jl +++ b/test/Configuration.jl @@ -44,11 +44,10 @@ end end @testset "flag conversion" begin - @test _convert_to_flags(Configuration.CompilerOptions(threads="123")) == - ["--startup-file=no", "--history-file=no", "--threads=123"] + reference_flags = ["--startup-file=no", "--history-file=no", "--threads=123"] - @test _convert_to_flags(Configuration.CompilerOptions(threads=123)) == - ["--startup-file=no", "--history-file=no", "--threads=123"] + @test _convert_to_flags(Configuration.CompilerOptions(threads="123")) == reference_flags + @test _convert_to_flags(Configuration.CompilerOptions(threads=123)) == reference_flags @test _convert_to_flags(Configuration.CompilerOptions()) ⊇ ["--startup-file=no", "--history-file=no"]