< prev index next >

src/share/vm/prims/jvmtiTagMap.cpp

Print this page




1504     _tag_count = tag_count;
1505     _object_results = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jobject>(1,true);
1506     _tag_results = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<uint64_t>(1,true);
1507   }
1508 
1509   ~TagObjectCollector() {
1510     delete _object_results;
1511     delete _tag_results;
1512   }
1513 
1514   // for each tagged object check if the tag value matches
1515   // - if it matches then we create a JNI local reference to the object
1516   // and record the reference and tag value.
1517   //
1518   void do_entry(JvmtiTagHashmapEntry* entry) {
1519     for (int i=0; i<_tag_count; i++) {
1520       if (_tags[i] == entry->tag()) {
1521         oop o = entry->object();
1522         assert(o != NULL && Universe::heap()->is_in_reserved(o), "sanity check");
1523 #if INCLUDE_ALL_GCS
1524         if (UseG1GC) {
1525           // The reference in this tag map could be the only (implicitly weak)
1526           // reference to that object. If we hand it out, we need to keep it live wrt
1527           // SATB marking similar to other j.l.ref.Reference referents.
1528           G1SATBCardTableModRefBS::enqueue(o);
1529         }
1530 #endif
1531         jobject ref = JNIHandles::make_local(JavaThread::current(), o);
1532         _object_results->append(ref);
1533         _tag_results->append((uint64_t)entry->tag());
1534       }
1535     }
1536   }
1537 
1538   // return the results from the collection
1539   //
1540   jvmtiError result(jint* count_ptr, jobject** object_result_ptr, jlong** tag_result_ptr) {
1541     jvmtiError error;
1542     int count = _object_results->length();
1543     assert(count >= 0, "sanity check");
1544 




1504     _tag_count = tag_count;
1505     _object_results = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jobject>(1,true);
1506     _tag_results = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<uint64_t>(1,true);
1507   }
1508 
1509   ~TagObjectCollector() {
1510     delete _object_results;
1511     delete _tag_results;
1512   }
1513 
1514   // for each tagged object check if the tag value matches
1515   // - if it matches then we create a JNI local reference to the object
1516   // and record the reference and tag value.
1517   //
1518   void do_entry(JvmtiTagHashmapEntry* entry) {
1519     for (int i=0; i<_tag_count; i++) {
1520       if (_tags[i] == entry->tag()) {
1521         oop o = entry->object();
1522         assert(o != NULL && Universe::heap()->is_in_reserved(o), "sanity check");
1523 #if INCLUDE_ALL_GCS
1524         if (UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier)) {
1525           // The reference in this tag map could be the only (implicitly weak)
1526           // reference to that object. If we hand it out, we need to keep it live wrt
1527           // SATB marking similar to other j.l.ref.Reference referents.
1528           G1SATBCardTableModRefBS::enqueue(o);
1529         }
1530 #endif
1531         jobject ref = JNIHandles::make_local(JavaThread::current(), o);
1532         _object_results->append(ref);
1533         _tag_results->append((uint64_t)entry->tag());
1534       }
1535     }
1536   }
1537 
1538   // return the results from the collection
1539   //
1540   jvmtiError result(jint* count_ptr, jobject** object_result_ptr, jlong** tag_result_ptr) {
1541     jvmtiError error;
1542     int count = _object_results->length();
1543     assert(count >= 0, "sanity check");
1544 


< prev index next >