annotate src/share/vm/c1/c1_ValueMap.hpp @ 1721:413ad0331a0c

6977924: Changes for 6975078 produce build error with certain gcc versions Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error. Reviewed-by: jcoomes, ysr, phh
author johnc
date Wed, 18 Aug 2010 10:59:06 -0700
parents c18cbe5936b8
children d5d065957597
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
2 * Copyright (c) 1999, 2008, 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: 470
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
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: 470
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
a61af66fc99e Initial load
duke
parents:
diff changeset
25 class ValueMapEntry: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
27 intx _hash;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 Value _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 int _nesting;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 ValueMapEntry* _next;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
33 ValueMapEntry(intx hash, Value value, int nesting, ValueMapEntry* next)
a61af66fc99e Initial load
duke
parents:
diff changeset
34 : _hash(hash)
a61af66fc99e Initial load
duke
parents:
diff changeset
35 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
36 , _nesting(nesting)
a61af66fc99e Initial load
duke
parents:
diff changeset
37 , _next(next)
a61af66fc99e Initial load
duke
parents:
diff changeset
38 {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 }
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 intx hash() { return _hash; }
a61af66fc99e Initial load
duke
parents:
diff changeset
42 Value value() { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
43 int nesting() { return _nesting; }
a61af66fc99e Initial load
duke
parents:
diff changeset
44 ValueMapEntry* next() { return _next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 void set_next(ValueMapEntry* next) { _next = next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 };
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 define_array(ValueMapEntryArray, ValueMapEntry*)
a61af66fc99e Initial load
duke
parents:
diff changeset
50 define_stack(ValueMapEntryList, ValueMapEntryArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // ValueMap implements nested hash tables for value numbering. It
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // maintains a set _killed_values which represents the instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // which have been killed so far and an array of linked lists of
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // ValueMapEntries names _entries. Each ValueMapEntry has a nesting
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // which indicates what ValueMap nesting it belongs to. Higher
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // nesting values are always before lower values in the linked list.
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // This allows cloning of parent ValueMaps by simply copying the heads
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // of the list. _entry_count represents the number of reachable
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // entries in the ValueMap. A ValueMap is only allowed to mutate
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // ValueMapEntries with the same nesting level. Adding or removing
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // entries at the current nesting level requires updating
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // _entry_count. Elements in the parent's list that get killed can be
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // skipped if they are at the head of the list by simply moving to the
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // next element in the list and decrementing _entry_count.
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 class ValueMap: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
69 int _nesting;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 ValueMapEntryArray _entries;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 ValueSet _killed_values;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 int _entry_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 int nesting() { return _nesting; }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 bool is_local_value_numbering() { return _nesting == 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 bool is_global_value_numbering() { return _nesting > 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 int entry_count() { return _entry_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int size() { return _entries.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 ValueMapEntry* entry_at(int i) { return _entries.at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // calculates the index of a hash value in a hash table of size n
a61af66fc99e Initial load
duke
parents:
diff changeset
83 int entry_index(intx hash, int n) { return (unsigned int)hash % n; }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // if entry_count > size_threshold, the size of the hash table is increased
a61af66fc99e Initial load
duke
parents:
diff changeset
86 int size_threshold() { return size(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // management of the killed-bitset for global value numbering
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void kill_value(Value v) { if (is_global_value_numbering()) _killed_values.put(v); }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 bool is_killed(Value v) { if (is_global_value_numbering()) return _killed_values.contains(v); else return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
93 void increase_table_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static int _number_of_finds;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 static int _number_of_hits;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 static int _number_of_kills;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
103 ValueMap(); // empty value map
a61af66fc99e Initial load
duke
parents:
diff changeset
104 ValueMap(ValueMap* old); // value map with increased nesting
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
107 Value find_insert(Value x);
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void kill_memory();
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void kill_field(ciField* field);
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void kill_array(ValueType* type);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void kill_exception();
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void kill_map(ValueMap* map);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 void kill_all();
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // debugging/printing
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 static void reset_statistics();
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static void print_statistics();
a61af66fc99e Initial load
duke
parents:
diff changeset
122 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
123 };
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 define_array(ValueMapArray, ValueMap*)
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 class ValueNumberingVisitor: public InstructionVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // called by visitor functions for instructions that kill values
a61af66fc99e Initial load
duke
parents:
diff changeset
131 virtual void kill_memory() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 virtual void kill_field(ciField* field) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 virtual void kill_array(ValueType* type) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // visitor functions
459
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
136 void do_StoreField (StoreField* x) {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
137 if (!x->is_initialized()) {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
138 kill_memory();
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
139 } else {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
140 kill_field(x->field());
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
141 }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
142 }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
143 void do_StoreIndexed (StoreIndexed* x) { kill_array(x->type()); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
144 void do_MonitorEnter (MonitorEnter* x) { kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
145 void do_MonitorExit (MonitorExit* x) { kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
146 void do_Invoke (Invoke* x) { kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
147 void do_UnsafePutRaw (UnsafePutRaw* x) { kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
148 void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
149 void do_Intrinsic (Intrinsic* x) { if (!x->preserves_state()) kill_memory(); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
150
459
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
151 void do_Phi (Phi* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
152 void do_Local (Local* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
153 void do_Constant (Constant* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
154 void do_LoadField (LoadField* x) {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
155 if (!x->is_initialized()) {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
156 kill_memory();
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
157 }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
158 }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
159 void do_ArrayLength (ArrayLength* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
160 void do_LoadIndexed (LoadIndexed* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
161 void do_NegateOp (NegateOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
162 void do_ArithmeticOp (ArithmeticOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
163 void do_ShiftOp (ShiftOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
164 void do_LogicOp (LogicOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
165 void do_CompareOp (CompareOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
166 void do_IfOp (IfOp* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
167 void do_Convert (Convert* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
168 void do_NullCheck (NullCheck* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
169 void do_NewInstance (NewInstance* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
170 void do_NewTypeArray (NewTypeArray* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
171 void do_NewObjectArray (NewObjectArray* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
172 void do_NewMultiArray (NewMultiArray* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
173 void do_CheckCast (CheckCast* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
174 void do_InstanceOf (InstanceOf* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
175 void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
176 void do_Goto (Goto* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
177 void do_If (If* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
178 void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
179 void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
180 void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
181 void do_Return (Return* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
182 void do_Throw (Throw* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
183 void do_Base (Base* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
184 void do_OsrEntry (OsrEntry* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
185 void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
186 void do_RoundFP (RoundFP* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
187 void do_UnsafeGetRaw (UnsafeGetRaw* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
188 void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
189 void do_UnsafePrefetchRead (UnsafePrefetchRead* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
190 void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
191 void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
192 void do_ProfileCounter (ProfileCounter* x) { /* nothing to do */ }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
193 };
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
194
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
195
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
196 class ValueNumberingEffects: public ValueNumberingVisitor {
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
197 private:
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
198 ValueMap* _map;
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
199
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
200 public:
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
201 // implementation for abstract methods of ValueNumberingVisitor
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
202 void kill_memory() { _map->kill_memory(); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
203 void kill_field(ciField* field) { _map->kill_field(field); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
204 void kill_array(ValueType* type) { _map->kill_array(type); }
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
205
3a86a8dcf27c 6756768: C1 generates invalid code
never
parents: 0
diff changeset
206 ValueNumberingEffects(ValueMap* map): _map(map) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
207 };
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 class GlobalValueNumbering: public ValueNumberingVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
212 ValueMap* _current_map; // value map of current block
a61af66fc99e Initial load
duke
parents:
diff changeset
213 ValueMapArray _value_maps; // list of value maps for all blocks
a61af66fc99e Initial load
duke
parents:
diff changeset
214
a61af66fc99e Initial load
duke
parents:
diff changeset
215 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
216 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
217 ValueMap* current_map() { return _current_map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 ValueMap* value_map_of(BlockBegin* block) { return _value_maps.at(block->linear_scan_number()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 void set_value_map_of(BlockBegin* block, ValueMap* map) { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // implementation for abstract methods of ValueNumberingVisitor
a61af66fc99e Initial load
duke
parents:
diff changeset
222 void kill_memory() { current_map()->kill_memory(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 void kill_field(ciField* field) { current_map()->kill_field(field); }
a61af66fc99e Initial load
duke
parents:
diff changeset
224 void kill_array(ValueType* type) { current_map()->kill_array(type); }
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // main entry point that performs global value numbering
a61af66fc99e Initial load
duke
parents:
diff changeset
227 GlobalValueNumbering(IR* ir);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 };