Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Perf JITEvents by default #37682

Merged
merged 3 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow users to enable GDB JIT integration on release builds
  • Loading branch information
vchuravy committed Sep 21, 2020
commit fdfac757dfff129eb92a731ddd5b668700541cca
6 changes: 6 additions & 0 deletions doc/src/manual/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ event listener for just-in-time (JIT) profiling.
* [OProfile](http:https://oprofile.sourceforge.net/news/) (`USE_OPROFILE_JITEVENTS` set to `1`
in the build configuration).

### `ENABLE_GDBLISTENER`

If set to anything besides `0` enables GDB registration of Julia code on release builds.
On debug builds of Julia this is always enabled. Recommended to use with `-g 2`.


### `JULIA_LLVM_ARGS`

Arguments to be passed to the LLVM backend.
Expand Down
7 changes: 3 additions & 4 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7728,10 +7728,9 @@ extern "C" void jl_init_llvm(void)
std::string DL = jl_data_layout.getStringRepresentation() + "-ni:10:11:12:13";
jl_data_layout.reset(DL);

// Register GDB event listener
#ifdef JL_DEBUG_BUILD
jl_ExecutionEngine->RegisterJITEventListener(JITEventListener::createGDBRegistrationListener());
#endif
// Register GDB event listener
if(jl_using_gdb_jitevents)
jl_ExecutionEngine->RegisterJITEventListener(JITEventListener::createGDBRegistrationListener());

#ifdef JL_USE_INTEL_JITEVENTS
if (jl_using_intel_jitevents)
Expand Down
11 changes: 11 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ char jl_using_oprofile_jitevents = 0; // Non-zero if running under OProfile
char jl_using_perf_jitevents = 0;
#endif

char jl_using_gdb_jitevents = 0;

int isabspath(const char *in) JL_NOTSAFEPOINT
{
#ifdef _OS_WINDOWS_
Expand Down Expand Up @@ -692,6 +694,15 @@ void _julia_init(JL_IMAGE_SEARCH rel)
}
#endif

#if defined(JL_DEBUG_BUILD)
jl_using_gdb_jitevents = 1;
# else
const char *jit_gdb = getenv("ENABLE_GDBLISTENER");
if (jit_gdb && atoi(jit_gdb)) {
jl_using_gdb_jitevents = 1;
}
#endif

if ((jl_options.outputo || jl_options.outputbc || jl_options.outputasm) &&
(jl_options.code_coverage || jl_options.malloc_log)) {
jl_error("cannot generate code-coverage or track allocation information while generating a .o, .bc, or .s output file");
Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ extern char jl_using_oprofile_jitevents;
#ifdef JL_USE_PERF_JITEVENTS
extern char jl_using_perf_jitevents;
#endif
extern char jl_using_gdb_jitevents;
extern size_t jl_arr_xtralloc_limit;

// -- init.c -- //
Expand Down