hotspot/src/share/vm/opto/macro.hpp
author kvn
Tue, 05 Nov 2013 17:38:04 -0800
changeset 22838 82c7497fbad4
parent 17383 3665c0901a0d
child 22234 da823d78ad65
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 13895
diff changeset
     2
 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1500
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1500
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1500
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OPTO_MACRO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OPTO_MACRO_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/phase.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
class  AllocateNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
class  AllocateArrayNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
class  CallNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class  Node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class  PhaseIterGVN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class PhaseMacroExpand : public Phase {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  PhaseIterGVN &_igvn;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // Helper methods roughly modelled after GraphKit:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  Node* top()                   const { return C->top(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  Node* intcon(jint con)        const { return _igvn.intcon(con); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  Node* longcon(jlong con)      const { return _igvn.longcon(con); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  Node* basic_plus_adr(Node* base, int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  Node* basic_plus_adr(Node* base, Node* offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    return basic_plus_adr(base, base, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
13895
f6dfe4123709 7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents: 11445
diff changeset
    55
    Node* adr = new (C) AddPNode(base, ptr, offset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    return transform_later(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  Node* transform_later(Node* n) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    // equivalent to _gvn.transform in GraphKit, Ideal, etc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    _igvn.register_new_node_with_optimizer(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    return n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
                   const Type* value_type, BasicType bt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
                   Node* value, BasicType bt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // projections extracted from a call node
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  ProjNode *_fallthroughproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  ProjNode *_fallthroughcatchproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  ProjNode *_ioproj_fallthrough;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  ProjNode *_ioproj_catchall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  ProjNode *_catchallcatchproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ProjNode *_memproj_fallthrough;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  ProjNode *_memproj_catchall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  ProjNode *_resproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  void expand_allocate(AllocateNode *alloc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  void expand_allocate_array(AllocateArrayNode *alloc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  void expand_allocate_common(AllocateNode* alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                              Node* length,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                              const TypeFunc* slow_call_type,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                              address slow_call_address);
246
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    86
  Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents: 670
diff changeset
    87
  Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
246
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    88
17383
3665c0901a0d 6934604: enable parts of EliminateAutoBox by default
kvn
parents: 13963
diff changeset
    89
  bool eliminate_boxing_node(CallStaticJavaNode *boxing);
246
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    90
  bool eliminate_allocate_node(AllocateNode *alloc);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    91
  bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    92
  bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
17383
3665c0901a0d 6934604: enable parts of EliminateAutoBox by default
kvn
parents: 13963
diff changeset
    93
  void process_users_of_allocation(CallNode *alloc);
246
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    94
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    95
  void eliminate_card_mark(Node *cm);
11445
3c768dca60f5 7125896: Eliminate nested locks
kvn
parents: 11191
diff changeset
    96
  void mark_eliminated_box(Node* box, Node* obj);
9977
c23d1a8dcaa9 7050280: assert(u->as_Unlock()->is_eliminated()) failed: sanity
kvn
parents: 7397
diff changeset
    97
  void mark_eliminated_locking_nodes(AbstractLockNode *alock);
239
fb31825d5444 6672848: (Escape Analysis) improve lock elimination with EA
kvn
parents: 1
diff changeset
    98
  bool eliminate_locking_node(AbstractLockNode *alock);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  void expand_lock_node(LockNode *lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  void expand_unlock_node(UnlockNode *unlock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  int replace_input(Node *use, Node *oldref, Node *newref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
1500
bea9a90f3e8f 6462850: generate biased locking code in C2 ideal graph
kvn
parents: 955
diff changeset
   104
  Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
                       const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  void extract_call_projections(CallNode *call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  Node* initialize_object(AllocateNode* alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
                          Node* control, Node* rawmem, Node* object,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                          Node* klass_node, Node* length,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
                          Node* size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  Node* prefetch_allocation(Node* i_o,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
                            Node*& needgc_false, Node*& contended_phi_rawmem,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
                            Node* old_eden_top, Node* new_eden_top,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
                            Node* length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
public:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 246
diff changeset
   121
  PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 246
diff changeset
   122
    _igvn.set_delay_transform(true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 246
diff changeset
   123
  }
11191
d54ab5dcba83 6890673: Eliminate allocations immediately after EA
kvn
parents: 9977
diff changeset
   124
  void eliminate_macro_nodes();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  bool expand_macro_nodes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   128
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   129
#endif // SHARE_VM_OPTO_MACRO_HPP