src/share/vm/opto/macro.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/opto/macro.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,131 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_OPTO_MACRO_HPP
    1.29 +#define SHARE_VM_OPTO_MACRO_HPP
    1.30 +
    1.31 +#include "opto/phase.hpp"
    1.32 +
    1.33 +class  AllocateNode;
    1.34 +class  AllocateArrayNode;
    1.35 +class  CallNode;
    1.36 +class  Node;
    1.37 +class  PhaseIterGVN;
    1.38 +
    1.39 +class PhaseMacroExpand : public Phase {
    1.40 +private:
    1.41 +  PhaseIterGVN &_igvn;
    1.42 +
    1.43 +  // Helper methods roughly modelled after GraphKit:
    1.44 +  Node* top()                   const { return C->top(); }
    1.45 +  Node* intcon(jint con)        const { return _igvn.intcon(con); }
    1.46 +  Node* longcon(jlong con)      const { return _igvn.longcon(con); }
    1.47 +  Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
    1.48 +  Node* basic_plus_adr(Node* base, int offset) {
    1.49 +    return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
    1.50 +  }
    1.51 +  Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
    1.52 +    return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
    1.53 +  }
    1.54 +  Node* basic_plus_adr(Node* base, Node* offset) {
    1.55 +    return basic_plus_adr(base, base, offset);
    1.56 +  }
    1.57 +  Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
    1.58 +    Node* adr = new (C) AddPNode(base, ptr, offset);
    1.59 +    return transform_later(adr);
    1.60 +  }
    1.61 +  Node* transform_later(Node* n) {
    1.62 +    // equivalent to _gvn.transform in GraphKit, Ideal, etc.
    1.63 +    _igvn.register_new_node_with_optimizer(n);
    1.64 +    return n;
    1.65 +  }
    1.66 +  void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
    1.67 +  Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
    1.68 +                   const Type* value_type, BasicType bt);
    1.69 +  Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
    1.70 +                   Node* value, BasicType bt);
    1.71 +
    1.72 +  // projections extracted from a call node
    1.73 +  ProjNode *_fallthroughproj;
    1.74 +  ProjNode *_fallthroughcatchproj;
    1.75 +  ProjNode *_ioproj_fallthrough;
    1.76 +  ProjNode *_ioproj_catchall;
    1.77 +  ProjNode *_catchallcatchproj;
    1.78 +  ProjNode *_memproj_fallthrough;
    1.79 +  ProjNode *_memproj_catchall;
    1.80 +  ProjNode *_resproj;
    1.81 +
    1.82 +  // Additional data collected during macro expansion
    1.83 +  bool _has_locks;
    1.84 +
    1.85 +  void expand_allocate(AllocateNode *alloc);
    1.86 +  void expand_allocate_array(AllocateArrayNode *alloc);
    1.87 +  void expand_allocate_common(AllocateNode* alloc,
    1.88 +                              Node* length,
    1.89 +                              const TypeFunc* slow_call_type,
    1.90 +                              address slow_call_address);
    1.91 +  Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
    1.92 +  Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
    1.93 +
    1.94 +  bool eliminate_boxing_node(CallStaticJavaNode *boxing);
    1.95 +  bool eliminate_allocate_node(AllocateNode *alloc);
    1.96 +  bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
    1.97 +  bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
    1.98 +  void process_users_of_allocation(CallNode *alloc);
    1.99 +
   1.100 +  void eliminate_card_mark(Node *cm);
   1.101 +  void mark_eliminated_box(Node* box, Node* obj);
   1.102 +  void mark_eliminated_locking_nodes(AbstractLockNode *alock);
   1.103 +  bool eliminate_locking_node(AbstractLockNode *alock);
   1.104 +  void expand_lock_node(LockNode *lock);
   1.105 +  void expand_unlock_node(UnlockNode *unlock);
   1.106 +
   1.107 +  int replace_input(Node *use, Node *oldref, Node *newref);
   1.108 +  void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
   1.109 +  Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
   1.110 +  void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
   1.111 +  CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
   1.112 +                       const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
   1.113 +  void extract_call_projections(CallNode *call);
   1.114 +
   1.115 +  Node* initialize_object(AllocateNode* alloc,
   1.116 +                          Node* control, Node* rawmem, Node* object,
   1.117 +                          Node* klass_node, Node* length,
   1.118 +                          Node* size_in_bytes);
   1.119 +
   1.120 +  Node* prefetch_allocation(Node* i_o,
   1.121 +                            Node*& needgc_false, Node*& contended_phi_rawmem,
   1.122 +                            Node* old_eden_top, Node* new_eden_top,
   1.123 +                            Node* length);
   1.124 +
   1.125 +public:
   1.126 +  PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
   1.127 +    _igvn.set_delay_transform(true);
   1.128 +  }
   1.129 +  void eliminate_macro_nodes();
   1.130 +  bool expand_macro_nodes();
   1.131 +
   1.132 +};
   1.133 +
   1.134 +#endif // SHARE_VM_OPTO_MACRO_HPP

mercurial