klass.cpp revision 1142
2362N/A * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. 2362N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A#
include "incls/_precompiled.incl" 0N/A // Run up the super chain and check 0N/A if (t == k)
return true;
0N/A if (t == k)
return true;
0N/A // Put some extra logic here out-of-line, before the search proper. 0N/A // This cuts down the size of the inline method. 0N/A // This is necessary, since I am never in my own secondary_super list. 0N/A // Scan the array-of-objects for a match 0N/A for (
int i = 0; i <
cnt; i++) {
0N/A// Return self, except for abstract classes with exactly 1 0N/A// implementor. Then return the 1 concrete implementation. return this;
// Return 'this' as a no-progress flag r = s;
// Loop till find concrete class return r;
// Return the 1 concrete class // Find LCA in class hierarchy tty->
print_cr(
"Error: uncached_lookup_method called on a klass oop." " Likely error: reflection method does not correctly" " wrap return value in a mirror object.");
// allocate and initialize vtable {
// Preinitialize supertype information. // A later call to initialize_supers() may update these settings: // The vtable pointer is installed during the execution of // constructors in the call to permanent_obj_allocate(). Delay // the installation of the klass pointer into the new klass "k" // until after the vtable pointer has been installed (i.e., until // after the return of permanent_obj_allocate(). // Note that T_ARRAY is not allowed here. // None of the other machinery matters. "initialize this only once to a non-trivial value");
// Overflow of the primary_supers array forces me to be secondary. // Now compute the list of secondary supertypes. // Secondaries can occasionally be on the super chain, // if the inline "_primary_supers" array overflows. // Compute the "real" non-extra secondaries. // Store the extra secondaries in the first array positions: int i;
// Scan for overflow primaries being duplicates of 2nd'arys // This happens frequently for very deeply nested arrays: the // primary superclass chain overflows into the secondary. The // secondary list contains the element_klass's secondaries with // an extra array dimension added. If the element_klass's // secondary list already contains some primary overflows, they // (with the extra level of array-ness) will collide with the // normal primary superclass overflows. continue;
// It's a dup, don't put it in // See if we had some dup's, so the array has holes in it. // Pack the array. Drop the old secondaries array on the floor // and let GC reclaim it. // We must not copy any NULL placeholders left over from bootstrap. // add ourselves to superklass' subklass list if (
super ==
NULL)
return;
// special case: class Object "an interface can only be a subklass of Object");
// set our sibling to be the superklass' previous first subklass // make ourselves the superklass' first subklass // remove receiver from sibling list if (
super ==
NULL)
return;
// special case: class Object // This klass is alive but the subklass and siblings are not followed/updated. // We update the subklass link and the subklass' sibling links here. // Our own sibling link will be updated by our superclass (which must be alive // first subklass not alive, find first one alive // now update the subklass' sibling list // first sibling not alive, find first one alive // Always follow subklass and sibling link. This will prevent any klasses from // being unloaded (all classes are transitively linked from java.lang.Object). // No exception can be thrown by array_klass_impl when called with or_null == true. // (In anycase, the execption mark will fail if it do so) // No exception can be thrown by array_klass_impl when called with or_null == true. // (In anycase, the execption mark will fail if it do so) fatal(
"array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass");
fatal(
"array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass");
// Unless overridden, modifier_flags is 0. // Unless overridden, jvmti_class_status has no flags set. /* $$$ I think this functionality should be handled by verification of RememberedSet::verify_old_oop(obj, p, allow_dirty, false);