| 150 | } |
| 151 | |
| 152 | void J9StackTraces::checkpoint(u64 counter, J9StackTraceNotification* notif) { |
| 153 | JNIEnv* self_env = loadAcquire(_self_env); |
| 154 | if (self_env == nullptr) { |
| 155 | // Sampler thread is not ready |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | JNIEnv* env = VM::jni(); |
| 160 | if (env != NULL && env != self_env) { |
| 161 | J9VMThread* vm_thread = (J9VMThread*)env; |
| 162 | uintptr_t flags = vm_thread->getAndSetFlag(J9_HALT_THREAD_INSPECTION); |
| 163 | if (flags & J9_HALT_THREAD_INSPECTION) { |
| 164 | // Thread is already scheduled for inspection, no need to notify again |
| 165 | return; |
| 166 | } else if (!(flags & J9_STOPPED)) { |
| 167 | vm_thread->setOverflowMark(); |
| 168 | notif->env = env; |
| 169 | notif->counter = counter; |
| 170 | if (write(_pipe[1], notif, notif->size()) > 0) { |
| 171 | return; |
| 172 | } |
| 173 | } |
| 174 | // Something went wrong - rollback |
| 175 | vm_thread->clearFlag(J9_HALT_THREAD_INSPECTION); |
| 176 | } |
| 177 | } |
nothing calls this directly
no test coverage detected