src/share/vm/opto/macro.hpp

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_OPTO_MACRO_HPP
aoqi@0 26 #define SHARE_VM_OPTO_MACRO_HPP
aoqi@0 27
aoqi@0 28 #include "opto/phase.hpp"
aoqi@0 29
aoqi@0 30 class AllocateNode;
aoqi@0 31 class AllocateArrayNode;
aoqi@0 32 class CallNode;
aoqi@0 33 class Node;
aoqi@0 34 class PhaseIterGVN;
aoqi@0 35
aoqi@0 36 class PhaseMacroExpand : public Phase {
aoqi@0 37 private:
aoqi@0 38 PhaseIterGVN &_igvn;
aoqi@0 39
aoqi@0 40 // Helper methods roughly modelled after GraphKit:
aoqi@0 41 Node* top() const { return C->top(); }
aoqi@0 42 Node* intcon(jint con) const { return _igvn.intcon(con); }
aoqi@0 43 Node* longcon(jlong con) const { return _igvn.longcon(con); }
aoqi@0 44 Node* makecon(const Type *t) const { return _igvn.makecon(t); }
aoqi@0 45 Node* basic_plus_adr(Node* base, int offset) {
aoqi@0 46 return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
aoqi@0 47 }
aoqi@0 48 Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
aoqi@0 49 return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
aoqi@0 50 }
aoqi@0 51 Node* basic_plus_adr(Node* base, Node* offset) {
aoqi@0 52 return basic_plus_adr(base, base, offset);
aoqi@0 53 }
aoqi@0 54 Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
aoqi@0 55 Node* adr = new (C) AddPNode(base, ptr, offset);
aoqi@0 56 return transform_later(adr);
aoqi@0 57 }
aoqi@0 58 Node* transform_later(Node* n) {
aoqi@0 59 // equivalent to _gvn.transform in GraphKit, Ideal, etc.
aoqi@0 60 _igvn.register_new_node_with_optimizer(n);
aoqi@0 61 return n;
aoqi@0 62 }
aoqi@0 63 void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
aoqi@0 64 Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
aoqi@0 65 const Type* value_type, BasicType bt);
aoqi@0 66 Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
aoqi@0 67 Node* value, BasicType bt);
aoqi@0 68
aoqi@0 69 // projections extracted from a call node
aoqi@0 70 ProjNode *_fallthroughproj;
aoqi@0 71 ProjNode *_fallthroughcatchproj;
aoqi@0 72 ProjNode *_ioproj_fallthrough;
aoqi@0 73 ProjNode *_ioproj_catchall;
aoqi@0 74 ProjNode *_catchallcatchproj;
aoqi@0 75 ProjNode *_memproj_fallthrough;
aoqi@0 76 ProjNode *_memproj_catchall;
aoqi@0 77 ProjNode *_resproj;
aoqi@0 78
aoqi@0 79 // Additional data collected during macro expansion
aoqi@0 80 bool _has_locks;
aoqi@0 81
aoqi@0 82 void expand_allocate(AllocateNode *alloc);
aoqi@0 83 void expand_allocate_array(AllocateArrayNode *alloc);
aoqi@0 84 void expand_allocate_common(AllocateNode* alloc,
aoqi@0 85 Node* length,
aoqi@0 86 const TypeFunc* slow_call_type,
aoqi@0 87 address slow_call_address);
aoqi@0 88 Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
aoqi@0 89 Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
aoqi@0 90
aoqi@0 91 bool eliminate_boxing_node(CallStaticJavaNode *boxing);
aoqi@0 92 bool eliminate_allocate_node(AllocateNode *alloc);
aoqi@0 93 bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
aoqi@0 94 bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
aoqi@0 95 void process_users_of_allocation(CallNode *alloc);
aoqi@0 96
aoqi@0 97 void eliminate_card_mark(Node *cm);
aoqi@0 98 void mark_eliminated_box(Node* box, Node* obj);
aoqi@0 99 void mark_eliminated_locking_nodes(AbstractLockNode *alock);
aoqi@0 100 bool eliminate_locking_node(AbstractLockNode *alock);
aoqi@0 101 void expand_lock_node(LockNode *lock);
aoqi@0 102 void expand_unlock_node(UnlockNode *unlock);
aoqi@0 103
aoqi@0 104 int replace_input(Node *use, Node *oldref, Node *newref);
aoqi@0 105 void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
aoqi@0 106 Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
aoqi@0 107 void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
aoqi@0 108 CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
aoqi@0 109 const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
aoqi@0 110 void extract_call_projections(CallNode *call);
aoqi@0 111
aoqi@0 112 Node* initialize_object(AllocateNode* alloc,
aoqi@0 113 Node* control, Node* rawmem, Node* object,
aoqi@0 114 Node* klass_node, Node* length,
aoqi@0 115 Node* size_in_bytes);
aoqi@0 116
aoqi@0 117 Node* prefetch_allocation(Node* i_o,
aoqi@0 118 Node*& needgc_false, Node*& contended_phi_rawmem,
aoqi@0 119 Node* old_eden_top, Node* new_eden_top,
aoqi@0 120 Node* length);
aoqi@0 121
aoqi@0 122 public:
aoqi@0 123 PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
aoqi@0 124 _igvn.set_delay_transform(true);
aoqi@0 125 }
aoqi@0 126 void eliminate_macro_nodes();
aoqi@0 127 bool expand_macro_nodes();
aoqi@0 128
aoqi@0 129 };
aoqi@0 130
aoqi@0 131 #endif // SHARE_VM_OPTO_MACRO_HPP

mercurial