src/share/vm/oops/typeArrayKlass.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/_typeArrayKlass.cpp.incl"













  27 
  28 bool typeArrayKlass::compute_is_subtype_of(klassOop k) {
  29   if (!k->klass_part()->oop_is_typeArray()) {
  30     return arrayKlass::compute_is_subtype_of(k);
  31   }
  32 
  33   typeArrayKlass* tak = typeArrayKlass::cast(k);
  34   if (dimension() != tak->dimension()) return false;
  35 
  36   return element_type() == tak->element_type();
  37 }
  38 
  39 klassOop typeArrayKlass::create_klass(BasicType type, int scale,
  40                                       const char* name_str, TRAPS) {
  41   typeArrayKlass o;
  42 
  43   symbolHandle sym(symbolOop(NULL));
  44   // bootstrapping: don't create sym if symbolKlass not created yet
  45   if (Universe::symbolKlassObj() != NULL && name_str != NULL) {
  46     sym = oopFactory::new_symbol_handle(name_str, CHECK_NULL);


   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/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "gc_interface/collectedHeap.hpp"
  29 #include "gc_interface/collectedHeap.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "memory/universe.hpp"
  32 #include "memory/universe.inline.hpp"
  33 #include "oops/instanceKlass.hpp"
  34 #include "oops/klassOop.hpp"
  35 #include "oops/objArrayKlassKlass.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "oops/typeArrayKlass.hpp"
  38 #include "oops/typeArrayOop.hpp"
  39 #include "runtime/handles.inline.hpp"
  40 
  41 bool typeArrayKlass::compute_is_subtype_of(klassOop k) {
  42   if (!k->klass_part()->oop_is_typeArray()) {
  43     return arrayKlass::compute_is_subtype_of(k);
  44   }
  45 
  46   typeArrayKlass* tak = typeArrayKlass::cast(k);
  47   if (dimension() != tak->dimension()) return false;
  48 
  49   return element_type() == tak->element_type();
  50 }
  51 
  52 klassOop typeArrayKlass::create_klass(BasicType type, int scale,
  53                                       const char* name_str, TRAPS) {
  54   typeArrayKlass o;
  55 
  56   symbolHandle sym(symbolOop(NULL));
  57   // bootstrapping: don't create sym if symbolKlass not created yet
  58   if (Universe::symbolKlassObj() != NULL && name_str != NULL) {
  59     sym = oopFactory::new_symbol_handle(name_str, CHECK_NULL);