hotspot/src/share/vm/memory/space.inline.hpp
author mlarsson
Thu, 30 Oct 2014 12:45:22 +0100
changeset 27624 fe43edc5046d
parent 24487 71ff0bd674eb
child 29081 c61eb4914428
permissions -rw-r--r--
8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods Reviewed-by: mgerdin, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 12597
diff changeset
     2
 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_MEMORY_SPACE_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
27624
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    28
#include "gc_implementation/shared/liveRange.hpp"
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    29
#include "gc_implementation/shared/markSweep.inline.hpp"
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    30
#include "gc_implementation/shared/spaceDecorator.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "gc_interface/collectedHeap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "memory/space.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "memory/universe.hpp"
24487
71ff0bd674eb 8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents: 13963
diff changeset
    34
#include "runtime/prefetch.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "runtime/safepoint.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    37
inline HeapWord* Space::block_start(const void* p) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    38
  return block_start_const(p);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    39
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    40
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  HeapWord* res = ContiguousSpace::allocate(size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  if (res != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    _offsets.alloc_block(res, size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// Because of the requirement of keeping "_offsets" up to date with the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// allocations, we sequentialize these with a lock.  Therefore, best if
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// this is used for larger LAB allocations only.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
inline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  MutexLocker x(&_par_alloc_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  // This ought to be just "allocate", because of the lock above, but that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // ContiguousSpace::allocate asserts that either the allocating thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // holds the heap lock or it is the VM thread and we're at a safepoint.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // The best I (dld) could figure was to put a field in ContiguousSpace
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // meaning "locking at safepoint taken care of", and set/reset that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // here.  But this will do for now, especially in light of the comment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // above.  Perhaps in the future some lock-free manner of keeping the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // coordination.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  HeapWord* res = ContiguousSpace::par_allocate(size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  if (res != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    _offsets.alloc_block(res, size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    69
inline HeapWord*
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    70
OffsetTableContigSpace::block_start_const(const void* p) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  return _offsets.block_start(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
27624
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    74
template <class SpaceType>
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    75
inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    76
  // Compute the new addresses for the live objects and store it in the mark
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    77
  // Used by universe::mark_sweep_phase2()
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    78
  HeapWord* compact_top; // This is where we are currently compacting to.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    79
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    80
  // We're sure to be here before any objects are compacted into this
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    81
  // space, so this is a good time to initialize this:
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    82
  space->set_compaction_top(space->bottom());
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    83
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    84
  if (cp->space == NULL) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    85
    assert(cp->gen != NULL, "need a generation");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    86
    assert(cp->threshold == NULL, "just checking");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    87
    assert(cp->gen->first_compaction_space() == space, "just checking");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    88
    cp->space = cp->gen->first_compaction_space();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    89
    compact_top = cp->space->bottom();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    90
    cp->space->set_compaction_top(compact_top);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    91
    cp->threshold = cp->space->initialize_threshold();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    92
  } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    93
    compact_top = cp->space->compaction_top();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    94
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    95
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    96
  // We allow some amount of garbage towards the bottom of the space, so
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    97
  // we don't start compacting before there is a significant gain to be made.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    98
  // Occasionally, we want to ensure a full compaction, which is determined
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
    99
  // by the MarkSweepAlwaysCompactCount parameter.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   100
  uint invocations = MarkSweep::total_invocations();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   101
  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   102
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   103
  size_t allowed_deadspace = 0;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   104
  if (skip_dead) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   105
    const size_t ratio = space->allowed_dead_ratio();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   106
    allowed_deadspace = (space->capacity() * ratio / 100) / HeapWordSize;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   107
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   108
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   109
  HeapWord* q = space->bottom();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   110
  HeapWord* t = space->scan_limit();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   111
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   112
  HeapWord*  end_of_live= q;            // One byte beyond the last byte of the last
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   113
                                        // live object.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   114
  HeapWord*  first_dead = space->end(); // The first dead object.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   115
  LiveRange* liveRange  = NULL;         // The current live range, recorded in the
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   116
                                        // first header of preceding free area.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   117
  space->_first_dead = first_dead;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   118
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   119
  const intx interval = PrefetchScanIntervalInBytes;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   120
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   121
  while (q < t) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   122
    assert(!space->scanned_block_is_obj(q) ||
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   123
           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   124
           oop(q)->mark()->has_bias_pattern(),
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   125
           "these are the only valid states during a mark sweep");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   126
    if (space->scanned_block_is_obj(q) && oop(q)->is_gc_marked()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   127
      // prefetch beyond q
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   128
      Prefetch::write(q, interval);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   129
      size_t size = space->scanned_block_size(q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   130
      compact_top = cp->space->forward(oop(q), size, cp, compact_top);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   131
      q += size;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   132
      end_of_live = q;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   133
    } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   134
      // run over all the contiguous dead objects
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   135
      HeapWord* end = q;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   136
      do {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   137
        // prefetch beyond end
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   138
        Prefetch::write(end, interval);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   139
        end += space->scanned_block_size(end);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   140
      } while (end < t && (!space->scanned_block_is_obj(end) || !oop(end)->is_gc_marked()));
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   141
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   142
      // see if we might want to pretend this object is alive so that
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   143
      // we don't have to compact quite as often.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   144
      if (allowed_deadspace > 0 && q == compact_top) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   145
        size_t sz = pointer_delta(end, q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   146
        if (space->insert_deadspace(allowed_deadspace, q, sz)) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   147
          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   148
          q = end;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   149
          end_of_live = end;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   150
          continue;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   151
        }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   152
      }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   153
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   154
      // otherwise, it really is a free region.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   155
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   156
      // for the previous LiveRange, record the end of the live objects.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   157
      if (liveRange) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   158
        liveRange->set_end(q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   159
      }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   160
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   161
      // record the current LiveRange object.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   162
      // liveRange->start() is overlaid on the mark word.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   163
      liveRange = (LiveRange*)q;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   164
      liveRange->set_start(end);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   165
      liveRange->set_end(end);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   166
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   167
      // see if this is the first dead region.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   168
      if (q < first_dead) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   169
        first_dead = q;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   170
      }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   171
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   172
      // move on to the next object
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   173
      q = end;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   174
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   175
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   176
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   177
  assert(q == t, "just checking");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   178
  if (liveRange != NULL) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   179
    liveRange->set_end(q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   180
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   181
  space->_end_of_live = end_of_live;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   182
  if (end_of_live < first_dead) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   183
    first_dead = end_of_live;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   184
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   185
  space->_first_dead = first_dead;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   186
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   187
  // save the compaction_top of the compaction space.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   188
  cp->space->set_compaction_top(compact_top);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   189
}
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   190
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   191
template <class SpaceType>
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   192
inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   193
  // adjust all the interior pointers to point at the new locations of objects
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   194
  // Used by MarkSweep::mark_sweep_phase3()
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   195
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   196
  HeapWord* q = space->bottom();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   197
  HeapWord* t = space->_end_of_live;  // Established by "prepare_for_compaction".
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   198
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   199
  assert(space->_first_dead <= space->_end_of_live, "Stands to reason, no?");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   200
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   201
  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   202
    // we have a chunk of the space which hasn't moved and we've
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   203
    // reinitialized the mark word during the previous pass, so we can't
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   204
    // use is_gc_marked for the traversal.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   205
    HeapWord* end = space->_first_dead;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   206
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   207
    while (q < end) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   208
      // I originally tried to conjoin "block_start(q) == q" to the
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   209
      // assertion below, but that doesn't work, because you can't
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   210
      // accurately traverse previous objects to get to the current one
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   211
      // after their pointers have been
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   212
      // updated, until the actual compaction is done.  dld, 4/00
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   213
      assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   214
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   215
      // point all the oops to the new location
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   216
      size_t size = oop(q)->adjust_pointers();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   217
      size = space->adjust_obj_size(size);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   218
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   219
      q += size;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   220
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   221
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   222
    if (space->_first_dead == t) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   223
      q = t;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   224
    } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   225
      // $$$ This is funky.  Using this to read the previously written
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   226
      // LiveRange.  See also use below.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   227
      q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   228
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   229
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   230
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   231
  const intx interval = PrefetchScanIntervalInBytes;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   232
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   233
  debug_only(HeapWord* prev_q = NULL);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   234
  while (q < t) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   235
    // prefetch beyond q
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   236
    Prefetch::write(q, interval);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   237
    if (oop(q)->is_gc_marked()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   238
      // q is alive
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   239
      // point all the oops to the new location
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   240
      size_t size = oop(q)->adjust_pointers();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   241
      size = space->adjust_obj_size(size);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   242
      debug_only(prev_q = q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   243
      q += size;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   244
    } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   245
      // q is not a live object, so its mark should point at the next
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   246
      // live object
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   247
      debug_only(prev_q = q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   248
      q = (HeapWord*) oop(q)->mark()->decode_pointer();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   249
      assert(q > prev_q, "we should be moving forward through memory");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   250
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   251
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   252
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   253
  assert(q == t, "just checking");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   254
}
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   255
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   256
template <class SpaceType>
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   257
inline void CompactibleSpace::scan_and_compact(SpaceType* space) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   258
  // Copy all live objects to their new location
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   259
  // Used by MarkSweep::mark_sweep_phase4()
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   260
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   261
  HeapWord*       q = space->bottom();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   262
  HeapWord* const t = space->_end_of_live;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   263
  debug_only(HeapWord* prev_q = NULL);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   264
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   265
  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   266
    #ifdef ASSERT // Debug only
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   267
      // we have a chunk of the space which hasn't moved and we've reinitialized
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   268
      // the mark word during the previous pass, so we can't use is_gc_marked for
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   269
      // the traversal.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   270
      HeapWord* const end = space->_first_dead;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   271
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   272
      while (q < end) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   273
        size_t size = space->obj_size(q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   274
        assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   275
        prev_q = q;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   276
        q += size;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   277
      }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   278
    #endif
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   279
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   280
    if (space->_first_dead == t) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   281
      q = t;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   282
    } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   283
      // $$$ Funky
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   284
      q = (HeapWord*) oop(space->_first_dead)->mark()->decode_pointer();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   285
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   286
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   287
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   288
  const intx scan_interval = PrefetchScanIntervalInBytes;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   289
  const intx copy_interval = PrefetchCopyIntervalInBytes;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   290
  while (q < t) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   291
    if (!oop(q)->is_gc_marked()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   292
      // mark is pointer to next marked oop
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   293
      debug_only(prev_q = q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   294
      q = (HeapWord*) oop(q)->mark()->decode_pointer();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   295
      assert(q > prev_q, "we should be moving forward through memory");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   296
    } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   297
      // prefetch beyond q
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   298
      Prefetch::read(q, scan_interval);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   299
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   300
      // size and destination
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   301
      size_t size = space->obj_size(q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   302
      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   303
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   304
      // prefetch beyond compaction_top
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   305
      Prefetch::write(compaction_top, copy_interval);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   306
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   307
      // copy object and reinit its mark
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   308
      assert(q != compaction_top, "everything in this pass should be moving");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   309
      Copy::aligned_conjoint_words(q, compaction_top, size);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   310
      oop(compaction_top)->init_mark();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   311
      assert(oop(compaction_top)->klass() != NULL, "should have a class");
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   312
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   313
      debug_only(prev_q = q);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   314
      q += size;
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   315
    }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   316
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   317
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   318
  // Let's remember if we were empty before we did the compaction.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   319
  bool was_empty = space->used_region().is_empty();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   320
  // Reset space after compaction is complete
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   321
  space->reset_after_compaction();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   322
  // We do this clear, below, since it has overloaded meanings for some
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   323
  // space subtypes.  For example, OffsetTableContigSpace's that were
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   324
  // compacted into will have had their offset table thresholds updated
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   325
  // continuously, but those that weren't need to have their thresholds
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   326
  // re-initialized.  Also mangles unused area for debugging.
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   327
  if (space->used_region().is_empty()) {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   328
    if (!was_empty) space->clear(SpaceDecorator::Mangle);
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   329
  } else {
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   330
    if (ZapUnusedHeapArea) space->mangle_unused_area();
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   331
  }
fe43edc5046d 8043243: convert SCAN_AND_FORWARD, SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods
mlarsson
parents: 24487
diff changeset
   332
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   333
#endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP