annotate src/share/vm/opto/matcher.hpp @ 17716:cdb71841f4bc

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents 04d32e7fad07
children abec000618bf 085b304a1cc5 752ba2e5f6d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12972
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1274
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1274
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1274
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
25 #ifndef SHARE_VM_OPTO_MATCHER_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
26 #define SHARE_VM_OPTO_MATCHER_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
28 #include "libadt/vectset.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
29 #include "memory/resourceArea.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
30 #include "opto/node.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
31 #include "opto/phaseX.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
32 #include "opto/regmask.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
33
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class Compile;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class Node;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class MachNode;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class MachTypeNode;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class MachOper;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 //---------------------------Matcher-------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class Matcher : public PhaseTransform {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // Private arena of State objects
a61af66fc99e Initial load
duke
parents:
diff changeset
44 ResourceArea _states_arena;
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 VectorSet _visited; // Visit bits
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Used to control the Label pass
a61af66fc99e Initial load
duke
parents:
diff changeset
49 VectorSet _shared; // Shared Ideal Node
a61af66fc99e Initial load
duke
parents:
diff changeset
50 VectorSet _dontcare; // Nothing the matcher cares about
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Private methods which perform the actual matching and reduction
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Walks the label tree, generating machine nodes
a61af66fc99e Initial load
duke
parents:
diff changeset
54 MachNode *ReduceInst( State *s, int rule, Node *&mem);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 void ReduceInst_Chain_Rule( State *s, int rule, Node *&mem, MachNode *mach);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 uint ReduceInst_Interior(State *s, int rule, Node *&mem, MachNode *mach, uint num_opnds);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 void ReduceOper( State *s, int newrule, Node *&mem, MachNode *mach );
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // If this node already matched using "rule", return the MachNode for it.
168
7793bd37a336 6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents: 0
diff changeset
60 MachNode* find_shared_node(Node* n, uint rule);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // Convert a dense opcode number to an expanded rule number
a61af66fc99e Initial load
duke
parents:
diff changeset
63 const int *_reduceOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 const int *_leftOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 const int *_rightOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Map dense opcode number to info on when rule is swallowed constant.
a61af66fc99e Initial load
duke
parents:
diff changeset
68 const bool *_swallowed;
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Map dense rule number to determine if this is an instruction chain rule
a61af66fc99e Initial load
duke
parents:
diff changeset
71 const uint _begin_inst_chain_rule;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 const uint _end_inst_chain_rule;
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // We want to clone constants and possible CmpI-variants.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // If we do not clone CmpI, then we can have many instances of
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // condition codes alive at once. This is OK on some chips and
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // bad on others. Hence the machine-dependent table lookup.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 const char *_must_clone;
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Find shared Nodes, or Nodes that otherwise are Matcher roots
a61af66fc99e Initial load
duke
parents:
diff changeset
81 void find_shared( Node *n );
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // Debug and profile information for nodes in old space:
a61af66fc99e Initial load
duke
parents:
diff changeset
84 GrowableArray<Node_Notes*>* _old_node_note_array;
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // Node labeling iterator for instruction selection
a61af66fc99e Initial load
duke
parents:
diff changeset
87 Node *Label_Root( const Node *n, State *svec, Node *control, const Node *mem );
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 Node *transform( Node *dummy );
a61af66fc99e Initial load
duke
parents:
diff changeset
90
12071
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
91 Node_List _projection_list; // For Machine nodes killing many values
0
a61af66fc99e Initial load
duke
parents:
diff changeset
92
168
7793bd37a336 6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents: 0
diff changeset
93 Node_Array _shared_nodes;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 debug_only(Node_Array _old2new_map;) // Map roots of ideal-trees to machine-roots
222
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 216
diff changeset
96 debug_only(Node_Array _new2old_map;) // Maps machine nodes back to ideal
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // Accessors for the inherited field PhaseTransform::_nodes:
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void grow_new_node_array(uint idx_limit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 _nodes.map(idx_limit-1, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 bool has_new_node(const Node* n) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 return _nodes.at(n->_idx) != NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 Node* new_node(const Node* n) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 assert(has_new_node(n), "set before get");
a61af66fc99e Initial load
duke
parents:
diff changeset
107 return _nodes.at(n->_idx);
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void set_new_node(const Node* n, Node *nn) {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 assert(!has_new_node(n), "set only once");
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _nodes.map(n->_idx, nn);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Make sure only new nodes are reachable from this node
a61af66fc99e Initial load
duke
parents:
diff changeset
116 void verify_new_nodes_only(Node* root);
216
8d191a7697e2 6715633: when matching a memory node the adr_type should not change
kvn
parents: 168
diff changeset
117
8d191a7697e2 6715633: when matching a memory node the adr_type should not change
kvn
parents: 168
diff changeset
118 Node* _mem_node; // Ideal memory node consumed by mach node
0
a61af66fc99e Initial load
duke
parents:
diff changeset
119 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
120
729
04fa5affa478 6709742: find_base_for_derived's use of Ideal NULL is unsafe causing crashes during register allocation
kvn
parents: 415
diff changeset
121 // Mach node for ConP #NULL
04fa5affa478 6709742: find_base_for_derived's use of Ideal NULL is unsafe causing crashes during register allocation
kvn
parents: 415
diff changeset
122 MachNode* _mach_null;
04fa5affa478 6709742: find_base_for_derived's use of Ideal NULL is unsafe causing crashes during register allocation
kvn
parents: 415
diff changeset
123
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
125 int LabelRootDepth;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Convert ideal machine register to a register mask for spill-loads
a61af66fc99e Initial load
duke
parents:
diff changeset
127 static const RegMask *idealreg2regmask[];
1137
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 844
diff changeset
128 RegMask *idealreg2spillmask [_last_machine_leaf];
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 844
diff changeset
129 RegMask *idealreg2debugmask [_last_machine_leaf];
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 844
diff changeset
130 RegMask *idealreg2mhdebugmask[_last_machine_leaf];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
131 void init_spill_mask( Node *ret );
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // Convert machine register number to register mask
a61af66fc99e Initial load
duke
parents:
diff changeset
133 static uint mreg2regmask_max;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 static RegMask mreg2regmask[];
a61af66fc99e Initial load
duke
parents:
diff changeset
135 static RegMask STACK_ONLY_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
136
729
04fa5affa478 6709742: find_base_for_derived's use of Ideal NULL is unsafe causing crashes during register allocation
kvn
parents: 415
diff changeset
137 MachNode* mach_null() const { return _mach_null; }
04fa5affa478 6709742: find_base_for_derived's use of Ideal NULL is unsafe causing crashes during register allocation
kvn
parents: 415
diff changeset
138
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 bool is_shared( Node *n ) { return _shared.test(n->_idx) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 void set_shared( Node *n ) { _shared.set(n->_idx); }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 bool is_visited( Node *n ) { return _visited.test(n->_idx) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 void set_visited( Node *n ) { _visited.set(n->_idx); }
a61af66fc99e Initial load
duke
parents:
diff changeset
143 bool is_dontcare( Node *n ) { return _dontcare.test(n->_idx) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
144 void set_dontcare( Node *n ) { _dontcare.set(n->_idx); }
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // Mode bit to tell DFA and expand rules whether we are running after
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // (or during) register selection. Usually, the matcher runs before,
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // but it will also get called to generate post-allocation spill code.
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // In this situation, it is a deadly error to attempt to allocate more
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // temporary registers.
a61af66fc99e Initial load
duke
parents:
diff changeset
151 bool _allocation_started;
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // Machine register names
a61af66fc99e Initial load
duke
parents:
diff changeset
154 static const char *regName[];
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // Machine register encodings
a61af66fc99e Initial load
duke
parents:
diff changeset
156 static const unsigned char _regEncode[];
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Machine Node names
a61af66fc99e Initial load
duke
parents:
diff changeset
158 const char **_ruleName;
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // Rules that are cheaper to rematerialize than to spill
a61af66fc99e Initial load
duke
parents:
diff changeset
160 static const uint _begin_rematerialize;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 static const uint _end_rematerialize;
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // An array of chars, from 0 to _last_Mach_Reg.
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // No Save = 'N' (for register windows)
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // Save on Entry = 'E'
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // Save on Call = 'C'
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // Always Save = 'A' (same as SOE + SOC)
a61af66fc99e Initial load
duke
parents:
diff changeset
168 const char *_register_save_policy;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 const char *_c_reg_save_policy;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // Convert a machine register to a machine register type, so-as to
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // properly match spill code.
a61af66fc99e Initial load
duke
parents:
diff changeset
172 const int *_register_save_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // Maps from machine register to boolean; true if machine register can
a61af66fc99e Initial load
duke
parents:
diff changeset
174 // be holding a call argument in some signature.
a61af66fc99e Initial load
duke
parents:
diff changeset
175 static bool can_be_java_arg( int reg );
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Maps from machine register to boolean; true if machine register holds
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // a spillable argument.
a61af66fc99e Initial load
duke
parents:
diff changeset
178 static bool is_spillable_arg( int reg );
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // List of IfFalse or IfTrue Nodes that indicate a taken null test.
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // List is valid in the post-matching space.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 Node_List _null_check_tests;
368
36ccc817fca4 6747051: Improve code and implicit null check generation for compressed oops
kvn
parents: 235
diff changeset
183 void collect_null_checks( Node *proj, Node *orig_proj );
0
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void validate_null_checks( );
a61af66fc99e Initial load
duke
parents:
diff changeset
185
12071
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
186 Matcher();
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
187
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
188 // Get a projection node at position pos
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
189 Node* get_projection(uint pos) {
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
190 return _projection_list[pos];
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
191 }
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
192
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
193 // Push a projection node onto the projection list
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
194 void push_projection(Node* node) {
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
195 _projection_list.push(node);
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
196 }
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
197
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
198 Node* pop_projection() {
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
199 return _projection_list.pop();
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
200 }
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
201
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
202 // Number of nodes in the projection list
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
203 uint number_of_projections() const {
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
204 return _projection_list.size();
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
205 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // Select instructions for entire method
12071
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
208 void match();
adb9a7d94cb5 8023003: Cleanup the public interface to PhaseCFG
adlertz
parents: 6848
diff changeset
209
0
a61af66fc99e Initial load
duke
parents:
diff changeset
210 // Helper for match
a61af66fc99e Initial load
duke
parents:
diff changeset
211 OptoReg::Name warp_incoming_stk_arg( VMReg reg );
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // Transform, then walk. Does implicit DCE while walking.
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // Name changed from "transform" to avoid it being virtual.
a61af66fc99e Initial load
duke
parents:
diff changeset
215 Node *xform( Node *old_space_node, int Nodes );
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // Match a single Ideal Node - turn it into a 1-Node tree; Label & Reduce.
a61af66fc99e Initial load
duke
parents:
diff changeset
218 MachNode *match_tree( const Node *n );
a61af66fc99e Initial load
duke
parents:
diff changeset
219 MachNode *match_sfpt( SafePointNode *sfpt );
a61af66fc99e Initial load
duke
parents:
diff changeset
220 // Helper for match_sfpt
a61af66fc99e Initial load
duke
parents:
diff changeset
221 OptoReg::Name warp_outgoing_stk_arg( VMReg reg, OptoReg::Name begin_out_arg_area, OptoReg::Name &out_arg_limit_per_call );
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // Initialize first stack mask and related masks.
a61af66fc99e Initial load
duke
parents:
diff changeset
224 void init_first_stack_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // If we should save-on-entry this register
a61af66fc99e Initial load
duke
parents:
diff changeset
227 bool is_save_on_entry( int reg );
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Fixup the save-on-entry registers
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void Fixup_Save_On_Entry( );
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // --- Frame handling ---
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // Register number of the stack slot corresponding to the incoming SP.
a61af66fc99e Initial load
duke
parents:
diff changeset
235 // Per the Big Picture in the AD file, it is:
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // SharedInfo::stack0 + locks + in_preserve_stack_slots + pad2.
a61af66fc99e Initial load
duke
parents:
diff changeset
237 OptoReg::Name _old_SP;
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 // Register number of the stack slot corresponding to the highest incoming
a61af66fc99e Initial load
duke
parents:
diff changeset
240 // argument on the stack. Per the Big Picture in the AD file, it is:
a61af66fc99e Initial load
duke
parents:
diff changeset
241 // _old_SP + out_preserve_stack_slots + incoming argument size.
a61af66fc99e Initial load
duke
parents:
diff changeset
242 OptoReg::Name _in_arg_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // Register number of the stack slot corresponding to the new SP.
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // Per the Big Picture in the AD file, it is:
a61af66fc99e Initial load
duke
parents:
diff changeset
246 // _in_arg_limit + pad0
a61af66fc99e Initial load
duke
parents:
diff changeset
247 OptoReg::Name _new_SP;
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 // Register number of the stack slot corresponding to the highest outgoing
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // argument on the stack. Per the Big Picture in the AD file, it is:
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // _new_SP + max outgoing arguments of all calls
a61af66fc99e Initial load
duke
parents:
diff changeset
252 OptoReg::Name _out_arg_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254 OptoRegPair *_parm_regs; // Array of machine registers per argument
a61af66fc99e Initial load
duke
parents:
diff changeset
255 RegMask *_calling_convention_mask; // Array of RegMasks per argument
a61af66fc99e Initial load
duke
parents:
diff changeset
256
775
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
257 // Does matcher have a match rule for this ideal node?
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258 static const bool has_match_rule(int opcode);
a61af66fc99e Initial load
duke
parents:
diff changeset
259 static const bool _hasMatchRule[_last_opcode];
a61af66fc99e Initial load
duke
parents:
diff changeset
260
775
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
261 // Does matcher have a match rule for this ideal node and is the
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
262 // predicate (if there is one) true?
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
263 // NOTE: If this function is used more commonly in the future, ADLC
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
264 // should generate this one.
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
265 static const bool match_rule_supported(int opcode);
93c14e5562c4 6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
twisti
parents: 729
diff changeset
266
0
a61af66fc99e Initial load
duke
parents:
diff changeset
267 // Used to determine if we have fast l2f conversion
a61af66fc99e Initial load
duke
parents:
diff changeset
268 // USII has it, USIII doesn't
a61af66fc99e Initial load
duke
parents:
diff changeset
269 static const bool convL2FSupported(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 // Vector width in bytes
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
272 static const int vector_width_in_bytes(BasicType bt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
273
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
274 // Limits on vector size (number of elements).
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
275 static const int max_vector_size(const BasicType bt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
276 static const int min_vector_size(const BasicType bt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
277 static const bool vector_size_supported(const BasicType bt, int size) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
278 return (Matcher::max_vector_size(bt) >= size &&
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
279 Matcher::min_vector_size(bt) <= size);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
280 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // Vector ideal reg
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
283 static const int vector_ideal_reg(int len);
6823
859c45fb8cea 7201026: add vector for shift count
kvn
parents: 6725
diff changeset
284 static const int vector_shift_count_ideal_reg(int len);
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
285
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
286 // CPU supports misaligned vectors store/load.
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
287 static const bool misaligned_vectors_ok();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
288
17670
04d32e7fad07 8002074: Support for AES on SPARC
kvn
parents: 17467
diff changeset
289 // Should original key array reference be passed to AES stubs
04d32e7fad07 8002074: Support for AES on SPARC
kvn
parents: 17467
diff changeset
290 static const bool pass_original_key_for_aes();
04d32e7fad07 8002074: Support for AES on SPARC
kvn
parents: 17467
diff changeset
291
0
a61af66fc99e Initial load
duke
parents:
diff changeset
292 // Used to determine a "low complexity" 64-bit constant. (Zero is simple.)
a61af66fc99e Initial load
duke
parents:
diff changeset
293 // The standard of comparison is one (StoreL ConL) vs. two (StoreI ConI).
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // Depends on the details of 64-bit constant generation on the CPU.
a61af66fc99e Initial load
duke
parents:
diff changeset
295 static const bool isSimpleConstant64(jlong con);
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // These calls are all generated by the ADLC
a61af66fc99e Initial load
duke
parents:
diff changeset
298
a61af66fc99e Initial load
duke
parents:
diff changeset
299 // TRUE - grows up, FALSE - grows down (Intel)
a61af66fc99e Initial load
duke
parents:
diff changeset
300 virtual bool stack_direction() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // Java-Java calling convention
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // (what you use when Java calls Java)
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 // Alignment of stack in bytes, standard Intel word alignment is 4.
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // Sparc probably wants at least double-word (8).
a61af66fc99e Initial load
duke
parents:
diff changeset
307 static uint stack_alignment_in_bytes();
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // Alignment of stack, measured in stack slots.
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // The size of stack slots is defined by VMRegImpl::stack_slot_size.
a61af66fc99e Initial load
duke
parents:
diff changeset
310 static uint stack_alignment_in_slots() {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 return stack_alignment_in_bytes() / (VMRegImpl::stack_slot_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 // Array mapping arguments to registers. Argument 0 is usually the 'this'
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // pointer. Registers can include stack-slots and regular registers.
a61af66fc99e Initial load
duke
parents:
diff changeset
316 static void calling_convention( BasicType *, VMRegPair *, uint len, bool is_outgoing );
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 // Convert a sig into a calling convention register layout
a61af66fc99e Initial load
duke
parents:
diff changeset
319 // and find interesting things about it.
a61af66fc99e Initial load
duke
parents:
diff changeset
320 static OptoReg::Name find_receiver( bool is_outgoing );
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // Return address register. On Intel it is a stack-slot. On PowerPC
a61af66fc99e Initial load
duke
parents:
diff changeset
322 // it is the Link register. On Sparc it is r31?
a61af66fc99e Initial load
duke
parents:
diff changeset
323 virtual OptoReg::Name return_addr() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 RegMask _return_addr_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // Return value register. On Intel it is EAX. On Sparc i0/o0.
a61af66fc99e Initial load
duke
parents:
diff changeset
326 static OptoRegPair return_value(int ideal_reg, bool is_outgoing);
a61af66fc99e Initial load
duke
parents:
diff changeset
327 static OptoRegPair c_return_value(int ideal_reg, bool is_outgoing);
a61af66fc99e Initial load
duke
parents:
diff changeset
328 RegMask _return_value_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
329 // Inline Cache Register
a61af66fc99e Initial load
duke
parents:
diff changeset
330 static OptoReg::Name inline_cache_reg();
a61af66fc99e Initial load
duke
parents:
diff changeset
331 static int inline_cache_reg_encode();
a61af66fc99e Initial load
duke
parents:
diff changeset
332
a61af66fc99e Initial load
duke
parents:
diff changeset
333 // Register for DIVI projection of divmodI
a61af66fc99e Initial load
duke
parents:
diff changeset
334 static RegMask divI_proj_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // Register for MODI projection of divmodI
a61af66fc99e Initial load
duke
parents:
diff changeset
336 static RegMask modI_proj_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // Register for DIVL projection of divmodL
a61af66fc99e Initial load
duke
parents:
diff changeset
339 static RegMask divL_proj_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // Register for MODL projection of divmodL
a61af66fc99e Initial load
duke
parents:
diff changeset
341 static RegMask modL_proj_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
342
12323
c9ccd7b85f20 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 12071
diff changeset
343 static const RegMask mathExactI_result_proj_mask();
12972
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
344 static const RegMask mathExactL_result_proj_mask();
12323
c9ccd7b85f20 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 12071
diff changeset
345 static const RegMask mathExactI_flags_proj_mask();
c9ccd7b85f20 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 12071
diff changeset
346
1914
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1579
diff changeset
347 // Use hardware DIV instruction when it is faster than
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1579
diff changeset
348 // a code which use multiply for division by constant.
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1579
diff changeset
349 static bool use_asm_for_ldiv_by_con( jlong divisor );
ae065c367d93 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 1579
diff changeset
350
1137
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 844
diff changeset
351 static const RegMask method_handle_invoke_SP_save_mask();
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 844
diff changeset
352
0
a61af66fc99e Initial load
duke
parents:
diff changeset
353 // Java-Interpreter calling convention
a61af66fc99e Initial load
duke
parents:
diff changeset
354 // (what you use when calling between compiled-Java and Interpreted-Java
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 // Number of callee-save + always-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
357 // Ignores frame pointer and "special" registers
a61af66fc99e Initial load
duke
parents:
diff changeset
358 static int number_of_saved_registers();
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 // The Method-klass-holder may be passed in the inline_cache_reg
a61af66fc99e Initial load
duke
parents:
diff changeset
361 // and then expanded into the inline_cache_reg and a method_oop register
a61af66fc99e Initial load
duke
parents:
diff changeset
362
a61af66fc99e Initial load
duke
parents:
diff changeset
363 static OptoReg::Name interpreter_method_oop_reg();
a61af66fc99e Initial load
duke
parents:
diff changeset
364 static int interpreter_method_oop_reg_encode();
a61af66fc99e Initial load
duke
parents:
diff changeset
365
a61af66fc99e Initial load
duke
parents:
diff changeset
366 static OptoReg::Name compiler_method_oop_reg();
a61af66fc99e Initial load
duke
parents:
diff changeset
367 static const RegMask &compiler_method_oop_reg_mask();
a61af66fc99e Initial load
duke
parents:
diff changeset
368 static int compiler_method_oop_reg_encode();
a61af66fc99e Initial load
duke
parents:
diff changeset
369
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // Interpreter's Frame Pointer Register
a61af66fc99e Initial load
duke
parents:
diff changeset
371 static OptoReg::Name interpreter_frame_pointer_reg();
a61af66fc99e Initial load
duke
parents:
diff changeset
372
a61af66fc99e Initial load
duke
parents:
diff changeset
373 // Java-Native calling convention
a61af66fc99e Initial load
duke
parents:
diff changeset
374 // (what you use when intercalling between Java and C++ code)
a61af66fc99e Initial load
duke
parents:
diff changeset
375
a61af66fc99e Initial load
duke
parents:
diff changeset
376 // Array mapping arguments to registers. Argument 0 is usually the 'this'
a61af66fc99e Initial load
duke
parents:
diff changeset
377 // pointer. Registers can include stack-slots and regular registers.
a61af66fc99e Initial load
duke
parents:
diff changeset
378 static void c_calling_convention( BasicType*, VMRegPair *, uint );
a61af66fc99e Initial load
duke
parents:
diff changeset
379 // Frame pointer. The frame pointer is kept at the base of the stack
a61af66fc99e Initial load
duke
parents:
diff changeset
380 // and so is probably the stack pointer for most machines. On Intel
a61af66fc99e Initial load
duke
parents:
diff changeset
381 // it is ESP. On the PowerPC it is R1. On Sparc it is SP.
a61af66fc99e Initial load
duke
parents:
diff changeset
382 OptoReg::Name c_frame_pointer() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
383 static RegMask c_frame_ptr_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 // !!!!! Special stuff for building ScopeDescs
a61af66fc99e Initial load
duke
parents:
diff changeset
386 virtual int regnum_to_fpu_offset(int regnum);
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 // Is this branch offset small enough to be addressed by a short branch?
3851
95134e034042 7063629: use cbcond in C2 generated code on T4
kvn
parents: 3849
diff changeset
389 bool is_short_branch_offset(int rule, int br_size, int offset);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
390
a61af66fc99e Initial load
duke
parents:
diff changeset
391 // Optional scaling for the parameter to the ClearArray/CopyArray node.
a61af66fc99e Initial load
duke
parents:
diff changeset
392 static const bool init_array_count_is_in_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 // Threshold small size (in bytes) for a ClearArray/CopyArray node.
a61af66fc99e Initial load
duke
parents:
diff changeset
395 // Anything this size or smaller may get converted to discrete scalar stores.
a61af66fc99e Initial load
duke
parents:
diff changeset
396 static const int init_array_short_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
397
4047
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
398 // Some hardware needs 2 CMOV's for longs.
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
399 static const int long_cmove_cost();
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
400
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
401 // Some hardware have expensive CMOV for float and double.
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
402 static const int float_cmove_cost();
d8cb48376797 7097546: Optimize use of CMOVE instructions
kvn
parents: 3851
diff changeset
403
0
a61af66fc99e Initial load
duke
parents:
diff changeset
404 // Should the Matcher clone shifts on addressing modes, expecting them to
a61af66fc99e Initial load
duke
parents:
diff changeset
405 // be subsumed into complex addressing expressions or compute them into
a61af66fc99e Initial load
duke
parents:
diff changeset
406 // registers? True for Intel but false for most RISCs
a61af66fc99e Initial load
duke
parents:
diff changeset
407 static const bool clone_shift_expressions;
a61af66fc99e Initial load
duke
parents:
diff changeset
408
1575
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
409 static bool narrow_oop_use_complex_address();
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 6823
diff changeset
410 static bool narrow_klass_use_complex_address();
1575
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
411
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
412 // Generate implicit null check for narrow oops if it can fold
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
413 // into address expression (x64).
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
414 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
415 // [R12 + narrow_oop_reg<<3 + offset] // fold into address expression
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
416 // NullCheck narrow_oop_reg
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
417 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
418 // When narrow oops can't fold into address expression (Sparc) and
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
419 // base is not null use decode_not_null and normal implicit null check.
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
420 // Note, decode_not_null node can be used here since it is referenced
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
421 // only on non null path but it requires special handling, see
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
422 // collect_null_checks():
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
423 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
424 // decode_not_null narrow_oop_reg, oop_reg // 'shift' and 'add base'
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
425 // [oop_reg + offset]
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
426 // NullCheck oop_reg
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
427 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
428 // With Zero base and when narrow oops can not fold into address
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
429 // expression use normal implicit null check since only shift
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
430 // is needed to decode narrow oop.
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
431 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
432 // decode narrow_oop_reg, oop_reg // only 'shift'
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
433 // [oop_reg + offset]
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
434 // NullCheck oop_reg
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
435 //
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
436 inline static bool gen_narrow_oop_implicit_null_checks() {
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
437 return Universe::narrow_oop_use_implicit_null_checks() &&
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
438 (narrow_oop_use_complex_address() ||
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
439 Universe::narrow_oop_base() != NULL);
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
440 }
3657cb01ffc5 6954029: Improve implicit null check generation with compressed oops
kvn
parents: 1274
diff changeset
441
0
a61af66fc99e Initial load
duke
parents:
diff changeset
442 // Is it better to copy float constants, or load them directly from memory?
a61af66fc99e Initial load
duke
parents:
diff changeset
443 // Intel can load a float constant from a direct address, requiring no
a61af66fc99e Initial load
duke
parents:
diff changeset
444 // extra registers. Most RISCs will have to materialize an address into a
a61af66fc99e Initial load
duke
parents:
diff changeset
445 // register first, so they may as well materialize the constant immediately.
a61af66fc99e Initial load
duke
parents:
diff changeset
446 static const bool rematerialize_float_constants;
a61af66fc99e Initial load
duke
parents:
diff changeset
447
a61af66fc99e Initial load
duke
parents:
diff changeset
448 // If CPU can load and store mis-aligned doubles directly then no fixup is
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // needed. Else we split the double into 2 integer pieces and move it
a61af66fc99e Initial load
duke
parents:
diff changeset
450 // piece-by-piece. Only happens when passing doubles into C code or when
a61af66fc99e Initial load
duke
parents:
diff changeset
451 // calling i2c adapters as the Java calling convention forces doubles to be
a61af66fc99e Initial load
duke
parents:
diff changeset
452 // aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
453 static const bool misaligned_doubles_ok;
a61af66fc99e Initial load
duke
parents:
diff changeset
454
a61af66fc99e Initial load
duke
parents:
diff changeset
455 // Perform a platform dependent implicit null fixup. This is needed
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // on windows95 to take care of some unusual register constraints.
a61af66fc99e Initial load
duke
parents:
diff changeset
457 void pd_implicit_null_fixup(MachNode *load, uint idx);
a61af66fc99e Initial load
duke
parents:
diff changeset
458
a61af66fc99e Initial load
duke
parents:
diff changeset
459 // Advertise here if the CPU requires explicit rounding operations
a61af66fc99e Initial load
duke
parents:
diff changeset
460 // to implement the UseStrictFP mode.
a61af66fc99e Initial load
duke
parents:
diff changeset
461 static const bool strict_fp_requires_explicit_rounding;
a61af66fc99e Initial load
duke
parents:
diff changeset
462
1274
2883969d09e7 6910664: C2: java/util/Arrays/Sorting.java fails with DeoptimizeALot flag
kvn
parents: 1137
diff changeset
463 // Are floats conerted to double when stored to stack during deoptimization?
2883969d09e7 6910664: C2: java/util/Arrays/Sorting.java fails with DeoptimizeALot flag
kvn
parents: 1137
diff changeset
464 static bool float_in_double();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
465 // Do ints take an entire long register or just half?
a61af66fc99e Initial load
duke
parents:
diff changeset
466 static const bool int_in_long;
a61af66fc99e Initial load
duke
parents:
diff changeset
467
2401
7e88bdae86ec 7029017: Additional architecture support for c2 compiler
roland
parents: 2008
diff changeset
468 // Do the processor's shift instructions only use the low 5/6 bits
7e88bdae86ec 7029017: Additional architecture support for c2 compiler
roland
parents: 2008
diff changeset
469 // of the count for 32/64 bit ints? If not we need to do the masking
7e88bdae86ec 7029017: Additional architecture support for c2 compiler
roland
parents: 2008
diff changeset
470 // ourselves.
7e88bdae86ec 7029017: Additional architecture support for c2 compiler
roland
parents: 2008
diff changeset
471 static const bool need_masked_shift_count;
7e88bdae86ec 7029017: Additional architecture support for c2 compiler
roland
parents: 2008
diff changeset
472
0
a61af66fc99e Initial load
duke
parents:
diff changeset
473 // This routine is run whenever a graph fails to match.
a61af66fc99e Initial load
duke
parents:
diff changeset
474 // If it returns, the compiler should bailout to interpreter without error.
a61af66fc99e Initial load
duke
parents:
diff changeset
475 // In non-product mode, SoftMatchFailure is false to detect non-canonical
a61af66fc99e Initial load
duke
parents:
diff changeset
476 // graphs. Print a message and exit.
a61af66fc99e Initial load
duke
parents:
diff changeset
477 static void soft_match_failure() {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 if( SoftMatchFailure ) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
479 else { fatal("SoftMatchFailure is not allowed except in product"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
480 }
a61af66fc99e Initial load
duke
parents:
diff changeset
481
a61af66fc99e Initial load
duke
parents:
diff changeset
482 // Check for a following volatile memory barrier without an
a61af66fc99e Initial load
duke
parents:
diff changeset
483 // intervening load and thus we don't need a barrier here. We
a61af66fc99e Initial load
duke
parents:
diff changeset
484 // retain the Node to act as a compiler ordering barrier.
a61af66fc99e Initial load
duke
parents:
diff changeset
485 static bool post_store_load_barrier(const Node* mb);
a61af66fc99e Initial load
duke
parents:
diff changeset
486
a61af66fc99e Initial load
duke
parents:
diff changeset
487
a61af66fc99e Initial load
duke
parents:
diff changeset
488 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
489 void dump_old2new_map(); // machine-independent to machine-dependent
222
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 216
diff changeset
490
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 216
diff changeset
491 Node* find_old_node(Node* new_node) {
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 216
diff changeset
492 return _new2old_map[new_node->_idx];
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 216
diff changeset
493 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
494 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
495 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
496
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1914
diff changeset
497 #endif // SHARE_VM_OPTO_MATCHER_HPP