jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

Remove usage of thread_local variable to support XCode #167

Closed ikavalio closed 8 years ago

ikavalio commented 8 years ago

I've refactored ThreadMap a little to get rid of thread_local variables. This is required to support version of clang shipped with XCode to fix #1 issue reported by @eljobe.

Also reference counting guards were added to ThreadMap to prevent heap corruption when get and remove for the same JNIenv happen simultaneously.

ikavalio commented 8 years ago

Latest commit added several new changes:

  1. Map (readers) is truly signal safe now (it assumes that atomics are lock-free as circular_queue does). I've placed lookup code to signal handler to speedup search.
  2. I've done some changes to memory ordering in circular_queue to make it as relaxed as possible.
  3. Improved 64 bit hashing function, since previous one was a complete disaster and almost all JNIenv's were hashed to the same bucket....
RichardWarburton commented 8 years ago

Thanks.