| 56 | } |
| 57 | |
| 58 | bool CpuEngine::setupThreadHook() { |
| 59 | if (_pthread_entry != NULL) { |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | if (!VM::loaded()) { |
| 64 | static void* dummy_pthread_entry; |
| 65 | _pthread_entry = &dummy_pthread_entry; |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | // Depending on Zing version, pthread_setspecific is called either from libazsys.so or from libjvm.so |
| 70 | if (VM::isZing()) { |
| 71 | CodeCache* libazsys = Profiler::instance()->findLibraryByName("libazsys"); |
| 72 | if (libazsys != NULL && (_pthread_entry = libazsys->findImport(im_pthread_setspecific)) != NULL) { |
| 73 | return true; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | CodeCache* lib = Profiler::instance()->findJvmLibrary("libj9thr"); |
| 78 | return lib != NULL && (_pthread_entry = lib->findImport(im_pthread_setspecific)) != NULL; |
| 79 | } |
| 80 | |
| 81 | void CpuEngine::enableThreadHook() { |
| 82 | *_pthread_entry = (void*)pthread_setspecific_hook; |
nothing calls this directly
no test coverage detected