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