28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/codeCache.hpp"
31 #include "jvmtifiles/jvmtiEnv.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "oops/instanceMirrorKlass.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/objArrayOop.inline.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiEventController.hpp"
38 #include "prims/jvmtiEventController.inline.hpp"
39 #include "prims/jvmtiExport.hpp"
40 #include "prims/jvmtiImpl.hpp"
41 #include "prims/jvmtiTagMap.hpp"
42 #include "runtime/biasedLocking.hpp"
43 #include "runtime/javaCalls.hpp"
44 #include "runtime/jniHandles.hpp"
45 #include "runtime/mutex.hpp"
46 #include "runtime/mutexLocker.hpp"
47 #include "runtime/reflectionUtils.hpp"
48 #include "runtime/vframe.hpp"
49 #include "runtime/vmThread.hpp"
50 #include "runtime/vm_operations.hpp"
51 #include "services/serviceUtil.hpp"
52 #include "utilities/macros.hpp"
53 #if INCLUDE_ALL_GCS
54 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
55 #include "gc/parallel/parallelScavengeHeap.hpp"
56 #endif // INCLUDE_ALL_GCS
57
58 // JvmtiTagHashmapEntry
59 //
60 // Each entry encapsulates a reference to the tagged object
61 // and the tag value. In addition an entry includes a next pointer which
62 // is used to chain entries together.
63
64 class JvmtiTagHashmapEntry : public CHeapObj<mtInternal> {
65 private:
66 friend class JvmtiTagMap;
67
3158 }
3159 }
3160
3161 vf = vf->sender();
3162 is_top_frame = false;
3163 }
3164 } else {
3165 // no last java frame but there may be JNI locals
3166 blk->set_context(thread_tag, tid, 0, (jmethodID)NULL);
3167 java_thread->active_handles()->oops_do(blk);
3168 }
3169 return true;
3170 }
3171
3172
3173 // Collects the simple roots for all threads and collects all
3174 // stack roots - for each thread it walks the execution
3175 // stack to find all references and local JNI refs.
3176 inline bool VM_HeapWalkOperation::collect_stack_roots() {
3177 JNILocalRootsClosure blk;
3178 for (JavaThread* thread = Threads::first(); thread != NULL ; thread = thread->next()) {
3179 oop threadObj = thread->threadObj();
3180 if (threadObj != NULL && !thread->is_exiting() && !thread->is_hidden_from_external_view()) {
3181 // Collect the simple root for this thread before we
3182 // collect its stack roots
3183 if (!CallbackInvoker::report_simple_root(JVMTI_HEAP_REFERENCE_THREAD,
3184 threadObj)) {
3185 return false;
3186 }
3187 if (!collect_stack_roots(thread, &blk)) {
3188 return false;
3189 }
3190 }
3191 }
3192 return true;
3193 }
3194
3195 // visit an object
3196 // first mark the object as visited
3197 // second get all the outbound references from this object (in other words, all
3198 // the objects referenced by this object).
|
28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/codeCache.hpp"
31 #include "jvmtifiles/jvmtiEnv.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "oops/instanceMirrorKlass.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/objArrayOop.inline.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiEventController.hpp"
38 #include "prims/jvmtiEventController.inline.hpp"
39 #include "prims/jvmtiExport.hpp"
40 #include "prims/jvmtiImpl.hpp"
41 #include "prims/jvmtiTagMap.hpp"
42 #include "runtime/biasedLocking.hpp"
43 #include "runtime/javaCalls.hpp"
44 #include "runtime/jniHandles.hpp"
45 #include "runtime/mutex.hpp"
46 #include "runtime/mutexLocker.hpp"
47 #include "runtime/reflectionUtils.hpp"
48 #include "runtime/thread.inline.hpp"
49 #include "runtime/threadSMR.hpp"
50 #include "runtime/vframe.hpp"
51 #include "runtime/vmThread.hpp"
52 #include "runtime/vm_operations.hpp"
53 #include "services/serviceUtil.hpp"
54 #include "utilities/macros.hpp"
55 #if INCLUDE_ALL_GCS
56 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
57 #include "gc/parallel/parallelScavengeHeap.hpp"
58 #endif // INCLUDE_ALL_GCS
59
60 // JvmtiTagHashmapEntry
61 //
62 // Each entry encapsulates a reference to the tagged object
63 // and the tag value. In addition an entry includes a next pointer which
64 // is used to chain entries together.
65
66 class JvmtiTagHashmapEntry : public CHeapObj<mtInternal> {
67 private:
68 friend class JvmtiTagMap;
69
3160 }
3161 }
3162
3163 vf = vf->sender();
3164 is_top_frame = false;
3165 }
3166 } else {
3167 // no last java frame but there may be JNI locals
3168 blk->set_context(thread_tag, tid, 0, (jmethodID)NULL);
3169 java_thread->active_handles()->oops_do(blk);
3170 }
3171 return true;
3172 }
3173
3174
3175 // Collects the simple roots for all threads and collects all
3176 // stack roots - for each thread it walks the execution
3177 // stack to find all references and local JNI refs.
3178 inline bool VM_HeapWalkOperation::collect_stack_roots() {
3179 JNILocalRootsClosure blk;
3180 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
3181 oop threadObj = thread->threadObj();
3182 if (threadObj != NULL && !thread->is_exiting() && !thread->is_hidden_from_external_view()) {
3183 // Collect the simple root for this thread before we
3184 // collect its stack roots
3185 if (!CallbackInvoker::report_simple_root(JVMTI_HEAP_REFERENCE_THREAD,
3186 threadObj)) {
3187 return false;
3188 }
3189 if (!collect_stack_roots(thread, &blk)) {
3190 return false;
3191 }
3192 }
3193 }
3194 return true;
3195 }
3196
3197 // visit an object
3198 // first mark the object as visited
3199 // second get all the outbound references from this object (in other words, all
3200 // the objects referenced by this object).
|