hotspot/src/share/vm/oops/arrayKlassKlass.cpp
author bobv
Tue, 03 Aug 2010 08:13:38 -0400
changeset 6176 4d9030fe341f
parent 5547 f4b087cbb361
child 6255 0cbe4eb819f0
permissions -rw-r--r--
6953477: Increase portability and flexibility of building Hotspot Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail. Reviewed-by: phh, never, coleenp, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
     2
 * Copyright (c) 1997, 2007, 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: 4584
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
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: 4584
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_arrayKlassKlass.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
klassOop arrayKlassKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  arrayKlassKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  // Make sure size calculation is right
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror, make links
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
bool arrayKlassKlass::oop_is_parsable(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  return (!ak->null_vtbl()) && ak->object_is_parsable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
void arrayKlassKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  MarkSweep::mark_and_push(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  MarkSweep::mark_and_push(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  MarkSweep::mark_and_push(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    ak->vtable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  klassKlass::oop_follow_contents(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
void arrayKlassKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
                                          oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  PSParallelCompact::mark_and_push(cm, ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  PSParallelCompact::mark_and_push(cm, ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  PSParallelCompact::mark_and_push(cm, ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    ak->vtable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  klassKlass::oop_follow_contents(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
int arrayKlassKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  MarkSweep::adjust_pointer(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  MarkSweep::adjust_pointer(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  MarkSweep::adjust_pointer(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    ak->vtable()->oop_adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  return klassKlass::oop_adjust_pointers(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
int arrayKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  blk->do_oop(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  blk->do_oop(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  blk->do_oop(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  ak->vtable()->oop_oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  return klassKlass::oop_oop_iterate(obj, blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  blk->do_oop(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  blk->do_oop(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  blk->do_oop(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  ak->vtable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  return klassKlass::oop_oop_iterate_m(obj, blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
void arrayKlassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
void arrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  PSParallelCompact::adjust_pointer(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  PSParallelCompact::adjust_pointer(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  PSParallelCompact::adjust_pointer(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    ak->vtable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  return klassKlass::oop_update_pointers(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
                                     HeapWord* beg_addr, HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  oop* p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  p = ak->adr_component_mirror();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  p = ak->adr_lower_dimension();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  p = ak->adr_higher_dimension();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    ak->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  return klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  klassKlass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  for(int index = 0; index < ak->dimension(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    st->print("[]");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
const char* arrayKlassKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  return "{array class}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
void arrayKlassKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  klassKlass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  if (!obj->partially_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    if (ak->component_mirror() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
      guarantee(ak->component_mirror()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    if (ak->lower_dimension() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
      guarantee(ak->lower_dimension()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    if (ak->higher_dimension() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
      guarantee(ak->higher_dimension()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
}