src/hotspot/share/oops/access.inline.hpp
author coleenp
Wed, 24 Jul 2019 10:22:11 -0400
changeset 57511 00ae3b739184
parent 53207 b1c6d4d7f801
child 58176 470af058bd5f
permissions -rw-r--r--
8228485: JVM crashes when bootstrap method for condy triggers loading of class whose static initializer throws exception Summary: Add case for JVM_CONSTANT_Dynamic in error_message function. Reviewed-by: dholmes, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     1
/*
48628
69d65d9dcadb 8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents: 47998
diff changeset
     2
 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     4
 *
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     8
 *
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    13
 * accompanied this code).
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    14
 *
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    18
 *
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    21
 * questions.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    22
 *
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    23
 */
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    24
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    25
#ifndef SHARE_OOPS_ACCESS_INLINE_HPP
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    26
#define SHARE_OOPS_ACCESS_INLINE_HPP
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    27
53207
b1c6d4d7f801 8215724: Epsilon: ArrayStoreExceptionTest.java fails; missing arraycopy check
shade
parents: 50389
diff changeset
    28
#include "gc/shared/barrierSet.inline.hpp"
49347
edb65305d3ac 8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents: 49041
diff changeset
    29
#include "gc/shared/barrierSetConfig.inline.hpp"
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    30
#include "oops/access.hpp"
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    31
#include "oops/accessBackend.inline.hpp"
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    32
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    33
// This file outlines the last 2 steps of the template pipeline of accesses going through
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    34
// the Access API.
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    35
// * Step 5.a: Barrier resolution. This step is invoked the first time a runtime-dispatch
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    36
//             happens for an access. The appropriate BarrierSet::AccessBarrier accessor
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    37
//             is resolved, then the function pointer is updated to that accessor for
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    38
//             future invocations.
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    39
// * Step 5.b: Post-runtime dispatch. This step now casts previously unknown types such
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    40
//             as the address type of an oop on the heap (is it oop* or narrowOop*) to
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    41
//             the appropriate type. It also splits sufficiently orthogonal accesses into
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    42
//             different functions, such as whether the access involves oops or primitives
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    43
//             and whether the access is performed on the heap or outside. Then the
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    44
//             appropriate BarrierSet::AccessBarrier is called to perform the access.
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    45
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    46
namespace AccessInternal {
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
    47
  // Step 5.b: Post-runtime dispatch.
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    48
  // This class is the last step before calling the BarrierSet::AccessBarrier.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    49
  // Here we make sure to figure out types that were not known prior to the
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    50
  // runtime dispatch, such as whether an oop on the heap is oop or narrowOop.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    51
  // We also split orthogonal barriers such as handling primitives vs oops
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    52
  // and on-heap vs off-heap into different calls to the barrier set.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    53
  template <class GCBarrierType, BarrierType type, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    54
  struct PostRuntimeDispatch: public AllStatic { };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    55
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    56
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    57
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    58
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    59
    static void access_barrier(void* addr, T value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    60
      GCBarrierType::store_in_heap(reinterpret_cast<T*>(addr), value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    61
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    62
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    63
    static void oop_access_barrier(void* addr, oop value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    64
      typedef typename HeapOopType<decorators>::type OopType;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    65
      if (HasDecorator<decorators, IN_HEAP>::value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    66
        GCBarrierType::oop_store_in_heap(reinterpret_cast<OopType*>(addr), value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    67
      } else {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    68
        GCBarrierType::oop_store_not_in_heap(reinterpret_cast<OopType*>(addr), value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    69
      }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    70
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    71
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    72
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    73
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    74
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    75
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    76
    static T access_barrier(void* addr) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    77
      return GCBarrierType::load_in_heap(reinterpret_cast<T*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    78
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    79
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    80
    static oop oop_access_barrier(void* addr) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    81
      typedef typename HeapOopType<decorators>::type OopType;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    82
      if (HasDecorator<decorators, IN_HEAP>::value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    83
        return GCBarrierType::oop_load_in_heap(reinterpret_cast<OopType*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    84
      } else {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    85
        return GCBarrierType::oop_load_not_in_heap(reinterpret_cast<OopType*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    86
      }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    87
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    88
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    89
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    90
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    91
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    92
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    93
    static T access_barrier(T new_value, void* addr) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    94
      return GCBarrierType::atomic_xchg_in_heap(new_value, reinterpret_cast<T*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    95
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    96
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    97
    static oop oop_access_barrier(oop new_value, void* addr) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    98
      typedef typename HeapOopType<decorators>::type OopType;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
    99
      if (HasDecorator<decorators, IN_HEAP>::value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   100
        return GCBarrierType::oop_atomic_xchg_in_heap(new_value, reinterpret_cast<OopType*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   101
      } else {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   102
        return GCBarrierType::oop_atomic_xchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr));
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   103
      }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   104
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   105
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   106
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   107
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   108
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   109
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   110
    static T access_barrier(T new_value, void* addr, T compare_value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   111
      return GCBarrierType::atomic_cmpxchg_in_heap(new_value, reinterpret_cast<T*>(addr), compare_value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   112
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   113
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   114
    static oop oop_access_barrier(oop new_value, void* addr, oop compare_value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   115
      typedef typename HeapOopType<decorators>::type OopType;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   116
      if (HasDecorator<decorators, IN_HEAP>::value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   117
        return GCBarrierType::oop_atomic_cmpxchg_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   118
      } else {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   119
        return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   120
      }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   121
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   122
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   123
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   124
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   125
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_ARRAYCOPY, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   126
    template <typename T>
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   127
    static bool access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   128
                               arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   129
                               size_t length) {
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   130
      GCBarrierType::arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   131
                                       dst_obj, dst_offset_in_bytes, dst_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   132
                                       length);
49383
bf2ff45e592f 8198445: Access API for primitive/native arraycopy
rkennke
parents: 49347
diff changeset
   133
      return true;
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   134
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   135
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   136
    template <typename T>
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   137
    static bool oop_access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   138
                                   arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   139
                                   size_t length) {
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   140
      typedef typename HeapOopType<decorators>::type OopType;
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   141
      return GCBarrierType::oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, reinterpret_cast<OopType*>(src_raw),
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   142
                                                  dst_obj, dst_offset_in_bytes, reinterpret_cast<OopType*>(dst_raw),
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   143
                                                  length);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   144
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   145
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   146
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   147
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   148
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_STORE_AT, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   149
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   150
    static void access_barrier(oop base, ptrdiff_t offset, T value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   151
      GCBarrierType::store_in_heap_at(base, offset, value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   152
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   153
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   154
    static void oop_access_barrier(oop base, ptrdiff_t offset, oop value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   155
      GCBarrierType::oop_store_in_heap_at(base, offset, value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   156
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   157
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   158
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   159
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   160
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD_AT, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   161
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   162
    static T access_barrier(oop base, ptrdiff_t offset) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   163
      return GCBarrierType::template load_in_heap_at<T>(base, offset);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   164
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   165
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   166
    static oop oop_access_barrier(oop base, ptrdiff_t offset) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   167
      return GCBarrierType::oop_load_in_heap_at(base, offset);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   168
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   169
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   170
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   171
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   172
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   173
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   174
    static T access_barrier(T new_value, oop base, ptrdiff_t offset) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   175
      return GCBarrierType::atomic_xchg_in_heap_at(new_value, base, offset);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   176
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   177
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   178
    static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   179
      return GCBarrierType::oop_atomic_xchg_in_heap_at(new_value, base, offset);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   180
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   181
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   182
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   183
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   184
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   185
    template <typename T>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   186
    static T access_barrier(T new_value, oop base, ptrdiff_t offset, T compare_value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   187
      return GCBarrierType::atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   188
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   189
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   190
    static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset, oop compare_value) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   191
      return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   192
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   193
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   194
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   195
  template <class GCBarrierType, DecoratorSet decorators>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   196
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   197
    static void access_barrier(oop src, oop dst, size_t size) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   198
      GCBarrierType::clone_in_heap(src, dst, size);
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   199
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   200
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   201
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   202
  template <class GCBarrierType, DecoratorSet decorators>
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   203
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_RESOLVE, decorators>: public AllStatic {
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   204
    static oop access_barrier(oop obj) {
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   205
      return GCBarrierType::resolve(obj);
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   206
    }
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   207
  };
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   208
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   209
  template <class GCBarrierType, DecoratorSet decorators>
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   210
  struct PostRuntimeDispatch<GCBarrierType, BARRIER_EQUALS, decorators>: public AllStatic {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   211
    static bool access_barrier(oop o1, oop o2) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   212
      return GCBarrierType::equals(o1, o2);
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   213
    }
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   214
  };
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   215
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   216
  // Resolving accessors with barriers from the barrier set happens in two steps.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   217
  // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   218
  // 2. Expand paths for each BarrierSet available in the system.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   219
  template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   220
  struct BarrierResolver: public AllStatic {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   221
    template <DecoratorSet ds>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   222
    static typename EnableIf<
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   223
      HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value,
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   224
      FunctionPointerT>::type
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   225
    resolve_barrier_gc() {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   226
      BarrierSet* bs = BarrierSet::barrier_set();
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   227
      assert(bs != NULL, "GC barriers invoked before BarrierSet is set");
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   228
      switch (bs->kind()) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   229
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name)                    \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   230
        case BarrierSet::bs_name: {                                     \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   231
          return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   232
            AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   233
        }                                                               \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   234
        break;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   235
        FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE)
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   236
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   237
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   238
      default:
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   239
        fatal("BarrierSet AccessBarrier resolving not implemented");
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   240
        return NULL;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   241
      };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   242
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   243
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   244
    template <DecoratorSet ds>
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   245
    static typename EnableIf<
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   246
      !HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value,
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   247
      FunctionPointerT>::type
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   248
    resolve_barrier_gc() {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   249
      BarrierSet* bs = BarrierSet::barrier_set();
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   250
      assert(bs != NULL, "GC barriers invoked before BarrierSet is set");
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   251
      switch (bs->kind()) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   252
#define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name)                    \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   253
        case BarrierSet::bs_name: {                                       \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   254
          return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   255
            AccessBarrier<ds>, barrier_type, ds>::access_barrier; \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   256
        }                                                                 \
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   257
        break;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   258
        FOR_EACH_CONCRETE_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE)
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   259
#undef BARRIER_SET_RESOLVE_BARRIER_CLOSURE
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   260
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   261
      default:
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   262
        fatal("BarrierSet AccessBarrier resolving not implemented");
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   263
        return NULL;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   264
      };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   265
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   266
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   267
    static FunctionPointerT resolve_barrier_rt() {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   268
      if (UseCompressedOops) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   269
        const DecoratorSet expanded_decorators = decorators | INTERNAL_RT_USE_COMPRESSED_OOPS;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   270
        return resolve_barrier_gc<expanded_decorators>();
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   271
      } else {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   272
        return resolve_barrier_gc<decorators>();
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   273
      }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   274
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   275
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   276
    static FunctionPointerT resolve_barrier() {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   277
      return resolve_barrier_rt();
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   278
    }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   279
  };
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   280
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   281
  // Step 5.a: Barrier resolution
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   282
  // The RuntimeDispatch class is responsible for performing a runtime dispatch of the
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   283
  // accessor. This is required when the access either depends on whether compressed oops
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   284
  // is being used, or it depends on which GC implementation was chosen (e.g. requires GC
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   285
  // barriers). The way it works is that a function pointer initially pointing to an
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   286
  // accessor resolution function gets called for each access. Upon first invocation,
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   287
  // it resolves which accessor to be used in future invocations and patches the
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   288
  // function pointer to this new accessor.
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   289
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   290
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   291
  void RuntimeDispatch<decorators, T, BARRIER_STORE>::store_init(void* addr, T value) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   292
    func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   293
    _store_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   294
    function(addr, value);
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   295
  }
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   296
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   297
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   298
  void RuntimeDispatch<decorators, T, BARRIER_STORE_AT>::store_at_init(oop base, ptrdiff_t offset, T value) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   299
    func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE_AT>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   300
    _store_at_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   301
    function(base, offset, value);
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   302
  }
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   303
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   304
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   305
  T RuntimeDispatch<decorators, T, BARRIER_LOAD>::load_init(void* addr) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   306
    func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   307
    _load_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   308
    return function(addr);
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   309
  }
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   310
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   311
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   312
  T RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::load_at_init(oop base, ptrdiff_t offset) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   313
    func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD_AT>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   314
    _load_at_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   315
    return function(base, offset);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   316
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   317
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   318
  template <DecoratorSet decorators, typename T>
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   319
  T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::atomic_cmpxchg_init(T new_value, void* addr, T compare_value) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   320
    func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   321
    _atomic_cmpxchg_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   322
    return function(new_value, addr, compare_value);
48628
69d65d9dcadb 8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents: 47998
diff changeset
   323
  }
69d65d9dcadb 8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents: 47998
diff changeset
   324
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   325
  template <DecoratorSet decorators, typename T>
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   326
  T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::atomic_cmpxchg_at_init(T new_value, oop base, ptrdiff_t offset, T compare_value) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   327
    func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   328
    _atomic_cmpxchg_at_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   329
    return function(new_value, base, offset, compare_value);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   330
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   331
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   332
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   333
  T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg_init(T new_value, void* addr) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   334
    func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   335
    _atomic_xchg_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   336
    return function(new_value, addr);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   337
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   338
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   339
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   340
  T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::atomic_xchg_at_init(T new_value, oop base, ptrdiff_t offset) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   341
    func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   342
    _atomic_xchg_at_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   343
    return function(new_value, base, offset);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   344
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   345
49454
689ebcfe04fd 8199685: Access arraycopy build failure with GCC 7.3.1
eosterlund
parents: 49383
diff changeset
   346
  template <DecoratorSet decorators, typename T>
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   347
  bool RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   348
                                                                         arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   349
                                                                         size_t length) {
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   350
    func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   351
    _arraycopy_func = function;
50389
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   352
    return function(src_obj, src_offset_in_bytes, src_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   353
                    dst_obj, dst_offset_in_bytes, dst_raw,
7e8c0409a747 8198285: More consistent Access API for arraycopy
rkennke
parents: 49658
diff changeset
   354
                    length);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   355
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   356
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   357
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   358
  void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   359
    func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   360
    _clone_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   361
    function(src, dst, size);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   362
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   363
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   364
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   365
  oop RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::resolve_init(oop obj) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   366
    func_t function = BarrierResolver<decorators, func_t, BARRIER_RESOLVE>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   367
    _resolve_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   368
    return function(obj);
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   369
  }
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   370
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   371
  template <DecoratorSet decorators, typename T>
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   372
  bool RuntimeDispatch<decorators, T, BARRIER_EQUALS>::equals_init(oop o1, oop o2) {
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   373
    func_t function = BarrierResolver<decorators, func_t, BARRIER_EQUALS>::resolve_barrier();
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   374
    _equals_func = function;
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   375
    return function(o1, o2);
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48966
diff changeset
   376
  }
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   377
}
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
diff changeset
   378
49658
8237a91c1cca 8199781: Don't use naked == for comparing oops
rkennke
parents: 49454
diff changeset
   379
#endif // SHARE_OOPS_ACCESS_INLINE_HPP