hotspot/src/share/vm/oops/instanceKlass.inline.hpp
author sjohanss
Wed, 02 Sep 2015 09:14:04 +0200
changeset 32606 fdaa30d06ada
parent 30880 efe35e08179f
child 37092 0e56e3c9d545
permissions -rw-r--r--
8129417: Oop iteration clean-up to remove oop_ms_follow_contents Reviewed-by: pliden, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     1
/*
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     4
 *
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     8
 *
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    13
 * accompanied this code).
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    14
 *
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    18
 *
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    21
 * questions.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    22
 *
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    23
 */
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    24
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    25
#ifndef SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    26
#define SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    27
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    28
#include "memory/iterator.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    29
#include "oops/instanceKlass.hpp"
30880
efe35e08179f 8080746: Refactor oop iteration macros to be more general
sjohanss
parents: 30151
diff changeset
    30
#include "oops/klass.hpp"
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    31
#include "oops/oop.inline.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    32
#include "utilities/debug.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    33
#include "utilities/globalDefinitions.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    34
#include "utilities/macros.hpp"
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    35
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    36
// The iteration over the oops in objects is a hot path in the GC code.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    37
// By force inlining the following functions, we get similar GC performance
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    38
// as the previous macro based implementation.
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    39
#ifdef TARGET_COMPILER_visCPP
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    40
#define INLINE __forceinline
32606
fdaa30d06ada 8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents: 30880
diff changeset
    41
#elif defined(TARGET_COMPILER_sparcWorks)
fdaa30d06ada 8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents: 30880
diff changeset
    42
#define INLINE __attribute__((always_inline))
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    43
#else
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    44
#define INLINE inline
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    45
#endif
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    46
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    47
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    48
INLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    49
  T* p         = (T*)obj->obj_field_addr<T>(map->offset());
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    50
  T* const end = p + map->count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    51
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    52
  for (; p < end; ++p) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    53
    Devirtualizer<nv>::do_oop(closure, p);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    54
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    55
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    56
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    57
#if INCLUDE_ALL_GCS
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    58
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    59
INLINE void InstanceKlass::oop_oop_iterate_oop_map_reverse(OopMapBlock* map, oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    60
  T* const start = (T*)obj->obj_field_addr<T>(map->offset());
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    61
  T*       p     = start + map->count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    62
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    63
  while (start < p) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    64
    --p;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    65
    Devirtualizer<nv>::do_oop(closure, p);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    66
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    67
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    68
#endif
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    69
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    70
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    71
INLINE void InstanceKlass::oop_oop_iterate_oop_map_bounded(OopMapBlock* map, oop obj, OopClosureType* closure, MemRegion mr) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    72
  T* p   = (T*)obj->obj_field_addr<T>(map->offset());
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    73
  T* end = p + map->count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    74
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    75
  T* const l   = (T*)mr.start();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    76
  T* const h   = (T*)mr.end();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    77
  assert(mask_bits((intptr_t)l, sizeof(T)-1) == 0 &&
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    78
         mask_bits((intptr_t)h, sizeof(T)-1) == 0,
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    79
         "bounded region must be properly aligned");
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    80
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    81
  if (p < l) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    82
    p = l;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    83
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    84
  if (end > h) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    85
    end = h;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    86
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    87
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    88
  for (;p < end; ++p) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    89
    Devirtualizer<nv>::do_oop(closure, p);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    90
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    91
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    92
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    93
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    94
INLINE void InstanceKlass::oop_oop_iterate_oop_maps_specialized(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    95
  OopMapBlock* map           = start_of_nonstatic_oop_maps();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    96
  OopMapBlock* const end_map = map + nonstatic_oop_map_count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    97
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    98
  for (; map < end_map; ++map) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
    99
    oop_oop_iterate_oop_map<nv, T>(map, obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   100
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   101
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   102
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   103
#if INCLUDE_ALL_GCS
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   104
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   105
INLINE void InstanceKlass::oop_oop_iterate_oop_maps_specialized_reverse(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   106
  OopMapBlock* const start_map = start_of_nonstatic_oop_maps();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   107
  OopMapBlock* map             = start_map + nonstatic_oop_map_count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   108
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   109
  while (start_map < map) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   110
    --map;
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   111
    oop_oop_iterate_oop_map_reverse<nv, T>(map, obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   112
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   113
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   114
#endif
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   115
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   116
template <bool nv, typename T, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   117
INLINE void InstanceKlass::oop_oop_iterate_oop_maps_specialized_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   118
  OopMapBlock* map           = start_of_nonstatic_oop_maps();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   119
  OopMapBlock* const end_map = map + nonstatic_oop_map_count();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   120
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   121
  for (;map < end_map; ++map) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   122
    oop_oop_iterate_oop_map_bounded<nv, T>(map, obj, closure, mr);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   123
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   124
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   125
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   126
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   127
INLINE void InstanceKlass::oop_oop_iterate_oop_maps(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   128
  if (UseCompressedOops) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   129
    oop_oop_iterate_oop_maps_specialized<nv, narrowOop>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   130
  } else {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   131
    oop_oop_iterate_oop_maps_specialized<nv, oop>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   132
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   133
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   134
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   135
#if INCLUDE_ALL_GCS
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   136
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   137
INLINE void InstanceKlass::oop_oop_iterate_oop_maps_reverse(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   138
  if (UseCompressedOops) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   139
    oop_oop_iterate_oop_maps_specialized_reverse<nv, narrowOop>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   140
  } else {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   141
    oop_oop_iterate_oop_maps_specialized_reverse<nv, oop>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   142
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   143
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   144
#endif
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   145
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   146
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   147
INLINE void InstanceKlass::oop_oop_iterate_oop_maps_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   148
  if (UseCompressedOops) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   149
    oop_oop_iterate_oop_maps_specialized_bounded<nv, narrowOop>(obj, closure, mr);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   150
  } else {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   151
    oop_oop_iterate_oop_maps_specialized_bounded<nv, oop>(obj, closure, mr);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   152
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   153
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   154
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   155
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   156
INLINE int InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   157
  if (Devirtualizer<nv>::do_metadata(closure)) {
30151
c7cdaa576875 8076456: Remove unnecessary oopDesc::klass() calls
stefank
parents: 30150
diff changeset
   158
    Devirtualizer<nv>::do_klass(closure, this);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   159
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   160
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   161
  oop_oop_iterate_oop_maps<nv>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   162
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   163
  return size_helper();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   164
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   165
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   166
#if INCLUDE_ALL_GCS
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   167
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   168
INLINE int InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   169
  assert(!Devirtualizer<nv>::do_metadata(closure),
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   170
      "Code to handle metadata is not implemented");
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   171
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   172
  oop_oop_iterate_oop_maps_reverse<nv>(obj, closure);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   173
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   174
  return size_helper();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   175
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   176
#endif
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   177
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   178
template <bool nv, class OopClosureType>
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   179
INLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   180
  if (Devirtualizer<nv>::do_metadata(closure)) {
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   181
    if (mr.contains(obj)) {
30151
c7cdaa576875 8076456: Remove unnecessary oopDesc::klass() calls
stefank
parents: 30150
diff changeset
   182
      Devirtualizer<nv>::do_klass(closure, this);
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   183
    }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   184
  }
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   185
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   186
  oop_oop_iterate_oop_maps_bounded<nv>(obj, closure, mr);
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   187
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   188
  return size_helper();
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   189
}
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   190
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   191
#undef INLINE
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   192
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   193
#define ALL_INSTANCE_KLASS_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)  \
30880
efe35e08179f 8080746: Refactor oop iteration macros to be more general
sjohanss
parents: 30151
diff changeset
   194
  OOP_OOP_ITERATE_DEFN(          InstanceKlass, OopClosureType, nv_suffix)  \
efe35e08179f 8080746: Refactor oop iteration macros to be more general
sjohanss
parents: 30151
diff changeset
   195
  OOP_OOP_ITERATE_DEFN_BOUNDED(  InstanceKlass, OopClosureType, nv_suffix)  \
efe35e08179f 8080746: Refactor oop iteration macros to be more general
sjohanss
parents: 30151
diff changeset
   196
  OOP_OOP_ITERATE_DEFN_BACKWARDS(InstanceKlass, OopClosureType, nv_suffix)
30150
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   197
d9c940aa42ef 8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
diff changeset
   198
#endif // SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP