Created
May 30, 2020 18:47
-
-
Save ExpandingMan/de20e7a1800a83178149424cce7d669b to your computer and use it in GitHub Desktop.
a hack to turn on trace compiling while Julia is running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hacked_jlopts(jlopts::Base.JLOptions, str::String) | |
f = (n, arg) -> n == :trace_compile ? pointer(str) : arg | |
GC.@preserve str Base.JLOptions((f(n, getproperty(jlopts, n)) for n ∈ fieldnames(Base.JLOptions))...) | |
end | |
function hack_jlopts(str::String) | |
ptr = convert(Ptr{Base.JLOptions}, cglobal(:jl_options)) | |
jlopts = hacked_jlopts(Base.JLOptions(), str) | |
unsafe_store!(ptr, jlopts) | |
jlopts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment