hotspot/src/share/vm/oops/instanceRefKlass.cpp
author coleenp
Mon, 27 Jul 2009 17:23:52 -0400
changeset 3579 b18b94266d60
parent 3262 30d1c247fc25
child 3693 af387bf37e8d
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
670
ddf3e9583f2f 6719955: Update copyright year
xdono
parents: 360
diff changeset
     2
 * Copyright 1997-2008 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/_instanceRefKlass.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    28
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    29
static void specialized_oop_follow_contents(instanceRefKlass* ref, oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    30
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    31
  T heap_oop = oopDesc::load_heap_oop(referent_addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  debug_only(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
    if(TraceReferenceGC && PrintGCDetails) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    34
      gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  )
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    37
  if (!oopDesc::is_null(heap_oop)) {
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    38
    oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    if (!referent->is_gc_marked() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
        MarkSweep::ref_processor()->
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    41
          discover_reference(obj, ref->reference_type())) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
      // reference already enqueued, referent will be traversed later
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    43
      ref->instanceKlass::oop_follow_contents(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    44
      debug_only(
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    45
        if(TraceReferenceGC && PrintGCDetails) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    46
          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    47
        }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    48
      )
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    49
      return;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    50
    } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    51
      // treat referent as normal oop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      debug_only(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        if(TraceReferenceGC && PrintGCDetails) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    54
          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    55
        }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    56
      )
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    57
      MarkSweep::mark_and_push(referent_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    58
    }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    59
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    60
  // treat next as normal oop.  next is a link in the pending list.
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    61
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    62
  debug_only(
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    63
    if(TraceReferenceGC && PrintGCDetails) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    64
      gclog_or_tty->print_cr("   Process next as normal " INTPTR_FORMAT, next_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    65
    }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    66
  )
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    67
  MarkSweep::mark_and_push(next_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    68
  ref->instanceKlass::oop_follow_contents(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    69
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    70
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    71
void instanceRefKlass::oop_follow_contents(oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    72
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    73
    specialized_oop_follow_contents<narrowOop>(this, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    74
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    75
    specialized_oop_follow_contents<oop>(this, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    76
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    77
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    78
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    79
#ifndef SERIALGC
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    80
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    81
static void specialized_oop_follow_contents(instanceRefKlass* ref,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    82
                                            ParCompactionManager* cm,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    83
                                            oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    84
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    85
  T heap_oop = oopDesc::load_heap_oop(referent_addr);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    86
  debug_only(
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    87
    if(TraceReferenceGC && PrintGCDetails) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    88
      gclog_or_tty->print_cr("instanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    89
    }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    90
  )
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    91
  if (!oopDesc::is_null(heap_oop)) {
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
    92
    oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    93
    if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    94
        PSParallelCompact::ref_processor()->
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    95
          discover_reference(obj, ref->reference_type())) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    96
      // reference already enqueued, referent will be traversed later
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    97
      ref->instanceKlass::oop_follow_contents(cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    98
      debug_only(
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    99
        if(TraceReferenceGC && PrintGCDetails) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   100
          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      // treat referent as normal oop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      debug_only(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
        if(TraceReferenceGC && PrintGCDetails) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   108
          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      PSParallelCompact::mark_and_push(cm, referent_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // treat next as normal oop.  next is a link in the pending list.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   115
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  debug_only(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    if(TraceReferenceGC && PrintGCDetails) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      gclog_or_tty->print_cr("   Process next as normal " INTPTR_FORMAT, next_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  PSParallelCompact::mark_and_push(cm, next_addr);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   122
  ref->instanceKlass::oop_follow_contents(cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   123
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   124
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   125
void instanceRefKlass::oop_follow_contents(ParCompactionManager* cm,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   126
                                           oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   127
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   128
    specialized_oop_follow_contents<narrowOop>(this, cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   129
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   130
    specialized_oop_follow_contents<oop>(this, cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   131
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   135
#ifdef ASSERT
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   136
template <class T> void trace_reference_gc(const char *s, oop obj,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   137
                                           T* referent_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   138
                                           T* next_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   139
                                           T* discovered_addr) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   140
  if(TraceReferenceGC && PrintGCDetails) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   141
    gclog_or_tty->print_cr("%s obj " INTPTR_FORMAT, s, (address)obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   142
    gclog_or_tty->print_cr("     referent_addr/* " INTPTR_FORMAT " / "
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   143
         INTPTR_FORMAT, referent_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   144
         referent_addr ?
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   145
           (address)oopDesc::load_decode_heap_oop(referent_addr) : NULL);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   146
    gclog_or_tty->print_cr("     next_addr/* " INTPTR_FORMAT " / "
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   147
         INTPTR_FORMAT, next_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   148
         next_addr ? (address)oopDesc::load_decode_heap_oop(next_addr) : NULL);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   149
    gclog_or_tty->print_cr("     discovered_addr/* " INTPTR_FORMAT " / "
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   150
         INTPTR_FORMAT, discovered_addr,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   151
         discovered_addr ?
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   152
           (address)oopDesc::load_decode_heap_oop(discovered_addr) : NULL);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   153
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   154
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   155
#endif
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   156
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   157
template <class T> void specialized_oop_adjust_pointers(instanceRefKlass *ref, oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   158
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   159
  MarkSweep::adjust_pointer(referent_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   160
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   161
  MarkSweep::adjust_pointer(next_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   162
  T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   163
  MarkSweep::adjust_pointer(discovered_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   164
  debug_only(trace_reference_gc("instanceRefKlass::oop_adjust_pointers", obj,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   165
                                referent_addr, next_addr, discovered_addr);)
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   166
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
int instanceRefKlass::oop_adjust_pointers(oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  int size = size_helper();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  instanceKlass::oop_adjust_pointers(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   172
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   173
    specialized_oop_adjust_pointers<narrowOop>(this, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   174
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   175
    specialized_oop_adjust_pointers<oop>(this, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  return size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   180
#define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains)        \
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   181
  if (closure->apply_to_weak_ref_discovered_field()) {                          \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   182
    T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);           \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   183
    closure->do_oop##nv_suffix(disc_addr);                                      \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   184
  }                                                                             \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   185
                                                                                \
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   186
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);           \
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
   187
  T heap_oop = oopDesc::load_heap_oop(referent_addr);                           \
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
   188
  if (!oopDesc::is_null(heap_oop) && contains(referent_addr)) {                 \
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   189
    ReferenceProcessor* rp = closure->_ref_processor;                           \
3262
30d1c247fc25 6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents: 1388
diff changeset
   190
    oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);                 \
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   191
    if (!referent->is_gc_marked() && (rp != NULL) &&                            \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   192
        rp->discover_reference(obj, reference_type())) {                        \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   193
      return size;                                                              \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   194
    } else {                                                                    \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   195
      /* treat referent as normal oop */                                        \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   196
      SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   197
      closure->do_oop##nv_suffix(referent_addr);                                \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   198
    }                                                                           \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   199
  }                                                                             \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   200
  /* treat next as normal oop */                                                \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   201
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);                   \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   202
  if (contains(next_addr)) {                                                    \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   203
    SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk); \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   204
    closure->do_oop##nv_suffix(next_addr);                                      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   205
  }                                                                             \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   206
  return size;                                                                  \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   207
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   208
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   209
template <class T> bool contains(T *t) { return true; }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   210
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   211
// Macro to define instanceRefKlass::oop_oop_iterate for virtual/nonvirtual for
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   212
// all closures.  Macros calling macros above for each oop size.
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   213
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
#define InstanceRefKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)        \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
                                                                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
int instanceRefKlass::                                                          \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  /* Get size before changing pointers */                                       \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
                                                                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  int size = instanceKlass::oop_oop_iterate##nv_suffix(obj, closure);           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
                                                                                \
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   223
  if (UseCompressedOops) {                                                      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   224
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains);   \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   225
  } else {                                                                      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   226
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains);         \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  }                                                                             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   230
#ifndef SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   231
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   232
                                                                                \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   233
int instanceRefKlass::                                                          \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   234
oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {        \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   235
  /* Get size before changing pointers */                                       \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   236
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   237
                                                                                \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   238
  int size = instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   239
                                                                                \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   240
  if (UseCompressedOops) {                                                      \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   241
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains);   \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   242
  } else {                                                                      \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   243
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains);         \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   244
  }                                                                             \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   245
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   246
#endif // !SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   247
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   248
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
#define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix)      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
                                                                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
int instanceRefKlass::                                                          \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
oop_oop_iterate##nv_suffix##_m(oop obj,                                         \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
                               OopClosureType* closure,                         \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
                               MemRegion mr) {                                  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
                                                                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  int size = instanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);   \
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   258
  if (UseCompressedOops) {                                                      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   259
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   260
  } else {                                                                      \
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   261
    InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains);      \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  }                                                                             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN)
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   266
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   267
#ifndef SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   268
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   269
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   270
#endif // SERIALGC
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m)
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   272
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
#ifndef SERIALGC
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   275
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   276
void specialized_oop_copy_contents(instanceRefKlass *ref,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   277
                                   PSPromotionManager* pm, oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  assert(!pm->depth_first(), "invariant");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   279
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   280
  if (PSScavenge::should_scavenge(referent_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    ReferenceProcessor* rp = PSScavenge::reference_processor();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   282
    if (rp->discover_reference(obj, ref->reference_type())) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
      // reference already enqueued, referent and next will be traversed later
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   284
      ref->instanceKlass::oop_copy_contents(pm, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
      // treat referent as normal oop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
      pm->claim_or_forward_breadth(referent_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  // treat next as normal oop
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   292
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   293
  if (PSScavenge::should_scavenge(next_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
    pm->claim_or_forward_breadth(next_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   296
  ref->instanceKlass::oop_copy_contents(pm, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   299
void instanceRefKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   300
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   301
    specialized_oop_copy_contents<narrowOop>(this, pm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   302
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   303
    specialized_oop_copy_contents<oop>(this, pm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   304
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   305
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   306
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   307
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   308
void specialized_oop_push_contents(instanceRefKlass *ref,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   309
                                   PSPromotionManager* pm, oop obj) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  assert(pm->depth_first(), "invariant");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   311
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   312
  if (PSScavenge::should_scavenge(referent_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
    ReferenceProcessor* rp = PSScavenge::reference_processor();
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   314
    if (rp->discover_reference(obj, ref->reference_type())) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
      // reference already enqueued, referent and next will be traversed later
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   316
      ref->instanceKlass::oop_push_contents(pm, obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
      return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
      // treat referent as normal oop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
      pm->claim_or_forward_depth(referent_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  // treat next as normal oop
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   324
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   325
  if (PSScavenge::should_scavenge(next_addr)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    pm->claim_or_forward_depth(next_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   328
  ref->instanceKlass::oop_push_contents(pm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   329
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   330
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   331
void instanceRefKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   332
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   333
    specialized_oop_push_contents<narrowOop>(this, pm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   334
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   335
    specialized_oop_push_contents<oop>(this, pm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   336
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   337
}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   338
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   339
template <class T>
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   340
void specialized_oop_update_pointers(instanceRefKlass *ref,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   341
                                    ParCompactionManager* cm, oop obj) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   342
  T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   343
  PSParallelCompact::adjust_pointer(referent_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   344
  T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   345
  PSParallelCompact::adjust_pointer(next_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   346
  T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   347
  PSParallelCompact::adjust_pointer(discovered_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   348
  debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   349
                                referent_addr, next_addr, discovered_addr);)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
int instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  instanceKlass::oop_update_pointers(cm, obj);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   354
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   355
    specialized_oop_update_pointers<narrowOop>(this, cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   356
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   357
    specialized_oop_update_pointers<oop>(this, cm, obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   358
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   359
  return size_helper();
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   360
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   363
template <class T> void
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   364
specialized_oop_update_pointers(ParCompactionManager* cm, oop obj,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   365
                                HeapWord* beg_addr, HeapWord* end_addr) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   366
  T* p;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   367
  T* referent_addr = p = (T*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   368
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   369
  T* next_addr = p = (T*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   370
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   371
  T* discovered_addr = p = (T*)java_lang_ref_Reference::discovered_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   372
  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   373
  debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj,
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   374
                                referent_addr, next_addr, discovered_addr);)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
                                      HeapWord* beg_addr, HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  instanceKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   381
  if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   382
    specialized_oop_update_pointers<narrowOop>(cm, obj, beg_addr, end_addr);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   383
  } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   384
    specialized_oop_update_pointers<oop>(cm, obj, beg_addr, end_addr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  return size_helper();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
void instanceRefKlass::update_nonstatic_oop_maps(klassOop k) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  // Clear the nonstatic oop-map entries corresponding to referent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  // and nextPending field.  They are treated specially by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  // garbage collector.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  // The discovered field is used only by the garbage collector
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  // and is also treated specially.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  instanceKlass* ik = instanceKlass::cast(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  // Check that we have the right class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
  debug_only(static bool first_time = true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  assert(k == SystemDictionary::reference_klass() && first_time,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
         "Invalid update of maps");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  debug_only(first_time = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  assert(ik->nonstatic_oop_map_size() == 1, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  // Check that the current map is (2,4) - currently points at field with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  // offset 2 (words) and has 4 map entries.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  debug_only(int offset = java_lang_ref_Reference::referent_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  debug_only(int length = ((java_lang_ref_Reference::discovered_offset -
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   411
    java_lang_ref_Reference::referent_offset)/heapOopSize) + 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  if (UseSharedSpaces) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    assert(map->offset() == java_lang_ref_Reference::queue_offset &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
           map->length() == 1, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    assert(map->offset() == offset && map->length() == length,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
           "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    // Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    map->set_offset(java_lang_ref_Reference::queue_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    map->set_length(1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
// Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
void instanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  instanceKlass::oop_verify_on(obj, st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  // Verify referent field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  oop referent = java_lang_ref_Reference::referent(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  // We should make this general to all heaps
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  GenCollectedHeap* gch = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
    gch = GenCollectedHeap::heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  if (referent != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    guarantee(referent->is_oop(), "referent field heap failed");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   441
    if (gch != NULL && !gch->is_in_youngest(obj)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
      // We do a specific remembered set check here since the referent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
      // field is not part of the oop mask and therefore skipped by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
      // regular verify code.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   445
      if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   446
        narrowOop* referent_addr = (narrowOop*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   447
        obj->verify_old_oop(referent_addr, true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   448
      } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   449
        oop* referent_addr = (oop*)java_lang_ref_Reference::referent_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   450
        obj->verify_old_oop(referent_addr, true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   451
      }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   452
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  // Verify next field
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  oop next = java_lang_ref_Reference::next(obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
  if (next != NULL) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   457
    guarantee(next->is_oop(), "next field verify failed");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    guarantee(next->is_instanceRef(), "next field verify failed");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
    if (gch != NULL && !gch->is_in_youngest(obj)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
      // We do a specific remembered set check here since the next field is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
      // not part of the oop mask and therefore skipped by the regular
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
      // verify code.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   463
      if (UseCompressedOops) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   464
        narrowOop* next_addr = (narrowOop*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   465
        obj->verify_old_oop(next_addr, true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   466
      } else {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   467
        oop* next_addr = (oop*)java_lang_ref_Reference::next_addr(obj);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   468
        obj->verify_old_oop(next_addr, true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   469
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  // we may enter this with pending exception set
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  assert(ObjectSynchronizer::current_thread_holds_lock(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
           JavaThread::current(), h_lock),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
         "Locking should have succeeded");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
void instanceRefKlass::release_and_notify_pending_list_lock(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  BasicLock *pending_list_basic_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
  // we may enter this with pending exception set
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
  PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  assert(ObjectSynchronizer::current_thread_holds_lock(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
           JavaThread::current(), h_lock),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
         "Lock should be held");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  // Notify waiters on pending lists lock if there is any reference.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  if (java_lang_ref_Reference::pending_list() != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
    ObjectSynchronizer::notifyall(h_lock, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  ObjectSynchronizer::fast_exit(h_lock(), pending_list_basic_lock, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
}