1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/opto/macro.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,107 @@ 1.4 +/* 1.5 + * Copyright 2005-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +class AllocateNode; 1.29 +class AllocateArrayNode; 1.30 +class CallNode; 1.31 +class Node; 1.32 +class PhaseIterGVN; 1.33 + 1.34 +class PhaseMacroExpand : public Phase { 1.35 +private: 1.36 + PhaseIterGVN &_igvn; 1.37 + 1.38 + // Helper methods roughly modelled after GraphKit: 1.39 + Node* top() const { return C->top(); } 1.40 + Node* intcon(jint con) const { return _igvn.intcon(con); } 1.41 + Node* longcon(jlong con) const { return _igvn.longcon(con); } 1.42 + Node* makecon(const Type *t) const { return _igvn.makecon(t); } 1.43 + Node* basic_plus_adr(Node* base, int offset) { 1.44 + return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset)); 1.45 + } 1.46 + Node* basic_plus_adr(Node* base, Node* ptr, int offset) { 1.47 + return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset)); 1.48 + } 1.49 + Node* basic_plus_adr(Node* base, Node* offset) { 1.50 + return basic_plus_adr(base, base, offset); 1.51 + } 1.52 + Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) { 1.53 + Node* adr = new (C, 4) AddPNode(base, ptr, offset); 1.54 + return transform_later(adr); 1.55 + } 1.56 + Node* transform_later(Node* n) { 1.57 + // equivalent to _gvn.transform in GraphKit, Ideal, etc. 1.58 + _igvn.register_new_node_with_optimizer(n); 1.59 + return n; 1.60 + } 1.61 + void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr); 1.62 + Node* make_load( Node* ctl, Node* mem, Node* base, int offset, 1.63 + const Type* value_type, BasicType bt); 1.64 + Node* make_store(Node* ctl, Node* mem, Node* base, int offset, 1.65 + Node* value, BasicType bt); 1.66 + 1.67 + // projections extracted from a call node 1.68 + ProjNode *_fallthroughproj; 1.69 + ProjNode *_fallthroughcatchproj; 1.70 + ProjNode *_ioproj_fallthrough; 1.71 + ProjNode *_ioproj_catchall; 1.72 + ProjNode *_catchallcatchproj; 1.73 + ProjNode *_memproj_fallthrough; 1.74 + ProjNode *_memproj_catchall; 1.75 + ProjNode *_resproj; 1.76 + 1.77 + 1.78 + void expand_allocate(AllocateNode *alloc); 1.79 + void expand_allocate_array(AllocateArrayNode *alloc); 1.80 + void expand_allocate_common(AllocateNode* alloc, 1.81 + Node* length, 1.82 + const TypeFunc* slow_call_type, 1.83 + address slow_call_address); 1.84 + void eliminate_locking_node(AbstractLockNode *alock); 1.85 + void expand_lock_node(LockNode *lock); 1.86 + void expand_unlock_node(UnlockNode *unlock); 1.87 + 1.88 + int replace_input(Node *use, Node *oldref, Node *newref); 1.89 + void copy_call_debug_info(CallNode *oldcall, CallNode * newcall); 1.90 + Node* opt_iff(Node* region, Node* iff); 1.91 + void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call); 1.92 + CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, 1.93 + const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1); 1.94 + void extract_call_projections(CallNode *call); 1.95 + 1.96 + Node* initialize_object(AllocateNode* alloc, 1.97 + Node* control, Node* rawmem, Node* object, 1.98 + Node* klass_node, Node* length, 1.99 + Node* size_in_bytes); 1.100 + 1.101 + Node* prefetch_allocation(Node* i_o, 1.102 + Node*& needgc_false, Node*& contended_phi_rawmem, 1.103 + Node* old_eden_top, Node* new_eden_top, 1.104 + Node* length); 1.105 + 1.106 +public: 1.107 + PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {} 1.108 + bool expand_macro_nodes(); 1.109 + 1.110 +};