arrayKlass.cpp revision 2062
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "jvmtifiles/jvmti.h"
#include "memory/gcLocker.hpp"
#include "memory/universe.inline.hpp"
#include "oops/arrayKlass.hpp"
#include "oops/arrayKlassKlass.hpp"
#include "oops/arrayOop.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
// size of an array klass object
// If this assert fails, see comments in base_create_array_klass.
#ifdef _LP64
#else
#endif
return align_object_size(size);
}
// Array klasses have primary supertypes which are not reported to Java.
// Example super chain: String[][] -> Object[][] -> Object[] -> Object
return SystemDictionary::Object_klass();
}
return NULL;
}
// There are no methods in an array klass but the super class (Object) has some
}
// Allocation
// Note: because the Java vtable must start at the same offset in all klasses,
// we must insert filler fields into arrayKlass to make it the same size as instanceKlass.
// If this assert fails, add filler to instanceKlass to make it bigger.
"array klasses must be same size as instanceKlass");
// Arrays don't add any new methods, so their vtable is the same size as
// the vtable of klass Object.
cplusplus_vtbl, CHECK_(k));
// No safepoint should be possible until the handle's
// target below becomes parsable
k->set_dimension(1);
k->set_higher_dimension(NULL);
k->set_lower_dimension(NULL);
k->set_component_mirror(NULL);
k->set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
// Make sure size calculation is right
return k;
}
// Initialization of vtables and mirror object is done separatly from base_create_array_klass,
// since a GC can happen. At this point all instance variables of the arrayKlass must be setup.
}
// interfaces = { cloneable_klass, serializable_klass };
// Must share this for correct bootstrapping!
return Universe::the_array_interfaces_array();
}
// An array is a subtype of Serializable, Clonable, and Object
return k == SystemDictionary::Object_klass()
|| k == SystemDictionary::Cloneable_klass()
|| k == SystemDictionary::Serializable_klass();
}
// all vtables start at the same place, that's why we use instanceKlass::header_size here
}
}
if (length < 0) {
}
report_java_out_of_memory("Requested array size exceeds VM limit");
}
objArrayOop o =
// initialization to NULL not necessary, area already cleared
return o;
}
klassOop k = as_klassOop();
// Iterate over this array klass and all higher dimensions
while (k != NULL) {
f(k);
}
}
array_klasses_do(f);
}
// JVM support
}
// JVMTI support
return JVMTI_CLASS_STATUS_ARRAY;
}
// Printing
}
// Verification
}