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