Skip to content

Instantly share code, notes, and snippets.

@ExpandingMan
Created May 30, 2020 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ExpandingMan/de20e7a1800a83178149424cce7d669b to your computer and use it in GitHub Desktop.
Save ExpandingMan/de20e7a1800a83178149424cce7d669b to your computer and use it in GitHub Desktop.
a hack to turn on trace compiling while Julia is running
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