hotspot/src/share/vm/oops/typeArrayKlass.cpp
author iignatyev
Wed, 14 Aug 2013 23:50:23 +0400
changeset 19332 ee4c8c2af356
parent 15482 470d0b0c09f1
child 22234 da823d78ad65
permissions -rw-r--r--
8022832: Add WB APIs for OSR compilation Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
12114
9a825a536095 7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents: 10566
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5119
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5119
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5119
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    25
#include "precompiled.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    26
#include "classfile/symbolTable.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    27
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    28
#include "classfile/vmSymbols.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    29
#include "gc_interface/collectedHeap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    30
#include "gc_interface/collectedHeap.inline.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    31
#include "memory/metadataFactory.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    32
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    33
#include "memory/universe.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    34
#include "memory/universe.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    35
#include "oops/instanceKlass.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    36
#include "oops/klass.inline.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    37
#include "oops/objArrayKlass.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    38
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    39
#include "oops/typeArrayKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    40
#include "oops/typeArrayOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    41
#include "runtime/handles.inline.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
    42
#include "utilities/macros.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    44
bool TypeArrayKlass::compute_is_subtype_of(Klass* k) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    45
  if (!k->oop_is_typeArray()) {
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    46
    return ArrayKlass::compute_is_subtype_of(k);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    49
  TypeArrayKlass* tak = TypeArrayKlass::cast(k);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  if (dimension() != tak->dimension()) return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  return element_type() == tak->element_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    55
TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type,
1668
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    56
                                      const char* name_str, TRAPS) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7890
diff changeset
    57
  Symbol* sym = NULL;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7890
diff changeset
    58
  if (name_str != NULL) {
12263
d20640f4f8fe 7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents: 12114
diff changeset
    59
    sym = SymbolTable::new_permanent_symbol(name_str, CHECK_NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    61
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    62
  ClassLoaderData* null_loader_data = ClassLoaderData::the_null_class_loader_data();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    63
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    64
  TypeArrayKlass* ak = TypeArrayKlass::allocate(null_loader_data, type, sym, CHECK_NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    66
  // Add all classes to our internal class loader list here,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    67
  // including classes in the bootstrap (NULL) class loader.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    68
  // GC walks these as strong roots.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    69
  null_loader_data->add_class(ak);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // Call complete_create_array_klass after all instance variables have been initialized.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    72
  complete_create_array_klass(ak, ak->super(), CHECK_NULL);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    73
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    74
  return ak;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    75
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    76
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    77
TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS) {
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    78
  assert(TypeArrayKlass::header_size() <= InstanceKlass::header_size(),
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    79
      "array klasses must be same size as InstanceKlass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    80
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    81
  int size = ArrayKlass::static_size(TypeArrayKlass::header_size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    83
  return new (loader_data, size, THREAD) TypeArrayKlass(type, name);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    84
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    85
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    86
TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    87
  set_layout_helper(array_layout_helper(type));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    88
  assert(oop_is_array(), "sanity");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    89
  assert(oop_is_typeArray(), "sanity");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    90
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    91
  set_max_length(arrayOopDesc::max_array_length(type));
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    92
  assert(size() >= TypeArrayKlass::header_size(), "bad size");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    93
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    94
  set_class_loader_data(ClassLoaderData::the_null_class_loader_data());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    97
typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  assert(log2_element_size() >= 0, "bad scale");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  if (length >= 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    if (length <= max_length()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   102
      KlassHandle h_k(THREAD, this);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      typeArrayOop t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      CollectedHeap* ch = Universe::heap();
10566
630c177ec580 7081933: Use zeroing elimination optimization for large array
kvn
parents: 9997
diff changeset
   105
      if (do_zero) {
630c177ec580 7081933: Use zeroing elimination optimization for large array
kvn
parents: 9997
diff changeset
   106
        t = (typeArrayOop)CollectedHeap::array_allocate(h_k, (int)size, length, CHECK_NULL);
630c177ec580 7081933: Use zeroing elimination optimization for large array
kvn
parents: 9997
diff changeset
   107
      } else {
630c177ec580 7081933: Use zeroing elimination optimization for large array
kvn
parents: 9997
diff changeset
   108
        t = (typeArrayOop)CollectedHeap::array_allocate_nozero(h_k, (int)size, length, CHECK_NULL);
630c177ec580 7081933: Use zeroing elimination optimization for large array
kvn
parents: 9997
diff changeset
   109
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      return t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    } else {
3576
4ceec8fb3e18 6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents: 2105
diff changeset
   112
      report_java_out_of_memory("Requested array size exceeds VM limit");
12114
9a825a536095 7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents: 10566
diff changeset
   113
      JvmtiExport::post_array_size_exhausted();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      THROW_OOP_0(Universe::out_of_memory_error_array_size());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   121
oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // For typeArrays this is only called for the last dimension
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  assert(rank == 1, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  int length = *last_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  return allocate(length, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   129
void TypeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  assert(s->is_typeArray(), "must be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // Check destination
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   133
  if (!d->is_typeArray() || element_type() != TypeArrayKlass::cast(d->klass())->element_type()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    THROW(vmSymbols::java_lang_ArrayStoreException());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  // Check is all offsets and lengths are non negative
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  if (src_pos < 0 || dst_pos < 0 || length < 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  // Check if the ranges are valid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  if  ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
     || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  }
5119
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   146
  // Check zero copy
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   147
  if (length == 0)
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   148
    return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // This is an attempt to make the copy_array fast.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  int l2es = log2_element_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  int ihs = array_header_in_bytes() / wordSize;
5119
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   153
  char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es);
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   154
  char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es);
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   155
  Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
// create a klass of array holding typeArrays
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   160
Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   161
  int dim = dimension();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   162
  assert(dim <= n, "check order of chain");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   163
    if (dim == n)
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   164
      return this;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   166
  if (higher_dimension() == NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    if (or_null)  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    JavaThread *jt = (JavaThread *)THREAD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
      MutexLocker mc(Compile_lock, THREAD);   // for vtables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
      // Atomic create higher dimension and link into list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
      MutexLocker mu(MultiArray_lock, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   176
      if (higher_dimension() == NULL) {
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   177
        Klass* oak = ObjArrayKlass::allocate_objArray_klass(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   178
              class_loader_data(), dim + 1, this, CHECK_NULL);
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   179
        ObjArrayKlass* h_ak = ObjArrayKlass::cast(oak);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   180
        h_ak->set_lower_dimension(this);
7890
7d1d76674e2e 7011386: race in objArrayKlass::array_klass_impl
kvn
parents: 7397
diff changeset
   181
        OrderAccess::storestore();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   182
        set_higher_dimension(h_ak);
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   183
        assert(h_ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   189
  ObjArrayKlass* h_ak = ObjArrayKlass::cast(higher_dimension());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  if (or_null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    return h_ak->array_klass_or_null(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  return h_ak->array_klass(n, CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   196
Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  return array_klass_impl(or_null, dimension() +  1, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   200
int TypeArrayKlass::oop_size(oop obj) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  typeArrayOop t = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  return t->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   206
void TypeArrayKlass::oop_follow_contents(oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // Performance tweak: We skip iterating over the klass pointer since we
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   209
  // know that Universe::TypeArrayKlass never moves.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
   212
#if INCLUDE_ALL_GCS
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   213
void TypeArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  // Performance tweak: We skip iterating over the klass pointer since we
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   216
  // know that Universe::TypeArrayKlass never moves.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
}
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
   218
#endif // INCLUDE_ALL_GCS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   220
int TypeArrayKlass::oop_adjust_pointers(oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  typeArrayOop t = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // Performance tweak: We skip iterating over the klass pointer since we
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   224
  // know that Universe::TypeArrayKlass never moves.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  return t->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   228
int TypeArrayKlass::oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  typeArrayOop t = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  // Performance tweak: We skip iterating over the klass pointer since we
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   232
  // know that Universe::TypeArrayKlass never moves.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  return t->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   236
int TypeArrayKlass::oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  typeArrayOop t = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  // Performance tweak: We skip iterating over the klass pointer since we
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   240
  // know that Universe::TypeArrayKlass never moves.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  return t->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
   244
#if INCLUDE_ALL_GCS
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   245
void TypeArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   246
  ShouldNotReachHere();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
int
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   251
TypeArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  return typeArrayOop(obj)->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
}
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
   255
#endif // INCLUDE_ALL_GCS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   257
void TypeArrayKlass::initialize(TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  // Nothing to do. Having this function is handy since objArrayKlasses can be
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   259
  // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   262
const char* TypeArrayKlass::external_name(BasicType type) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    case T_BOOLEAN: return "[Z";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
    case T_CHAR:    return "[C";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
    case T_FLOAT:   return "[F";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
    case T_DOUBLE:  return "[D";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    case T_BYTE:    return "[B";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    case T_SHORT:   return "[S";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    case T_INT:     return "[I";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    case T_LONG:    return "[J";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   277
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   278
// Printing
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   279
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   280
void TypeArrayKlass::print_on(outputStream* st) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
#ifndef PRODUCT
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   282
  assert(is_klass(), "must be klass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   283
  print_value_on(st);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   284
  Klass::print_on(st);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   285
#endif //PRODUCT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   286
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   287
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   288
void TypeArrayKlass::print_value_on(outputStream* st) const {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   289
  assert(is_klass(), "must be klass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   290
  st->print("{type array ");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   291
  switch (element_type()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   292
    case T_BOOLEAN: st->print("bool");    break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   293
    case T_CHAR:    st->print("char");    break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   294
    case T_FLOAT:   st->print("float");   break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   295
    case T_DOUBLE:  st->print("double");  break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   296
    case T_BYTE:    st->print("byte");    break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   297
    case T_SHORT:   st->print("short");   break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   298
    case T_INT:     st->print("int");     break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   299
    case T_LONG:    st->print("long");    break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   300
    default: ShouldNotReachHere();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   301
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   302
  st->print("}");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   303
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   304
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   305
#ifndef PRODUCT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
static void print_boolean_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    st->print_cr(" - %3d: %s", index, (ta->bool_at(index) == 0) ? "false" : "true");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
static void print_char_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
    jchar c = ta->char_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' ');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
static void print_float_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    st->print_cr(" - %3d: %g", index, ta->float_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
static void print_double_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    st->print_cr(" - %3d: %g", index, ta->double_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
static void print_byte_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    jbyte c = ta->byte_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' ');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
static void print_short_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    int v = ta->ushort_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
    st->print_cr(" - %3d: 0x%x\t %d", index, v, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
static void print_int_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    jint v = ta->int_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    st->print_cr(" - %3d: 0x%x %d", index, v, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
static void print_long_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    jlong v = ta->long_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    st->print_cr(" - %3d: 0x%x 0x%x", index, high(v), low(v));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   368
void TypeArrayKlass::oop_print_on(oop obj, outputStream* st) {
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   369
  ArrayKlass::oop_print_on(obj, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  typeArrayOop ta = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  int print_len = MIN2((intx) ta->length(), MaxElementPrintSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  switch (element_type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    case T_BOOLEAN: print_boolean_array(ta, print_len, st); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    case T_CHAR:    print_char_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    case T_FLOAT:   print_float_array(ta, print_len, st);   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    case T_DOUBLE:  print_double_array(ta, print_len, st);  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    case T_BYTE:    print_byte_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
    case T_SHORT:   print_short_array(ta, print_len, st);   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    case T_INT:     print_int_array(ta, print_len, st);     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    case T_LONG:    print_long_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  int remaining = ta->length() - print_len;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  if (remaining > 0) {
13922
ab7d352debe6 8000227: [obj|type]ArrayKlass::oop_print_on prints one line to tty instead of the provided output stream
stefank
parents: 13728
diff changeset
   385
    st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   391
const char* TypeArrayKlass::internal_name() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  return Klass::external_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
}