src/share/vm/oops/klass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_klass.cpp.incl"










  27 
  28 
  29 bool Klass::is_subclass_of(klassOop k) const {
  30   // Run up the super chain and check
  31   klassOop t = as_klassOop();
  32 
  33   if (t == k) return true;
  34   t = Klass::cast(t)->super();
  35 
  36   while (t != NULL) {
  37     if (t == k) return true;
  38     t = Klass::cast(t)->super();
  39   }
  40   return false;
  41 }
  42 
  43 bool Klass::search_secondary_supers(klassOop k) const {
  44   // Put some extra logic here out-of-line, before the search proper.
  45   // This cuts down the size of the inline method.
  46 


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/instanceKlass.hpp"
  32 #include "oops/klass.inline.hpp"
  33 #include "oops/klassOop.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/oop.inline2.hpp"
  36 #include "runtime/atomic.hpp"
  37 
  38 
  39 bool Klass::is_subclass_of(klassOop k) const {
  40   // Run up the super chain and check
  41   klassOop t = as_klassOop();
  42 
  43   if (t == k) return true;
  44   t = Klass::cast(t)->super();
  45 
  46   while (t != NULL) {
  47     if (t == k) return true;
  48     t = Klass::cast(t)->super();
  49   }
  50   return false;
  51 }
  52 
  53 bool Klass::search_secondary_supers(klassOop k) const {
  54   // Put some extra logic here out-of-line, before the search proper.
  55   // This cuts down the size of the inline method.
  56