< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page




  77 }
  78 
  79 void Klass::set_name(Symbol* n) {
  80   _name = n;
  81   if (_name != NULL) _name->increment_refcount();
  82 }
  83 
  84 bool Klass::is_subclass_of(const Klass* k) const {
  85   // Run up the super chain and check
  86   if (this == k) return true;
  87 
  88   Klass* t = const_cast<Klass*>(this)->super();
  89 
  90   while (t != NULL) {
  91     if (t == k) return true;
  92     t = t->super();
  93   }
  94   return false;
  95 }
  96 




  97 bool Klass::search_secondary_supers(Klass* k) const {
  98   // Put some extra logic here out-of-line, before the search proper.
  99   // This cuts down the size of the inline method.
 100 
 101   // This is necessary, since I am never in my own secondary_super list.
 102   if (this == k)
 103     return true;
 104   // Scan the array-of-objects for a match
 105   int cnt = secondary_supers()->length();
 106   for (int i = 0; i < cnt; i++) {
 107     if (secondary_supers()->at(i) == k) {
 108       ((Klass*)this)->set_secondary_super_cache(k);
 109       return true;
 110     }
 111   }
 112   return false;
 113 }
 114 
 115 // Return self, except for abstract classes with exactly 1
 116 // implementor.  Then return the 1 concrete implementation.




  77 }
  78 
  79 void Klass::set_name(Symbol* n) {
  80   _name = n;
  81   if (_name != NULL) _name->increment_refcount();
  82 }
  83 
  84 bool Klass::is_subclass_of(const Klass* k) const {
  85   // Run up the super chain and check
  86   if (this == k) return true;
  87 
  88   Klass* t = const_cast<Klass*>(this)->super();
  89 
  90   while (t != NULL) {
  91     if (t == k) return true;
  92     t = t->super();
  93   }
  94   return false;
  95 }
  96 
  97 void Klass::release_C_heap_structures() {
  98   if (_name != NULL) _name->decrement_refcount();
  99 }
 100 
 101 bool Klass::search_secondary_supers(Klass* k) const {
 102   // Put some extra logic here out-of-line, before the search proper.
 103   // This cuts down the size of the inline method.
 104 
 105   // This is necessary, since I am never in my own secondary_super list.
 106   if (this == k)
 107     return true;
 108   // Scan the array-of-objects for a match
 109   int cnt = secondary_supers()->length();
 110   for (int i = 0; i < cnt; i++) {
 111     if (secondary_supers()->at(i) == k) {
 112       ((Klass*)this)->set_secondary_super_cache(k);
 113       return true;
 114     }
 115   }
 116   return false;
 117 }
 118 
 119 // Return self, except for abstract classes with exactly 1
 120 // implementor.  Then return the 1 concrete implementation.


< prev index next >