hotspot/src/share/vm/oops/compiledICHolderKlass.cpp
author coleenp
Fri, 23 Mar 2012 11:16:05 -0400
changeset 12263 d20640f4f8fe
parent 8297 f05d10c1c4b8
permissions -rw-r--r--
7150058: Allocate symbols from null boot loader to an arena for NMT Summary: Move symbol allocation to an arena so NMT doesn't have to track them at startup. Reviewed-by: never, kamg, zgu
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) 1998, 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 "gc_interface/collectedHeap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    29
#include "gc_interface/collectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    30
#include "memory/permGen.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    31
#include "memory/universe.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    32
#include "oops/compiledICHolderKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    33
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    34
#include "oops/oop.inline2.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    35
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    36
#ifndef SERIALGC
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    37
#include "oops/oop.pcgc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6255
diff changeset
    38
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
klassOop compiledICHolderKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  compiledICHolderKlass 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
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
compiledICHolderOop compiledICHolderKlass::allocate(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  KlassHandle h_k(THREAD, as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  int size = compiledICHolderOopDesc::object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  compiledICHolderOop c = (compiledICHolderOop)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  c->set_holder_method(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  c->set_holder_klass(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  return c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
int compiledICHolderKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  return compiledICHolderOop(obj)->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
void compiledICHolderKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  obj->follow_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  MarkSweep::mark_and_push(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  MarkSweep::mark_and_push(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
void compiledICHolderKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
                                                oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  obj->follow_header(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  PSParallelCompact::mark_and_push(cm, c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  PSParallelCompact::mark_and_push(cm, c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#endif // SERIALGC
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 compiledICHolderKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  obj->oop_iterate_header(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  blk->do_oop(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  blk->do_oop(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
int compiledICHolderKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                                              MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  obj->oop_iterate_header(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  oop* adr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  adr = c->adr_holder_method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  adr = c->adr_holder_klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
int compiledICHolderKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  MarkSweep::adjust_pointer(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  MarkSweep::adjust_pointer(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  obj->adjust_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
void compiledICHolderKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
                                               oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  PSParallelCompact::adjust_pointer(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  PSParallelCompact::adjust_pointer(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  return c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  Klass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  st->print(" - method: "); c->holder_method()->print_value_on(st); st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  st->print(" - klass:  "); c->holder_klass()->print_value_on(st); st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  Klass::oop_print_value_on(obj, st);
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* compiledICHolderKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  return "{compiledICHolder}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
void compiledICHolderKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  Klass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  guarantee(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  guarantee(c->is_perm(),             "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  guarantee(c->holder_method()->is_perm(),   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  guarantee(c->holder_method()->is_method(), "should be method");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  guarantee(c->holder_klass()->is_perm(),    "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  guarantee(c->holder_klass()->is_klass(),   "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
}