I’m writing a wrapper function for a macro, that can be invoked, for instance as
@snoopl "/tmp/a.txt" "/tmp/b.txt" println("Helloworld"). Now when trying to wrap it, it fails with the error
ERROR: UndefVarError: code_block not defined, which I imagine it means it is interpreting the argument code_block literally, as a symbol (see below). What’s the correct way to define it, and then to invoke it with an arbitrary code block?
a = "/tmp/a.txt"
b = "/tmp/b.txt"
@snoopl a b code_block
Source code: SnoopCompile.jl/snoopl.jl at master · timholy/SnoopCompile.jl · GitHub
I think I’ve managed to move forward by:
root = Base.Filesystem.tempname()
path_func_names = "$(root)_functions.txt"
path_llvm_timings = "$(root)_llvm.txt"
println("Function names: $(path_func_names), llvm timings: $(path_llvm_timings)")
@snoopl path_func_names path_llvm_timings $code_block
times, _ = SnoopCompile.read_snoopl(path_func_names, path_llvm_timings)
here the macro @macroexpand has been fundamental to debug the code. I still don’t really understand the differences between quote, esc and QuoteNode though?