src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58516 d376d86b0a01
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     1
/*
53223
df6cbf676c70 8215708: ZGC: Add missing LoadBarrierNode::size_of()
pliden
parents: 52711
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     4
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     8
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    13
 * accompanied this code).
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    14
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    18
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    21
 * questions.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    22
 */
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    23
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    24
#ifndef SHARE_GC_Z_C2_ZBARRIERSETC2_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    25
#define SHARE_GC_Z_C2_ZBARRIERSETC2_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    26
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    27
#include "gc/shared/c2/barrierSetC2.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    28
#include "memory/allocation.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    29
#include "opto/node.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    30
#include "utilities/growableArray.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    31
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    32
const uint8_t ZLoadBarrierStrong = 1;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    33
const uint8_t ZLoadBarrierWeak   = 2;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    34
const uint8_t ZLoadBarrierElided = 3;
55307
ed12027517c0 8224675: Late GC barrier insertion for ZGC
neliasso
parents: 54327
diff changeset
    35
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    36
class ZLoadBarrierStubC2 : public ResourceObj {
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    37
private:
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    38
  const MachNode* _node;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    39
  const Address   _ref_addr;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    40
  const Register  _ref;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    41
  const Register  _tmp;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    42
  const bool      _weak;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    43
  Label           _entry;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    44
  Label           _continuation;
55307
ed12027517c0 8224675: Late GC barrier insertion for ZGC
neliasso
parents: 54327
diff changeset
    45
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    46
  ZLoadBarrierStubC2(const MachNode* node, Address ref_addr, Register ref, Register tmp, bool weak);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    47
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    48
public:
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    49
  static ZLoadBarrierStubC2* create(const MachNode* node, Address ref_addr, Register ref, Register tmp, bool weak);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    50
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    51
  Address ref_addr() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    52
  Register ref() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    53
  Register tmp() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    54
  address slow_path() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    55
  RegMask& live() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    56
  Label* entry();
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    57
  Label* continuation();
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    58
};
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    59
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    60
class ZBarrierSetC2 : public BarrierSetC2 {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    61
private:
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    62
  void compute_liveness_at_stubs() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    63
  void analyze_dominating_barriers() const;
52426
38bf0c9c4e64 8213384: Move G1/C2 barrier verification into G1BarrierSetC2
rkennke
parents: 52424
diff changeset
    64
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    65
protected:
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    66
  virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;
52424
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 52224
diff changeset
    67
  virtual Node* atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access,
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    68
                                               Node* expected_val,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    69
                                               Node* new_val,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    70
                                               const Type* val_type) const;
52424
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 52224
diff changeset
    71
  virtual Node* atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& access,
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    72
                                                Node* expected_val,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    73
                                                Node* new_val,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    74
                                                const Type* value_type) const;
52424
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 52224
diff changeset
    75
  virtual Node* atomic_xchg_at_resolved(C2AtomicParseAccess& access,
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    76
                                        Node* new_val,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    77
                                        const Type* val_type) const;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    78
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    79
public:
55307
ed12027517c0 8224675: Late GC barrier insertion for ZGC
neliasso
parents: 54327
diff changeset
    80
  virtual void* create_barrier_state(Arena* comp_arena) const;
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    81
  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc,
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    82
                                               BasicType type,
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    83
                                               bool is_clone,
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    84
                                               ArrayCopyPhase phase) const;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    85
58516
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    86
  virtual void late_barrier_analysis() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    87
  virtual int estimate_stub_size() const;
d376d86b0a01 8230565: ZGC: Redesign C2 load barrier to expand on the MachNode level
eosterlund
parents: 57904
diff changeset
    88
  virtual void emit_stubs(CodeBuffer& cb) const;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    89
};
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    90
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    91
#endif // SHARE_GC_Z_C2_ZBARRIERSETC2_HPP