< prev index next >

src/share/vm/code/oopRecorder.cpp

Print this page
rev 12310 : [mq]: gcinterface.patch


 143   for (int i = _handles->length() - 1; i >= 0; i--) {
 144     if (_handles->at(i) == h) {
 145       int findex = i + first_index;
 146       if (_no_finds->contains(findex))  continue;  // oops; skip this one
 147       if (cloc != NULL) {
 148         _indexes->set_cache_location_index(cloc, findex);
 149       }
 150       debug_only(_missed_indexes++);
 151       return findex;
 152     }
 153   }
 154   return -1;
 155 }
 156 
 157 // Explicitly instantiate these types
 158 template class ValueRecorder<Metadata*>;
 159 template class ValueRecorder<jobject>;
 160 
 161 oop ObjectLookup::ObjectEntry::oop_value() const { return JNIHandles::resolve(_value); }
 162 
 163 ObjectLookup::ObjectLookup(): _gc_count(Universe::heap()->total_collections()), _values(4) {}
 164 
 165 void ObjectLookup::maybe_resort() {
 166   // The values are kept sorted by address which may be invalidated
 167   // after a GC, so resort if a GC has occurred since last time.
 168   if (_gc_count != Universe::heap()->total_collections()) {
 169     _gc_count = Universe::heap()->total_collections();
 170     _values.sort(sort_by_address);
 171   }
 172 }
 173 
 174 int ObjectLookup::sort_by_address(oop a, oop b) {
 175   if (b > a) return 1;
 176   if (a > b) return -1;
 177   return 0;
 178 }
 179 
 180 int ObjectLookup::sort_by_address(ObjectEntry* a, ObjectEntry* b) {
 181   return sort_by_address(a->oop_value(), b->oop_value());
 182 }
 183 
 184 int ObjectLookup::sort_oop_by_address(oop const& a, ObjectEntry const& b) {
 185   return sort_by_address(a, b.oop_value());
 186 }
 187 
 188 int ObjectLookup::find_index(jobject handle, OopRecorder* oop_recorder) {
 189   if (handle == NULL) {


 143   for (int i = _handles->length() - 1; i >= 0; i--) {
 144     if (_handles->at(i) == h) {
 145       int findex = i + first_index;
 146       if (_no_finds->contains(findex))  continue;  // oops; skip this one
 147       if (cloc != NULL) {
 148         _indexes->set_cache_location_index(cloc, findex);
 149       }
 150       debug_only(_missed_indexes++);
 151       return findex;
 152     }
 153   }
 154   return -1;
 155 }
 156 
 157 // Explicitly instantiate these types
 158 template class ValueRecorder<Metadata*>;
 159 template class ValueRecorder<jobject>;
 160 
 161 oop ObjectLookup::ObjectEntry::oop_value() const { return JNIHandles::resolve(_value); }
 162 
 163 ObjectLookup::ObjectLookup(): _gc_count(GC::gc()->heap()->total_collections()), _values(4) {}
 164 
 165 void ObjectLookup::maybe_resort() {
 166   // The values are kept sorted by address which may be invalidated
 167   // after a GC, so resort if a GC has occurred since last time.
 168   if (_gc_count != GC::gc()->heap()->total_collections()) {
 169     _gc_count = GC::gc()->heap()->total_collections();
 170     _values.sort(sort_by_address);
 171   }
 172 }
 173 
 174 int ObjectLookup::sort_by_address(oop a, oop b) {
 175   if (b > a) return 1;
 176   if (a > b) return -1;
 177   return 0;
 178 }
 179 
 180 int ObjectLookup::sort_by_address(ObjectEntry* a, ObjectEntry* b) {
 181   return sort_by_address(a->oop_value(), b->oop_value());
 182 }
 183 
 184 int ObjectLookup::sort_oop_by_address(oop const& a, ObjectEntry const& b) {
 185   return sort_by_address(a, b.oop_value());
 186 }
 187 
 188 int ObjectLookup::find_index(jobject handle, OopRecorder* oop_recorder) {
 189   if (handle == NULL) {
< prev index next >