hotspot/src/share/vm/oops/compiledICHolderKlass.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) 1998, 2006, 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/_compiledICHolderKlass.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
klassOop compiledICHolderKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
  compiledICHolderKlass o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  // Make sure size calculation is right
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
compiledICHolderOop compiledICHolderKlass::allocate(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  KlassHandle h_k(THREAD, as_klassOop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  int size = compiledICHolderOopDesc::object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  compiledICHolderOop c = (compiledICHolderOop)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  c->set_holder_method(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  c->set_holder_klass(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  return c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
int compiledICHolderKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  return compiledICHolderOop(obj)->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
void compiledICHolderKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  obj->follow_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  MarkSweep::mark_and_push(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  MarkSweep::mark_and_push(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
void compiledICHolderKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
                                                oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  obj->follow_header(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  PSParallelCompact::mark_and_push(cm, c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  PSParallelCompact::mark_and_push(cm, c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
int compiledICHolderKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  obj->oop_iterate_header(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  blk->do_oop(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  blk->do_oop(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
int compiledICHolderKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
                                              MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  obj->oop_iterate_header(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  oop* adr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  adr = c->adr_holder_method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  adr = c->adr_holder_klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  if (mr.contains(adr)) blk->do_oop(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
int compiledICHolderKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  int size = c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  MarkSweep::adjust_pointer(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  MarkSweep::adjust_pointer(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  obj->adjust_header();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
void compiledICHolderKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
void compiledICHolderKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
                                               oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  PSParallelCompact::adjust_pointer(c->adr_holder_method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  PSParallelCompact::adjust_pointer(c->adr_holder_klass());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  return c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
                                               oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
                                               HeapWord* beg_addr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
                                               HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  oop* p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  p = c->adr_holder_method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  p = c->adr_holder_klass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  return c->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
// Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  Klass::oop_print_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  st->print(" - method: "); c->holder_method()->print_value_on(st); st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  st->print(" - klass:  "); c->holder_klass()->print_value_on(st); st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  Klass::oop_print_value_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
const char* compiledICHolderKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  return "{compiledICHolder}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
void compiledICHolderKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  Klass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  guarantee(obj->is_compiledICHolder(), "must be compiledICHolder");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  compiledICHolderOop c = compiledICHolderOop(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  guarantee(c->is_perm(),             "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  guarantee(c->holder_method()->is_perm(),   "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  guarantee(c->holder_method()->is_method(), "should be method");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  guarantee(c->holder_klass()->is_perm(),    "should be in permspace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  guarantee(c->holder_klass()->is_klass(),   "should be klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
}