2771 _allocated->push(obj);
2772 }
2773
2774 // GC support.
2775 void JvmtiVMObjectAllocEventCollector::oops_do(OopClosure* f) {
2776 if (_allocated != NULL) {
2777 for(int i=_allocated->length() - 1; i >= 0; i--) {
2778 if (_allocated->at(i) != NULL) {
2779 f->do_oop(_allocated->adr_at(i));
2780 }
2781 }
2782 }
2783 }
2784
2785 void JvmtiVMObjectAllocEventCollector::oops_do_for_all_threads(OopClosure* f) {
2786 // no-op if jvmti not enabled
2787 if (!JvmtiEnv::environments_might_exist()) {
2788 return;
2789 }
2790
2791 ThreadsListHandle tlh;
2792 JavaThreadIterator jti(tlh.list());
2793 for (JavaThread *jthr = jti.first(); jthr != NULL; jthr = jti.next()) {
2794 JvmtiThreadState *state = jthr->jvmti_thread_state();
2795 if (state != NULL) {
2796 JvmtiVMObjectAllocEventCollector *collector;
2797 collector = state->get_vm_object_alloc_event_collector();
2798 while (collector != NULL) {
2799 collector->oops_do(f);
2800 collector = (JvmtiVMObjectAllocEventCollector *)collector->get_prev();
2801 }
2802 }
2803 }
2804 }
2805
2806
2807 // Disable collection of VMObjectAlloc events
2808 NoJvmtiVMObjectAllocMark::NoJvmtiVMObjectAllocMark() : _collector(NULL) {
2809 // a no-op if VMObjectAlloc event is not enabled
2810 if (!JvmtiExport::should_post_vm_object_alloc()) {
2811 return;
2812 }
2813 Thread* thread = Thread::current_or_null();
|
2771 _allocated->push(obj);
2772 }
2773
2774 // GC support.
2775 void JvmtiVMObjectAllocEventCollector::oops_do(OopClosure* f) {
2776 if (_allocated != NULL) {
2777 for(int i=_allocated->length() - 1; i >= 0; i--) {
2778 if (_allocated->at(i) != NULL) {
2779 f->do_oop(_allocated->adr_at(i));
2780 }
2781 }
2782 }
2783 }
2784
2785 void JvmtiVMObjectAllocEventCollector::oops_do_for_all_threads(OopClosure* f) {
2786 // no-op if jvmti not enabled
2787 if (!JvmtiEnv::environments_might_exist()) {
2788 return;
2789 }
2790
2791 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jthr = jtiwh.next(); ) {
2792 JvmtiThreadState *state = jthr->jvmti_thread_state();
2793 if (state != NULL) {
2794 JvmtiVMObjectAllocEventCollector *collector;
2795 collector = state->get_vm_object_alloc_event_collector();
2796 while (collector != NULL) {
2797 collector->oops_do(f);
2798 collector = (JvmtiVMObjectAllocEventCollector *)collector->get_prev();
2799 }
2800 }
2801 }
2802 }
2803
2804
2805 // Disable collection of VMObjectAlloc events
2806 NoJvmtiVMObjectAllocMark::NoJvmtiVMObjectAllocMark() : _collector(NULL) {
2807 // a no-op if VMObjectAlloc event is not enabled
2808 if (!JvmtiExport::should_post_vm_object_alloc()) {
2809 return;
2810 }
2811 Thread* thread = Thread::current_or_null();
|