src/hotspot/share/opto/arraycopynode.hpp
author neliasso
Fri, 29 Nov 2019 11:26:25 +0100
changeset 59324 5e8f9713e343
parent 58931 304c63b17b07
permissions -rw-r--r--
8234520: ZGC: C2: Oop instance cloning causing skipped compiles Reviewed-by: pliden, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52435
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     4
 *
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     8
 *
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    13
 * accompanied this code).
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    14
 *
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    18
 *
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    21
 * questions.
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    22
 *
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    23
 */
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52435
diff changeset
    25
#ifndef SHARE_OPTO_ARRAYCOPYNODE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52435
diff changeset
    26
#define SHARE_OPTO_ARRAYCOPYNODE_HPP
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    27
52435
eac000022f61 8213464: Fix missing include after JDK-8212243
mdoerr
parents: 52424
diff changeset
    28
#include "gc/shared/c2/barrierSetC2.hpp"
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    29
#include "opto/callnode.hpp"
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    30
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    31
class GraphKit;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    32
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    33
class ArrayCopyNode : public CallNode {
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    34
private:
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    35
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    36
  // What kind of arraycopy variant is this?
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    37
  enum {
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    38
    None,            // not set yet
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    39
    ArrayCopy,       // System.arraycopy()
59324
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
    40
    CloneInst,       // A clone of instances
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
    41
    CloneArray,      // A clone of arrays that don't require a barrier
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
    42
                     // - depends on GC - some need to treat oop arrays separately
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
    43
    CloneOopArray,   // An oop array clone that requires GC barriers
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    44
    CopyOf,          // Arrays.copyOf()
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    45
    CopyOfRange      // Arrays.copyOfRange()
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    46
  } _kind;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    47
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    48
#ifndef PRODUCT
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    49
  static const char* _kind_names[CopyOfRange+1];
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    50
#endif
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    51
  // Is the alloc obtained with
54048
744dc9c33676 8217417: Decorator name typo: C2_TIGHLY_COUPLED_ALLOC
kbarrett
parents: 53244
diff changeset
    52
  // AllocateArrayNode::Ideal_array_allocation() tightly coupled
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    53
  // (arraycopy follows immediately the allocation)?
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    54
  // We cache the result of LibraryCallKit::tightly_coupled_allocation
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    55
  // here because it's much easier to find whether there's a tightly
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    56
  // couple allocation at parse time than at macro expansion time. At
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    57
  // macro expansion time, for every use of the allocation node we
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    58
  // would need to figure out whether it happens after the arraycopy (and
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    59
  // can be ignored) or between the allocation and the arraycopy. At
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    60
  // parse time, it's straightforward because whatever happens after
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    61
  // the arraycopy is not parsed yet so doesn't exist when
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    62
  // LibraryCallKit::tightly_coupled_allocation() is called.
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    63
  bool _alloc_tightly_coupled;
42086
feac795f345d 8159611: C2: ArrayCopy elimination skips required parameter checks
simonis
parents: 39254
diff changeset
    64
  bool _has_negative_length_guard;
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    65
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    66
  bool _arguments_validated;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    67
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    68
  static const TypeFunc* arraycopy_type() {
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    69
    const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    70
    fields[Src]       = TypeInstPtr::BOTTOM;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    71
    fields[SrcPos]    = TypeInt::INT;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    72
    fields[Dest]      = TypeInstPtr::BOTTOM;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    73
    fields[DestPos]   = TypeInt::INT;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    74
    fields[Length]    = TypeInt::INT;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    75
    fields[SrcLen]    = TypeInt::INT;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    76
    fields[DestLen]   = TypeInt::INT;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    77
    fields[SrcKlass]  = TypeKlassPtr::BOTTOM;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    78
    fields[DestKlass] = TypeKlassPtr::BOTTOM;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    79
    const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    80
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    81
    // create result type (range)
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    82
    fields = TypeTuple::fields(0);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    83
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    84
    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    85
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    86
    return TypeFunc::make(domain, range);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    87
  }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    88
42086
feac795f345d 8159611: C2: ArrayCopy elimination skips required parameter checks
simonis
parents: 39254
diff changeset
    89
  ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard);
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    90
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    91
  intptr_t get_length_if_constant(PhaseGVN *phase) const;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    92
  int get_count(PhaseGVN *phase) const;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    93
  static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    94
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    95
  Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    96
  bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    97
                          Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    98
                          BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
    99
  void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   100
                               bool disjoint_bases, int count,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   101
                               Node*& forward_ctl, Node*& backward_ctl);
51984
2ef304ee001d 8210887: Tweak C2 gc api for arraycopy
roland
parents: 47216
diff changeset
   102
  Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
2ef304ee001d 8210887: Tweak C2 gc api for arraycopy
roland
parents: 47216
diff changeset
   103
                           MergeMemNode* mm,
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   104
                           const TypePtr* atp_src, const TypePtr* atp_dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   105
                           Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   106
                           BasicType copy_type, const Type* value_type, int count);
51984
2ef304ee001d 8210887: Tweak C2 gc api for arraycopy
roland
parents: 47216
diff changeset
   107
  Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
2ef304ee001d 8210887: Tweak C2 gc api for arraycopy
roland
parents: 47216
diff changeset
   108
                            MergeMemNode* mm,
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   109
                            const TypePtr* atp_src, const TypePtr* atp_dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   110
                            Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   111
                            BasicType copy_type, const Type* value_type, int count);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   112
  bool finish_transform(PhaseGVN *phase, bool can_reshape,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   113
                        Node* ctl, Node *mem);
45427
64e07017ce01 8179678: ArrayCopy with same src and dst can cause incorrect execution or compiler crash
roland
parents: 42086
diff changeset
   114
  static bool may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, CallNode*& call);
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   115
52424
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 51984
diff changeset
   116
  static Node* load(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, const Type *type, BasicType bt);
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 51984
diff changeset
   117
  void store(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, Node* val, const Type *type, BasicType bt);
e3d79743f57d 8212243: More gc interface tweaks for arraycopy
roland
parents: 51984
diff changeset
   118
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   119
public:
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   120
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   121
  enum {
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   122
    Src   = TypeFunc::Parms,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   123
    SrcPos,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   124
    Dest,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   125
    DestPos,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   126
    Length,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   127
    SrcLen,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   128
    DestLen,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   129
    SrcKlass,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   130
    DestKlass,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   131
    ParmLimit
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   132
  };
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   133
30629
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   134
  // Results from escape analysis for non escaping inputs
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   135
  const TypeOopPtr* _src_type;
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   136
  const TypeOopPtr* _dest_type;
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   137
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   138
  static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   139
                             Node* src, Node* src_offset,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   140
                             Node* dest,  Node* dest_offset,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   141
                             Node* length,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   142
                             bool alloc_tightly_coupled,
42086
feac795f345d 8159611: C2: ArrayCopy elimination skips required parameter checks
simonis
parents: 39254
diff changeset
   143
                             bool has_negative_length_guard,
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   144
                             Node* src_klass = NULL, Node* dest_klass = NULL,
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   145
                             Node* src_length = NULL, Node* dest_length = NULL);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   146
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   147
  void connect_outputs(GraphKit* kit);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   148
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   149
  bool is_arraycopy()             const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   150
  bool is_arraycopy_validated()   const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
59324
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   151
  bool is_clone_inst()            const  { assert(_kind != None, "should bet set"); return _kind == CloneInst; }
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   152
  // is_clone_array - true for all arrays when using GCs that has no barriers
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   153
  bool is_clone_array()           const  { assert(_kind != None, "should bet set"); return _kind == CloneArray; }
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   154
  // is_clone_oop_array is used when oop arrays need GC barriers
58931
304c63b17b07 8232896: ZGC: Enable C2 clone intrinsic
neliasso
parents: 54048
diff changeset
   155
  bool is_clone_oop_array()       const  { assert(_kind != None, "should bet set"); return _kind == CloneOopArray; }
59324
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   156
  // is_clonebasic - is true for any type of clone that doesn't need a barrier.
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   157
  bool is_clonebasic()            const  { assert(_kind != None, "should bet set"); return _kind == CloneInst || _kind == CloneArray; }
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   158
  bool is_copyof()                const  { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   159
  bool is_copyof_validated()      const  { assert(_kind != None, "should bet set"); return _kind == CopyOf && _arguments_validated; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   160
  bool is_copyofrange()           const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   161
  bool is_copyofrange_validated() const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange && _arguments_validated; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   162
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   163
  void set_arraycopy(bool validated)   { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
59324
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   164
  void set_clone_inst()                { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneInst; }
5e8f9713e343 8234520: ZGC: C2: Oop instance cloning causing skipped compiles
neliasso
parents: 58931
diff changeset
   165
  void set_clone_array()               { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneArray; }
58931
304c63b17b07 8232896: ZGC: Enable C2 clone intrinsic
neliasso
parents: 54048
diff changeset
   166
  void set_clone_oop_array()           { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOopArray; }
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   167
  void set_copyof(bool validated)      { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = validated; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   168
  void set_copyofrange(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = validated; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   169
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   170
  virtual int Opcode() const;
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   171
  virtual uint size_of() const; // Size is bigger
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   172
  virtual bool guaranteed_safepoint()  { return false; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   173
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   174
30629
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   175
  virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase);
b6e5ad2f18d5 8076188: Optimize arraycopy out for non escaping destination
roland
parents: 29337
diff changeset
   176
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   177
  bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   178
42086
feac795f345d 8159611: C2: ArrayCopy elimination skips required parameter checks
simonis
parents: 39254
diff changeset
   179
  bool has_negative_length_guard() const { return _has_negative_length_guard; }
feac795f345d 8159611: C2: ArrayCopy elimination skips required parameter checks
simonis
parents: 39254
diff changeset
   180
39254
fb4492288b01 8156760: VM crashes if -XX:-ReduceInitialCardMarks is set
thartmann
parents: 35574
diff changeset
   181
  static bool may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac);
45427
64e07017ce01 8179678: ArrayCopy with same src and dst can cause incorrect execution or compiler crash
roland
parents: 42086
diff changeset
   182
  bool modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify) const;
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents: 32084
diff changeset
   183
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   184
#ifndef PRODUCT
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   185
  virtual void dump_spec(outputStream *st) const;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30629
diff changeset
   186
  virtual void dump_compact_spec(outputStream* st) const;
29337
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   187
#endif
ef2be52deeaf 6912521: System.arraycopy works slower than the simple loop for little lengths
roland
parents:
diff changeset
   188
};
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52435
diff changeset
   189
#endif // SHARE_OPTO_ARRAYCOPYNODE_HPP