src/share/vm/ci/ciObjectFactory.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7017732_incremental Sdiff src/share/vm/ci

src/share/vm/ci/ciObjectFactory.cpp

Print this page




 646     }
 647   }
 648 #endif // ASSERT
 649 }
 650 
 651 static ciObjectFactory::NonPermObject* emptyBucket = NULL;
 652 
 653 // ------------------------------------------------------------------
 654 // ciObjectFactory::find_non_perm
 655 //
 656 // Use a small hash table, hashed on the klass of the key.
 657 // If there is no entry in the cache corresponding to this oop, return
 658 // the null tail of the bucket into which the oop should be inserted.
 659 ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
 660   // Be careful:  is_perm might change from false to true.
 661   // Thus, there might be a matching perm object in the table.
 662   // If there is, this probe must find it.
 663   if (key->is_perm() && _non_perm_count == 0) {
 664     return emptyBucket;
 665   } else if (key->is_instance()) {
 666     if (key->klass() == SystemDictionary::Class_klass()) {
 667       // class mirror instances are always perm
 668       return emptyBucket;
 669     }
 670     // fall through to probe
 671   } else if (key->is_array()) {
 672     // fall through to probe
 673   } else {
 674     // not an array or instance
 675     return emptyBucket;
 676   }
 677 
 678   ciObject* klass = get(key->klass());
 679   NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
 680   for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
 681     if (is_equal(p, key))  break;
 682   }
 683   return (*bp);
 684 }
 685 
 686 




 646     }
 647   }
 648 #endif // ASSERT
 649 }
 650 
 651 static ciObjectFactory::NonPermObject* emptyBucket = NULL;
 652 
 653 // ------------------------------------------------------------------
 654 // ciObjectFactory::find_non_perm
 655 //
 656 // Use a small hash table, hashed on the klass of the key.
 657 // If there is no entry in the cache corresponding to this oop, return
 658 // the null tail of the bucket into which the oop should be inserted.
 659 ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
 660   // Be careful:  is_perm might change from false to true.
 661   // Thus, there might be a matching perm object in the table.
 662   // If there is, this probe must find it.
 663   if (key->is_perm() && _non_perm_count == 0) {
 664     return emptyBucket;
 665   } else if (key->is_instance()) {
 666     if (key->klass() == SystemDictionary::Class_klass() && JavaObjectsInPerm) {
 667       // class mirror instances are always perm
 668       return emptyBucket;
 669     }
 670     // fall through to probe
 671   } else if (key->is_array()) {
 672     // fall through to probe
 673   } else {
 674     // not an array or instance
 675     return emptyBucket;
 676   }
 677 
 678   ciObject* klass = get(key->klass());
 679   NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
 680   for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
 681     if (is_equal(p, key))  break;
 682   }
 683   return (*bp);
 684 }
 685 
 686 


src/share/vm/ci/ciObjectFactory.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File