-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow threadsafe access to buffer ot type inference profiling trees
Co-authored-by: Nathan Daly <[email protected]>
- Loading branch information
Showing
6 changed files
with
131 additions
and
66 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Implementation for type inference profiling | ||
|
||
#include "julia.h" | ||
#include "julia_internal.h" | ||
|
||
jl_mutex_t typeinf_profiling_lock; | ||
|
||
// == exported interface == | ||
|
||
extern "C" { | ||
|
||
JL_DLLEXPORT jl_array_t* jl_typeinf_profiling_clear_and_fetch( | ||
jl_array_t *inference_profiling_results_array, | ||
jl_value_t *array_timing_type | ||
) | ||
{ | ||
JL_LOCK(&typeinf_profiling_lock); | ||
|
||
size_t len = jl_array_len(inference_profiling_results_array); | ||
|
||
jl_array_t *out = jl_alloc_array_1d(array_timing_type, len); | ||
JL_GC_PUSH1(&out); | ||
|
||
memcpy(out->data, inference_profiling_results_array->data, len * sizeof(void*)); | ||
|
||
jl_array_del_end(inference_profiling_results_array, len); | ||
|
||
JL_UNLOCK(&typeinf_profiling_lock); | ||
|
||
JL_GC_POP(); | ||
return out; | ||
} | ||
|
||
JL_DLLEXPORT void jl_typeinf_profiling_push_timing( | ||
jl_array_t *inference_profiling_results_array, | ||
jl_value_t *timing | ||
) | ||
{ | ||
JL_LOCK(&typeinf_profiling_lock); | ||
|
||
jl_array_grow_end(inference_profiling_results_array, 1); | ||
size_t len = jl_array_len(inference_profiling_results_array); | ||
jl_array_ptr_set(inference_profiling_results_array, len - 1, timing); | ||
|
||
JL_UNLOCK(&typeinf_profiling_lock); | ||
} | ||
|
||
} // extern "C" |
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
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