src/share/vm/oops/typeArrayKlass.hpp

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 // A typeArrayKlass is the klass of a typeArray
  26 // It contains the type and size of the elements
  27 
  28 class typeArrayKlass : public arrayKlass {
  29   friend class VMStructs;
  30  private:
  31   jint _max_length;            // maximum number of elements allowed in an array
  32  public:
  33   // instance variables
  34   jint max_length()                     { return _max_length; }
  35   void set_max_length(jint m)           { _max_length = m;    }
  36 
  37   // testers
  38   bool oop_is_typeArray_slow() const    { return true; }
  39 
  40   // klass allocation
  41   DEFINE_ALLOCATE_PERMANENT(typeArrayKlass);
  42   static klassOop create_klass(BasicType type, int scale, const char* name_str,
  43                                TRAPS);
  44   static inline klassOop create_klass(BasicType type, int scale, TRAPS) {


  88 
  89   // Sizing
  90   static int header_size()  { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; }
  91   int object_size() const   { return arrayKlass::object_size(header_size()); }
  92 
  93   // Initialization (virtual from Klass)
  94   void initialize(TRAPS);
  95 
  96  private:
  97    // Helpers
  98    static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS);
  99 
 100 #ifndef PRODUCT
 101  public:
 102   // Printing
 103   void oop_print_on(oop obj, outputStream* st);
 104 #endif
 105  public:
 106   const char* internal_name() const;
 107 };


   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 #ifndef SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
  26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
  27 
  28 #include "oops/arrayKlass.hpp"
  29 
  30 // A typeArrayKlass is the klass of a typeArray
  31 // It contains the type and size of the elements
  32 
  33 class typeArrayKlass : public arrayKlass {
  34   friend class VMStructs;
  35  private:
  36   jint _max_length;            // maximum number of elements allowed in an array
  37  public:
  38   // instance variables
  39   jint max_length()                     { return _max_length; }
  40   void set_max_length(jint m)           { _max_length = m;    }
  41 
  42   // testers
  43   bool oop_is_typeArray_slow() const    { return true; }
  44 
  45   // klass allocation
  46   DEFINE_ALLOCATE_PERMANENT(typeArrayKlass);
  47   static klassOop create_klass(BasicType type, int scale, const char* name_str,
  48                                TRAPS);
  49   static inline klassOop create_klass(BasicType type, int scale, TRAPS) {


  93 
  94   // Sizing
  95   static int header_size()  { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; }
  96   int object_size() const   { return arrayKlass::object_size(header_size()); }
  97 
  98   // Initialization (virtual from Klass)
  99   void initialize(TRAPS);
 100 
 101  private:
 102    // Helpers
 103    static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS);
 104 
 105 #ifndef PRODUCT
 106  public:
 107   // Printing
 108   void oop_print_on(oop obj, outputStream* st);
 109 #endif
 110  public:
 111   const char* internal_name() const;
 112 };
 113 
 114 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP