hotspot/src/share/vm/oops/arrayKlassKlass.cpp
author never
Fri, 18 Mar 2011 16:00:34 -0700
changeset 8725 8c1e3dd5fe1b
parent 8297 f05d10c1c4b8
permissions -rw-r--r--
7017732: move static fields into Class to prepare for perm gen removal Reviewed-by: kvn, coleenp, twisti, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8297
f05d10c1c4b8 7014851: Remove unused parallel compaction code
stefank
parents: 7397
diff changeset
     2
 * Copyright (c) 1997, 2011, 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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    26
#include "classfile/javaClasses.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    27
#include "gc_implementation/shared/markSweep.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    28
#include "oops/arrayKlassKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    29
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    30
#include "runtime/handles.inline.hpp"
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    31
#ifndef SERIALGC
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    32
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    33
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    34
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    35
#include "memory/cardTableRS.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    36
#include "oops/oop.pcgc.inline.hpp"
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
    37
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
klassOop arrayKlassKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  arrayKlassKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  // Make sure size calculation is right
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror, make links
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
bool arrayKlassKlass::oop_is_parsable(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  return (!ak->null_vtbl()) && ak->object_is_parsable();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
void arrayKlassKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  MarkSweep::mark_and_push(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  MarkSweep::mark_and_push(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  MarkSweep::mark_and_push(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    ak->vtable()->oop_follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  klassKlass::oop_follow_contents(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
void arrayKlassKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
                                          oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  PSParallelCompact::mark_and_push(cm, ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  PSParallelCompact::mark_and_push(cm, ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  PSParallelCompact::mark_and_push(cm, ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    ak->vtable()->oop_follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  klassKlass::oop_follow_contents(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
int arrayKlassKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  MarkSweep::adjust_pointer(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  MarkSweep::adjust_pointer(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  MarkSweep::adjust_pointer(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    ak->vtable()->oop_adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  return klassKlass::oop_adjust_pointers(obj);
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(oop obj, OopClosure* blk) {
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(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  return klassKlass::oop_oop_iterate(obj, blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   114
  oop* addr = ak->adr_component_mirror();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   115
  if (mr.contains(addr)) blk->do_oop(addr);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   116
  addr = ak->adr_lower_dimension();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   117
  if (mr.contains(addr)) blk->do_oop(addr);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   118
  addr = ak->adr_higher_dimension();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   119
  if (mr.contains(addr)) blk->do_oop(addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  ak->vtable()->oop_oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  return klassKlass::oop_oop_iterate_m(obj, blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
void arrayKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  assert(obj->blueprint()->oop_is_arrayKlass(),"must be an array klass");
8725
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   127
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   128
  oop* p = ak->adr_component_mirror();
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   129
  if (PSScavenge::should_scavenge(p)) {
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   130
    pm->claim_or_forward_depth(p);
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   131
  }
8c1e3dd5fe1b 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 8297
diff changeset
   132
  klassKlass::oop_push_contents(pm, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  PSParallelCompact::adjust_pointer(ak->adr_component_mirror());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  PSParallelCompact::adjust_pointer(ak->adr_lower_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  PSParallelCompact::adjust_pointer(ak->adr_higher_dimension());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    HandleMark hm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    ak->vtable()->oop_update_pointers(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  return klassKlass::oop_update_pointers(cm, obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  assert(obj->is_klass(), "must be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  klassKlass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
void arrayKlassKlass::oop_print_value_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
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  for(int index = 0; index < ak->dimension(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    st->print("[]");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
const char* arrayKlassKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  return "{array class}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
void arrayKlassKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  klassKlass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  if (!obj->partially_loaded()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    if (ak->component_mirror() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
      guarantee(ak->component_mirror()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    if (ak->lower_dimension() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
      guarantee(ak->lower_dimension()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    if (ak->higher_dimension() != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
      guarantee(ak->higher_dimension()->klass(), "should have a class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}