hotspot/src/share/vm/opto/macro.hpp
author coleenp
Sun, 13 Apr 2008 17:43:42 -0400
changeset 360 21d113ecbf6a
parent 246 b029af7e69d3
child 670 ddf3e9583f2f
permissions -rw-r--r--
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
class  AllocateNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
class  AllocateArrayNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
class  CallNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
class  Node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
class  PhaseIterGVN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
class PhaseMacroExpand : public Phase {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  PhaseIterGVN &_igvn;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  // Helper methods roughly modelled after GraphKit:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  Node* top()                   const { return C->top(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  Node* intcon(jint con)        const { return _igvn.intcon(con); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  Node* longcon(jlong con)      const { return _igvn.longcon(con); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  Node* basic_plus_adr(Node* base, int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  Node* basic_plus_adr(Node* base, Node* offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    return basic_plus_adr(base, base, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    Node* adr = new (C, 4) AddPNode(base, ptr, offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    return transform_later(adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  Node* transform_later(Node* n) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    // equivalent to _gvn.transform in GraphKit, Ideal, etc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    _igvn.register_new_node_with_optimizer(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    return n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
                   const Type* value_type, BasicType bt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
                   Node* value, BasicType bt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // projections extracted from a call node
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  ProjNode *_fallthroughproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  ProjNode *_fallthroughcatchproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  ProjNode *_ioproj_fallthrough;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  ProjNode *_ioproj_catchall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  ProjNode *_catchallcatchproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  ProjNode *_memproj_fallthrough;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  ProjNode *_memproj_catchall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  ProjNode *_resproj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  void expand_allocate(AllocateNode *alloc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  void expand_allocate_array(AllocateArrayNode *alloc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  void expand_allocate_common(AllocateNode* alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
                              Node* length,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
                              const TypeFunc* slow_call_type,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
                              address slow_call_address);
246
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    81
  Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    82
  Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, int level);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    83
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    84
  bool eliminate_allocate_node(AllocateNode *alloc);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    85
  bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    86
  bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    87
  void process_users_of_allocation(AllocateNode *alloc);
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    88
b029af7e69d3 6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents: 239
diff changeset
    89
  void eliminate_card_mark(Node *cm);
239
fb31825d5444 6672848: (Escape Analysis) improve lock elimination with EA
kvn
parents: 1
diff changeset
    90
  bool eliminate_locking_node(AbstractLockNode *alock);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  void expand_lock_node(LockNode *lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  void expand_unlock_node(UnlockNode *unlock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  int replace_input(Node *use, Node *oldref, Node *newref);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  Node* opt_iff(Node* region, Node* iff);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
                       const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  void extract_call_projections(CallNode *call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  Node* initialize_object(AllocateNode* alloc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                          Node* control, Node* rawmem, Node* object,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
                          Node* klass_node, Node* length,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
                          Node* size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  Node* prefetch_allocation(Node* i_o,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
                            Node*& needgc_false, Node*& contended_phi_rawmem,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
                            Node* old_eden_top, Node* new_eden_top,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                            Node* length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
public:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 246
diff changeset
   113
  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
   114
    _igvn.set_delay_transform(true);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 246
diff changeset
   115
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  bool expand_macro_nodes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
};