hotspot/src/share/vm/oops/cpCacheKlass.cpp
author jrose
Tue, 21 Apr 2009 23:21:04 -0700
changeset 2570 ecc7862946d4
parent 2105 347008ce7984
child 4584 e2a449e8cc6f
permissions -rw-r--r--
6655646: dynamic languages need dynamically linked call sites Summary: invokedynamic instruction (JSR 292 RI) Reviewed-by: twisti, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
2105
347008ce7984 6814575: Update copyright year
xdono
parents: 2010
diff changeset
     2
 * Copyright 1998-2009 Sun Microsystems, Inc.  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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
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/_cpCacheKlass.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
int constantPoolCacheKlass::oop_size(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  assert(obj->is_constantPoolCache(), "must be constantPool");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  return constantPoolCacheOop(obj)->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    35
constantPoolCacheOop constantPoolCacheKlass::allocate(int length,
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    36
                                                      bool is_conc_safe,
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    37
                                                      TRAPS) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  // allocate memory
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  int size = constantPoolCacheOopDesc::object_size(length);
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    40
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  KlassHandle klass (THREAD, as_klassOop());
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    42
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    43
  // This is the original code.  The code from permanent_obj_allocate()
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    44
  // was in-lined to allow the setting of is_conc_safe before the klass
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    45
  // is installed.
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    46
  // constantPoolCacheOop cache = (constantPoolCacheOop)
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    47
  //   CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    48
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    49
  oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    50
  constantPoolCacheOop cache = (constantPoolCacheOop) obj;
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    51
  cache->set_is_conc_safe(is_conc_safe);
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    52
  // The store to is_conc_safe must be visible before the klass
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    53
  // is set.  This should be done safely because _is_conc_safe has
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    54
  // been declared volatile.  If there are any problems, consider adding
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    55
  // OrderAccess::storestore();
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    56
  CollectedHeap::post_allocation_install_obj_klass(klass, obj, size);
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    57
  NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj,
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    58
                                                              size));
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    59
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    60
  // The length field affects the size of the object.  The allocation
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    61
  // above allocates the correct size (see calculation of "size") but
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    62
  // the size() method of the constant pool cache oop will not reflect
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    63
  // that size until the correct length is set.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    64
  cache->set_length(length);
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    65
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    66
  // The store of the length must be visible before is_conc_safe is
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    67
  // set to a safe state.
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    68
  // This should be done safely because _is_conc_safe has
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    69
  // been declared volatile.  If there are any problems, consider adding
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    70
  // OrderAccess::storestore();
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
    71
  cache->set_is_conc_safe(methodOopDesc::IsSafeConc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  cache->set_constant_pool(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  return cache;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
klassOop constantPoolCacheKlass::create_klass(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  constantPoolCacheKlass o;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    78
  KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    79
  KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    80
  // Make sure size calculation is right
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    81
  assert(k()->size() == align_object_size(header_size()), "wrong size for object");
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    82
  java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  return k();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
void constantPoolCacheKlass::oop_follow_contents(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // know that Universe::constantPoolCacheKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  // gc of constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  MarkSweep::mark_and_push((oop*)cache->constant_pool_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // gc of constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  int i = cache->length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  while (i-- > 0) cache->entry_at(i)->follow_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
void constantPoolCacheKlass::oop_follow_contents(ParCompactionManager* cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
                                                 oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  // know that Universe::constantPoolCacheKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // gc of constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  PSParallelCompact::mark_and_push(cm, (oop*)cache->constant_pool_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // gc of constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  int i = cache->length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  while (i-- > 0) cache->entry_at(i)->follow_contents(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
int constantPoolCacheKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  int size = cache->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // know that Universe::constantPoolCacheKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // iteration over constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  blk->do_oop((oop*)cache->constant_pool_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  // iteration over constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate(blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
}
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 constantPoolCacheKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  int size = cache->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // know that Universe::constantPoolCacheKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // iteration over constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  oop* addr = (oop*)cache->constant_pool_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  if (mr.contains(addr)) blk->do_oop(addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  // iteration over constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate_m(blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
int constantPoolCacheKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // Get size before changing pointers.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  // Don't call size() or oop_size() since that is a virtual call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  int size = cache->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Performance tweak: We skip iterating over the klass pointer since we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  // know that Universe::constantPoolCacheKlassObj never moves.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  // Iteration over constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  MarkSweep::adjust_pointer((oop*)cache->constant_pool_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  // iteration over constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  for (int i = 0; i < cache->length(); i++)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    cache->entry_at(i)->adjust_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
   163
bool constantPoolCacheKlass::oop_is_conc_safe(oop obj) const {
2010
c13462bbad17 6690928: Use spinning in combination with yields for workstealing termination.
jmasa
parents: 2006
diff changeset
   164
  assert(obj->is_constantPoolCache(), "should be constant pool");
2006
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
   165
  return constantPoolCacheOop(obj)->is_conc_safe();
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
   166
}
f2d2f0f20063 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 670
diff changeset
   167
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
void constantPoolCacheKlass::oop_copy_contents(PSPromotionManager* pm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
                                               oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  assert(obj->is_constantPoolCache(), "should be constant pool");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   172
  if (EnableInvokeDynamic) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   173
    constantPoolCacheOop cache = (constantPoolCacheOop)obj;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   174
    // during a scavenge, it is safe to inspect my pool, since it is perm
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   175
    constantPoolOop pool = cache->constant_pool();
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   176
    assert(pool->is_constantPool(), "should be constant pool");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   177
    if (pool->has_invokedynamic()) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   178
      for (int i = 0; i < cache->length(); i++) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   179
        ConstantPoolCacheEntry* e = cache->entry_at(i);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   180
        oop* p = (oop*)&e->_f1;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   181
        if (e->is_secondary_entry()) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   182
          if (PSScavenge::should_scavenge(p))
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   183
            pm->claim_or_forward_breadth(p);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   184
          assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   185
                 "no live oops here");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   186
        }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   187
      }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   188
    }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   189
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
                                               oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  assert(obj->is_constantPoolCache(), "should be constant pool");
2570
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   195
  if (EnableInvokeDynamic) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   196
    constantPoolCacheOop cache = (constantPoolCacheOop)obj;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   197
    // during a scavenge, it is safe to inspect my pool, since it is perm
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   198
    constantPoolOop pool = cache->constant_pool();
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   199
    assert(pool->is_constantPool(), "should be constant pool");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   200
    if (pool->has_invokedynamic()) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   201
      for (int i = 0; i < cache->length(); i++) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   202
        ConstantPoolCacheEntry* e = cache->entry_at(i);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   203
        oop* p = (oop*)&e->_f1;
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   204
        if (e->is_secondary_entry()) {
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   205
          if (PSScavenge::should_scavenge(p))
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   206
            pm->claim_or_forward_depth(p);
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   207
          assert(!(e->is_vfinal() && PSScavenge::should_scavenge((oop*)&e->_f2)),
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   208
                 "no live oops here");
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   209
        }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   210
      }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   211
    }
ecc7862946d4 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 2105
diff changeset
   212
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  // Iteration over constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  PSParallelCompact::adjust_pointer((oop*)cache->constant_pool_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // iteration over constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  for (int i = 0; i < cache->length(); ++i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    cache->entry_at(i)->update_pointers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  return cache->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
                                            HeapWord* beg_addr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
                                            HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  // Iteration over constant pool cache instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  oop* p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  p = (oop*)cache->constant_pool_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  // Iteration over constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  for (int i = 0; i < cache->length(); ++i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    cache->entry_at(i)->update_pointers(beg_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  return cache->object_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  // super print
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   257
  Klass::oop_print_on(obj, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  // print constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  // super verify
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   268
  Klass::oop_verify_on(obj, st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  // print constant pool cache entries
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
const char* constantPoolCacheKlass::internal_name() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  return "{constant pool cache}";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
}