src/share/vm/oops/arrayKlass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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/_arrayKlass.cpp.incl"












  27 
  28 int arrayKlass::object_size(int header_size) const {
  29   // size of an array klass object
  30   assert(header_size <= instanceKlass::header_size(), "bad header size");
  31   // If this assert fails, see comments in base_create_array_klass.
  32   header_size = instanceKlass::header_size();
  33 #ifdef _LP64
  34   int size = header_size + align_object_offset(vtable_length());
  35 #else
  36   int size = header_size + vtable_length();
  37 #endif
  38   return align_object_size(size);
  39 }
  40 
  41 
  42 klassOop arrayKlass::java_super() const {
  43   if (super() == NULL)  return NULL;  // bootstrap case
  44   // Array klasses have primary supertypes which are not reported to Java.
  45   // Example super chain:  String[][] -> Object[][] -> Object[] -> Object
  46   return SystemDictionary::Object_klass();


   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/javaClasses.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "gc_interface/collectedHeap.inline.hpp"
  30 #include "jvmtifiles/jvmti.h"
  31 #include "memory/gcLocker.hpp"
  32 #include "memory/universe.inline.hpp"
  33 #include "oops/arrayKlass.hpp"
  34 #include "oops/arrayKlassKlass.hpp"
  35 #include "oops/arrayOop.hpp"
  36 #include "oops/instanceKlass.hpp"
  37 #include "oops/objArrayOop.hpp"
  38 #include "oops/oop.inline.hpp"
  39 
  40 int arrayKlass::object_size(int header_size) const {
  41   // size of an array klass object
  42   assert(header_size <= instanceKlass::header_size(), "bad header size");
  43   // If this assert fails, see comments in base_create_array_klass.
  44   header_size = instanceKlass::header_size();
  45 #ifdef _LP64
  46   int size = header_size + align_object_offset(vtable_length());
  47 #else
  48   int size = header_size + vtable_length();
  49 #endif
  50   return align_object_size(size);
  51 }
  52 
  53 
  54 klassOop arrayKlass::java_super() const {
  55   if (super() == NULL)  return NULL;  // bootstrap case
  56   // Array klasses have primary supertypes which are not reported to Java.
  57   // Example super chain:  String[][] -> Object[][] -> Object[] -> Object
  58   return SystemDictionary::Object_klass();