< prev index next >

src/hotspot/share/oops/klass.inline.hpp

Print this page

  1 /*
  2  * Copyright (c) 2005, 2024, 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  *

165 
166 #ifndef PRODUCT
167   if (VerifySecondarySupers) {
168     bool linear_result = linear_search_secondary_supers(k);
169     if (linear_result != result) {
170       on_secondary_supers_verification_failure((Klass*)this, k, linear_result, result, "mismatch");
171     }
172   }
173 #endif // PRODUCT
174 
175   return result;
176 }
177 
178 // Returns true if this Klass needs to be addressable via narrow Klass ID.
179 inline bool Klass::needs_narrow_id() const {
180   // Classes that are never instantiated need no narrow Klass Id, since the
181   // only point of having a narrow id is to put it into an object header. Keeping
182   // never instantiated classes out of class space lessens the class space pressure.
183   // For more details, see JDK-8338526.
184   // Note: don't call this function before access flags are initialized.
185   return !is_abstract() && !is_interface();
186 }
187 #endif // SHARE_OOPS_KLASS_INLINE_HPP

  1 /*
  2  * Copyright (c) 2005, 2025, 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  *

165 
166 #ifndef PRODUCT
167   if (VerifySecondarySupers) {
168     bool linear_result = linear_search_secondary_supers(k);
169     if (linear_result != result) {
170       on_secondary_supers_verification_failure((Klass*)this, k, linear_result, result, "mismatch");
171     }
172   }
173 #endif // PRODUCT
174 
175   return result;
176 }
177 
178 // Returns true if this Klass needs to be addressable via narrow Klass ID.
179 inline bool Klass::needs_narrow_id() const {
180   // Classes that are never instantiated need no narrow Klass Id, since the
181   // only point of having a narrow id is to put it into an object header. Keeping
182   // never instantiated classes out of class space lessens the class space pressure.
183   // For more details, see JDK-8338526.
184   // Note: don't call this function before access flags are initialized.
185   return UseClassMetaspaceForAllClasses || (!is_abstract() && !is_interface());
186 }
187 #endif // SHARE_OOPS_KLASS_INLINE_HPP
< prev index next >