src/hotspot/share/oops/typeArrayKlass.cpp
author coleenp
Tue, 14 May 2019 11:29:18 -0400
changeset 54847 59ea39bb2809
parent 54786 ebf733a324d4
child 57745 789e967c2731
permissions -rw-r--r--
8223657: Remove unused THREAD argument from SymbolTable functions Summary: also made lookup and lookup_only functions private to SymbolTable. External callers use new_symbol or probe. Reviewed-by: dholmes, gziemski
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53152
08db5aa02f7b 8216189: Remove Klass::compute_is_subtype_of
redestad
parents: 52619
diff changeset
     2
 * Copyright (c) 1997, 2019, 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"
38094
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
    26
#include "classfile/moduleEntry.hpp"
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
    27
#include "classfile/packageEntry.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    28
#include "classfile/symbolTable.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    29
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    30
#include "classfile/vmSymbols.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30150
diff changeset
    31
#include "gc/shared/collectedHeap.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30150
diff changeset
    32
#include "gc/shared/collectedHeap.inline.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    33
#include "memory/metadataFactory.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    34
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    35
#include "memory/universe.hpp"
40887
8d35e19f5548 8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents: 38094
diff changeset
    36
#include "oops/arrayKlass.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    37
#include "oops/instanceKlass.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    38
#include "oops/klass.inline.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    39
#include "oops/objArrayKlass.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    40
#include "oops/oop.inline.hpp"
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents: 27680
diff changeset
    41
#include "oops/typeArrayKlass.inline.hpp"
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 33611
diff changeset
    42
#include "oops/typeArrayOop.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6248
diff changeset
    43
#include "runtime/handles.inline.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13961
diff changeset
    44
#include "utilities/macros.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    46
TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type,
1668
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    47
                                      const char* name_str, TRAPS) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7890
diff changeset
    48
  Symbol* sym = NULL;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7890
diff changeset
    49
  if (name_str != NULL) {
54847
59ea39bb2809 8223657: Remove unused THREAD argument from SymbolTable functions
coleenp
parents: 54786
diff changeset
    50
    sym = SymbolTable::new_permanent_symbol(name_str);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    52
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    53
  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
    54
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    55
  TypeArrayKlass* ak = TypeArrayKlass::allocate(null_loader_data, type, sym, CHECK_NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
54761
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    57
  // Call complete_create_array_klass after all instance variables have been initialized.
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    58
  complete_create_array_klass(ak, ak->super(), ModuleEntryTable::javabase_moduleEntry(), CHECK_NULL);
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    59
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    60
  // 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
    61
  // including classes in the bootstrap (NULL) class loader.
54761
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    62
  // Do this step after creating the mirror so that if the
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    63
  // mirror creation fails, loaded_classes_do() doesn't find
a5b33a664b4f 8217846: [Graal] vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java crash
hseigel
parents: 53152
diff changeset
    64
  // an array class without a mirror.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    65
  null_loader_data->add_class(ak);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    67
  return ak;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    68
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    69
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    70
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
    71
  assert(TypeArrayKlass::header_size() <= InstanceKlass::header_size(),
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    72
      "array klasses must be same size as InstanceKlass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    73
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    74
  int size = ArrayKlass::static_size(TypeArrayKlass::header_size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    76
  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
    77
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    78
50752
9d62da00bf15 8204540: Automatic oop closure devirtualization
stefank
parents: 50601
diff changeset
    79
TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name, ID) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    80
  set_layout_helper(array_layout_helper(type));
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 30764
diff changeset
    81
  assert(is_array_klass(), "sanity");
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 30764
diff changeset
    82
  assert(is_typeArray_klass(), "sanity");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    83
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    84
  set_max_length(arrayOopDesc::max_array_length(type));
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    85
  assert(size() >= TypeArrayKlass::header_size(), "bad size");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    86
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
    87
  set_class_loader_data(ClassLoaderData::the_null_class_loader_data());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    90
typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  assert(log2_element_size() >= 0, "bad scale");
52033
d6aa9ea2405d 8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents: 50882
diff changeset
    92
  check_array_allocation_length(length, max_length(), CHECK_NULL);
d6aa9ea2405d 8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents: 50882
diff changeset
    93
  size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
d6aa9ea2405d 8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents: 50882
diff changeset
    94
  return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
d6aa9ea2405d 8208686: [AOT] JVMTI ResourceExhausted event repeated for same allocation
dnsimon
parents: 50882
diff changeset
    95
                                                        do_zero, CHECK_NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
    98
oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  // For typeArrays this is only called for the last dimension
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  assert(rank == 1, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  int length = *last_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  return allocate(length, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   106
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
   107
  assert(s->is_typeArray(), "must be type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
50601
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   109
  // Check destination type.
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   110
  if (!d->is_typeArray()) {
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   111
    ResourceMark rm(THREAD);
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   112
    stringStream ss;
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   113
    if (d->is_objArray()) {
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   114
      ss.print("arraycopy: type mismatch: can not copy %s[] into object array[]",
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   115
               type2name_tab[ArrayKlass::cast(s->klass())->element_type()]);
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   116
    } else {
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   117
      ss.print("arraycopy: destination type %s is not an array", d->klass()->external_name());
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   118
    }
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   119
    THROW_MSG(vmSymbols::java_lang_ArrayStoreException(), ss.as_string());
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   120
  }
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   121
  if (element_type() != TypeArrayKlass::cast(d->klass())->element_type()) {
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   122
    ResourceMark rm(THREAD);
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   123
    stringStream ss;
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   124
    ss.print("arraycopy: type mismatch: can not copy %s[] into %s[]",
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   125
             type2name_tab[ArrayKlass::cast(s->klass())->element_type()],
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   126
             type2name_tab[ArrayKlass::cast(d->klass())->element_type()]);
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   127
    THROW_MSG(vmSymbols::java_lang_ArrayStoreException(), ss.as_string());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
50601
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   130
  // Check if all offsets and lengths are non negative.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  if (src_pos < 0 || dst_pos < 0 || length < 0) {
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   132
    // Pass specific exception reason.
50601
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   133
    ResourceMark rm(THREAD);
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   134
    stringStream ss;
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   135
    if (src_pos < 0) {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   136
      ss.print("arraycopy: source index %d out of bounds for %s[%d]",
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   137
               src_pos, type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   138
    } else if (dst_pos < 0) {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   139
      ss.print("arraycopy: destination index %d out of bounds for %s[%d]",
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   140
               dst_pos, type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   141
    } else {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   142
      ss.print("arraycopy: length %d is negative", length);
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   143
    }
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   144
    THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // Check if the ranges are valid
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   147
  if ((((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) ||
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   148
      (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length())) {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   149
    // Pass specific exception reason.
50601
3fbae7b9ddb5 8204943: Improve message of ArrayStoreException.
goetz
parents: 50389
diff changeset
   150
    ResourceMark rm(THREAD);
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   151
    stringStream ss;
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   152
    if (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   153
      ss.print("arraycopy: last source index %u out of bounds for %s[%d]",
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   154
               (unsigned int) length + (unsigned int) src_pos,
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   155
               type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   156
    } else {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   157
      ss.print("arraycopy: last destination index %u out of bounds for %s[%d]",
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   158
               (unsigned int) length + (unsigned int) dst_pos,
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   159
               type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   160
    }
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   161
    THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  }
5119
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   163
  // Check zero copy
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   164
  if (length == 0)
7bf54ea07181 6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents: 3576
diff changeset
   165
    return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  // This is an attempt to make the copy_array fast.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  int l2es = log2_element_size();
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 50304
diff changeset
   169
  size_t src_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)src_pos << l2es);
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 50304
diff changeset
   170
  size_t dst_offset = arrayOopDesc::base_offset_in_bytes(element_type()) + ((size_t)dst_pos << l2es);
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 50304
diff changeset
   171
  ArrayAccess<ARRAYCOPY_ATOMIC>::arraycopy<void>(s, src_offset, d, dst_offset, (size_t)length << l2es);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
// create a klass of array holding typeArrays
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   175
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
   176
  int dim = dimension();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   177
  assert(dim <= n, "check order of chain");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   178
    if (dim == n)
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   179
      return this;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
40887
8d35e19f5548 8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents: 38094
diff changeset
   181
  // lock-free read needs acquire semantics
8d35e19f5548 8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents: 38094
diff changeset
   182
  if (higher_dimension_acquire() == NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    if (or_null)  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    JavaThread *jt = (JavaThread *)THREAD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      // Atomic create higher dimension and link into list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
      MutexLocker mu(MultiArray_lock, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   191
      if (higher_dimension() == NULL) {
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   192
        Klass* oak = ObjArrayKlass::allocate_objArray_klass(
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   193
              class_loader_data(), dim + 1, this, CHECK_NULL);
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   194
        ObjArrayKlass* h_ak = ObjArrayKlass::cast(oak);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   195
        h_ak->set_lower_dimension(this);
40887
8d35e19f5548 8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents: 38094
diff changeset
   196
        // use 'release' to pair with lock-free load
8d35e19f5548 8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents: 38094
diff changeset
   197
        release_set_higher_dimension(h_ak);
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 30764
diff changeset
   198
        assert(h_ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  }
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   204
  ObjArrayKlass* h_ak = ObjArrayKlass::cast(higher_dimension());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  if (or_null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    return h_ak->array_klass_or_null(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  }
27680
8ecc0871c18e 8064811: Use THREAD instead of CHECK_NULL in return statements
stefank
parents: 24351
diff changeset
   208
  return h_ak->array_klass(n, THREAD);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   211
Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  return array_klass_impl(or_null, dimension() +  1, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   215
int TypeArrayKlass::oop_size(oop obj) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  assert(obj->is_typeArray(),"must be a type array");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  typeArrayOop t = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  return t->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   221
void TypeArrayKlass::initialize(TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  // 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
   223
  // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   226
const char* TypeArrayKlass::external_name(BasicType type) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    case T_BOOLEAN: return "[Z";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    case T_CHAR:    return "[C";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    case T_FLOAT:   return "[F";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    case T_DOUBLE:  return "[D";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    case T_BYTE:    return "[B";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    case T_SHORT:   return "[S";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    case T_INT:     return "[I";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    case T_LONG:    return "[J";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   241
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   242
// Printing
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   243
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   244
void TypeArrayKlass::print_on(outputStream* st) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
#ifndef PRODUCT
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   246
  assert(is_klass(), "must be klass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   247
  print_value_on(st);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   248
  Klass::print_on(st);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   249
#endif //PRODUCT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   250
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   251
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   252
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
   253
  assert(is_klass(), "must be klass");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   254
  st->print("{type array ");
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   255
  BasicType bt = element_type();
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   256
  if (bt == T_BOOLEAN) {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   257
    st->print("bool");
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   258
  } else {
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49383
diff changeset
   259
    st->print("%s", type2name_tab[bt]);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   260
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   261
  st->print("}");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   262
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   263
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12263
diff changeset
   264
#ifndef PRODUCT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
static void print_boolean_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    st->print_cr(" - %3d: %s", index, (ta->bool_at(index) == 0) ? "false" : "true");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
static void print_char_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    jchar c = ta->char_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' ');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
static void print_float_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
    st->print_cr(" - %3d: %g", index, ta->float_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
static void print_double_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
    st->print_cr(" - %3d: %g", index, ta->double_at(index));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
static void print_byte_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    jbyte c = ta->byte_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' ');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
static void print_short_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    int v = ta->ushort_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
    st->print_cr(" - %3d: 0x%x\t %d", index, v, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
static void print_int_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
    jint v = ta->int_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    st->print_cr(" - %3d: 0x%x %d", index, v, v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
static void print_long_array(typeArrayOop ta, int print_len, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  for (int index = 0; index < print_len; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    jlong v = ta->long_at(index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    st->print_cr(" - %3d: 0x%x 0x%x", index, high(v), low(v));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   327
void TypeArrayKlass::oop_print_on(oop obj, outputStream* st) {
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   328
  ArrayKlass::oop_print_on(obj, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  typeArrayOop ta = typeArrayOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  int print_len = MIN2((intx) ta->length(), MaxElementPrintSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  switch (element_type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    case T_BOOLEAN: print_boolean_array(ta, print_len, st); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    case T_CHAR:    print_char_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    case T_FLOAT:   print_float_array(ta, print_len, st);   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    case T_DOUBLE:  print_double_array(ta, print_len, st);  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    case T_BYTE:    print_byte_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    case T_SHORT:   print_short_array(ta, print_len, st);   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    case T_INT:     print_int_array(ta, print_len, st);     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    case T_LONG:    print_long_array(ta, print_len, st);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  int remaining = ta->length() - print_len;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  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
   344
    st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   350
const char* TypeArrayKlass::internal_name() const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  return Klass::external_name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
}
38094
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   353
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   354
// A TypeArrayKlass is an array of a primitive type, its defining module is java.base
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   355
ModuleEntry* TypeArrayKlass::module() const {
41183
207b92e69457 8163406: The fixup_module_list must be protected by Module_lock when inserting new entries
lfoltan
parents: 40887
diff changeset
   356
  return ModuleEntryTable::javabase_moduleEntry();
38094
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   357
}
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   358
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   359
PackageEntry* TypeArrayKlass::package() const {
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   360
  return NULL;
46977cd73d86 8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents: 36508
diff changeset
   361
}