annotate src/share/vm/adlc/forms.cpp @ 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 f95d63e2154a
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: 628
diff changeset
2 * Copyright (c) 1997, 2009, 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: 628
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 628
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: 628
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 // FORMS.CPP - Definitions for ADL Parser Generic & Utility Forms Classes
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #include "adlc.hpp"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 //------------------------------Static Initializers----------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // allocate arena used by forms
a61af66fc99e Initial load
duke
parents:
diff changeset
30 Arena *Form::arena = Form::generate_arena(); // = Form::generate_arena();
a61af66fc99e Initial load
duke
parents:
diff changeset
31 Arena *Form::generate_arena() {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 return (new Arena);
a61af66fc99e Initial load
duke
parents:
diff changeset
33 }
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 //------------------------------NameList---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // reserved user-defined string
a61af66fc99e Initial load
duke
parents:
diff changeset
37 const char *NameList::_signal = "$$SIGNAL$$";
415
4d9884b01ba6 6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents: 196
diff changeset
38 const char *NameList::_signal2 = "$$SIGNAL2$$";
4d9884b01ba6 6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents: 196
diff changeset
39 const char *NameList::_signal3 = "$$SIGNAL3$$";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // Constructor and Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
42 NameList::NameList() : _cur(0), _max(4), _iter(0), _justReset(true) {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 _names = (const char**)malloc(_max*sizeof(char*));
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 NameList::~NameList() {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // The following free is a double-free, and crashes the program:
a61af66fc99e Initial load
duke
parents:
diff changeset
47 //free(_names); // not owner of strings
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void NameList::addName(const char *name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 if (_cur == _max) _names =(const char**)realloc(_names,(_max *=2)*sizeof(char*));
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _names[_cur++] = name;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 void NameList::add_signal() {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 addName( _signal );
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 void NameList::clear() {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 _cur = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _iter = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 _justReset = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // _max = 4; Already allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 int NameList::count() const { return _cur; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void NameList::reset() { _iter = 0; _justReset = true;}
a61af66fc99e Initial load
duke
parents:
diff changeset
68 const char *NameList::iter() {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 if (_justReset) {_justReset=false; return (_iter < _cur ? _names[_iter] : NULL);}
a61af66fc99e Initial load
duke
parents:
diff changeset
70 else return (_iter <_cur-1 ? _names[++_iter] : NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72 const char *NameList::current() { return (_iter < _cur ? _names[_iter] : NULL); }
624
337400e7a5dd 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 603
diff changeset
73 const char *NameList::peek(int skip) { return (_iter + skip < _cur ? _names[_iter + skip] : NULL); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Return 'true' if current entry is signal
a61af66fc99e Initial load
duke
parents:
diff changeset
76 bool NameList::current_is_signal() {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 const char *entry = current();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 return is_signal(entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Return true if entry is a signal
a61af66fc99e Initial load
duke
parents:
diff changeset
82 bool NameList::is_signal(const char *entry) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return ( (strcmp(entry,NameList::_signal) == 0) ? true : false);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // Search for a name in the list
a61af66fc99e Initial load
duke
parents:
diff changeset
87 bool NameList::search(const char *name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 const char *entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 for(reset(); (entry = iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 if(!strcmp(entry,name)) return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // Return index of name in list
a61af66fc99e Initial load
duke
parents:
diff changeset
96 int NameList::index(const char *name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int cnt = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 const char *entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 for(reset(); (entry = iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if(!strcmp(entry,name)) return cnt;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 cnt++;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 return Not_in_list;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Return name at index in list
a61af66fc99e Initial load
duke
parents:
diff changeset
107 const char *NameList::name(intptr_t index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return ( index < _cur ? _names[index] : NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void NameList::dump() { output(stderr); }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void NameList::output(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 fprintf(fp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Run iteration over all entries, independent of position of iterator.
a61af66fc99e Initial load
duke
parents:
diff changeset
117 const char *name = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 int iter = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 bool justReset = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 while( ( name = (justReset ?
a61af66fc99e Initial load
duke
parents:
diff changeset
122 (justReset=false, (iter < _cur ? _names[iter] : NULL)) :
a61af66fc99e Initial load
duke
parents:
diff changeset
123 (iter < _cur-1 ? _names[++iter] : NULL)) )
a61af66fc99e Initial load
duke
parents:
diff changeset
124 != NULL ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
125 fprintf( fp, " %s,\n", name);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 fprintf(fp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 //------------------------------NameAndList------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // Storage for a name and an associated list of names
a61af66fc99e Initial load
duke
parents:
diff changeset
132 NameAndList::NameAndList(char *name) : _name(name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 NameAndList::~NameAndList() {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // Add to entries in list
a61af66fc99e Initial load
duke
parents:
diff changeset
138 void NameAndList::add_entry(const char *entry) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 _list.addName(entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // Access the name and its associated list.
a61af66fc99e Initial load
duke
parents:
diff changeset
143 const char *NameAndList::name() const { return _name; }
a61af66fc99e Initial load
duke
parents:
diff changeset
144 void NameAndList::reset() { _list.reset(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
145 const char *NameAndList::iter() { return _list.iter(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // Return the "index" entry in the list, zero-based
a61af66fc99e Initial load
duke
parents:
diff changeset
148 const char *NameAndList::operator[](int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 assert( index >= 0, "Internal Error(): index less than 0.");
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 _list.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
152 const char *entry = _list.iter();
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // Iterate further if it isn't at index 0.
a61af66fc99e Initial load
duke
parents:
diff changeset
154 for ( int position = 0; position != index; ++position ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 entry = _list.iter();
a61af66fc99e Initial load
duke
parents:
diff changeset
156 }
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 void NameAndList::dump() { output(stderr); }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 void NameAndList::output(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 fprintf(fp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // Output the Name
a61af66fc99e Initial load
duke
parents:
diff changeset
167 fprintf(fp, "Name == %s", (_name ? _name : "") );
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 // Output the associated list of names
a61af66fc99e Initial load
duke
parents:
diff changeset
170 const char *name;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 fprintf(fp, " (");
a61af66fc99e Initial load
duke
parents:
diff changeset
172 for (reset(); (name = iter()) != NULL;) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 fprintf(fp, " %s,\n", name);
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 fprintf(fp, ")");
a61af66fc99e Initial load
duke
parents:
diff changeset
176 fprintf(fp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 //------------------------------Form-------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
180 OpClassForm *Form::is_opclass() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 OperandForm *Form::is_operand() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 InstructForm *Form::is_instruction() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 MachNodeForm *Form::is_machnode() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
193 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195
a61af66fc99e Initial load
duke
parents:
diff changeset
196 AttributeForm *Form::is_attribute() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 Effect *Form::is_effect() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 ResourceForm *Form::is_resource() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
205 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 PipeClassForm *Form::is_pipeclass() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211
a61af66fc99e Initial load
duke
parents:
diff changeset
212 Form::DataType Form::ideal_to_const_type(const char *name) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
213 if( name == NULL ) { return Form::none; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214
a61af66fc99e Initial load
duke
parents:
diff changeset
215 if (strcmp(name,"ConI")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 if (strcmp(name,"ConP")==0) return Form::idealP;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
217 if (strcmp(name,"ConN")==0) return Form::idealN;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
218 if (strcmp(name,"ConL")==0) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
219 if (strcmp(name,"ConF")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 if (strcmp(name,"ConD")==0) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
221 if (strcmp(name,"Bool")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 return Form::none;
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 Form::DataType Form::ideal_to_sReg_type(const char *name) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 if( name == NULL ) { return Form::none; }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 if (strcmp(name,"sRegI")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
230 if (strcmp(name,"sRegP")==0) return Form::idealP;
a61af66fc99e Initial load
duke
parents:
diff changeset
231 if (strcmp(name,"sRegF")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (strcmp(name,"sRegD")==0) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
233 if (strcmp(name,"sRegL")==0) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
234 return Form::none;
a61af66fc99e Initial load
duke
parents:
diff changeset
235 }
a61af66fc99e Initial load
duke
parents:
diff changeset
236
a61af66fc99e Initial load
duke
parents:
diff changeset
237 Form::DataType Form::ideal_to_Reg_type(const char *name) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 if( name == NULL ) { return Form::none; }
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 if (strcmp(name,"RegI")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
241 if (strcmp(name,"RegP")==0) return Form::idealP;
a61af66fc99e Initial load
duke
parents:
diff changeset
242 if (strcmp(name,"RegF")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
243 if (strcmp(name,"RegD")==0) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
244 if (strcmp(name,"RegL")==0) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 return Form::none;
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 // True if 'opType', an ideal name, loads or stores.
a61af66fc99e Initial load
duke
parents:
diff changeset
250 Form::DataType Form::is_load_from_memory(const char *opType) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 if( strcmp(opType,"LoadB")==0 ) return Form::idealB;
624
337400e7a5dd 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 603
diff changeset
252 if( strcmp(opType,"LoadUB")==0 ) return Form::idealB;
558
3b5ac9e7e6ea 6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents: 415
diff changeset
253 if( strcmp(opType,"LoadUS")==0 ) return Form::idealC;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
254 if( strcmp(opType,"LoadD")==0 ) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
255 if( strcmp(opType,"LoadD_unaligned")==0 ) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
256 if( strcmp(opType,"LoadF")==0 ) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 if( strcmp(opType,"LoadI")==0 ) return Form::idealI;
624
337400e7a5dd 6797305: Add LoadUB and LoadUI opcode class
twisti
parents: 603
diff changeset
258 if( strcmp(opType,"LoadUI2L")==0 ) return Form::idealI;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
259 if( strcmp(opType,"LoadKlass")==0 ) return Form::idealP;
164
c436414a719e 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 113
diff changeset
260 if( strcmp(opType,"LoadNKlass")==0 ) return Form::idealN;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
261 if( strcmp(opType,"LoadL")==0 ) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if( strcmp(opType,"LoadL_unaligned")==0 ) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
263 if( strcmp(opType,"LoadPLocked")==0 ) return Form::idealP;
a61af66fc99e Initial load
duke
parents:
diff changeset
264 if( strcmp(opType,"LoadLLocked")==0 ) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
265 if( strcmp(opType,"LoadP")==0 ) return Form::idealP;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
266 if( strcmp(opType,"LoadN")==0 ) return Form::idealN;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
267 if( strcmp(opType,"LoadRange")==0 ) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
268 if( strcmp(opType,"LoadS")==0 ) return Form::idealS;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 if( strcmp(opType,"Load16B")==0 ) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
270 if( strcmp(opType,"Load8B")==0 ) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 if( strcmp(opType,"Load4B")==0 ) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
272 if( strcmp(opType,"Load8C")==0 ) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
273 if( strcmp(opType,"Load4C")==0 ) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
274 if( strcmp(opType,"Load2C")==0 ) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
275 if( strcmp(opType,"Load8S")==0 ) return Form::idealS;
a61af66fc99e Initial load
duke
parents:
diff changeset
276 if( strcmp(opType,"Load4S")==0 ) return Form::idealS;
a61af66fc99e Initial load
duke
parents:
diff changeset
277 if( strcmp(opType,"Load2S")==0 ) return Form::idealS;
a61af66fc99e Initial load
duke
parents:
diff changeset
278 if( strcmp(opType,"Load2D")==0 ) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
279 if( strcmp(opType,"Load4F")==0 ) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
280 if( strcmp(opType,"Load2F")==0 ) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
281 if( strcmp(opType,"Load4I")==0 ) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
282 if( strcmp(opType,"Load2I")==0 ) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
283 if( strcmp(opType,"Load2L")==0 ) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
284 assert( strcmp(opType,"Load") != 0, "Must type Loads" );
a61af66fc99e Initial load
duke
parents:
diff changeset
285 return Form::none;
a61af66fc99e Initial load
duke
parents:
diff changeset
286 }
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 Form::DataType Form::is_store_to_memory(const char *opType) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 if( strcmp(opType,"StoreB")==0) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
290 if( strcmp(opType,"StoreCM")==0) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
291 if( strcmp(opType,"StoreC")==0) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
292 if( strcmp(opType,"StoreD")==0) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
293 if( strcmp(opType,"StoreF")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
294 if( strcmp(opType,"StoreI")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
295 if( strcmp(opType,"StoreL")==0) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
296 if( strcmp(opType,"StoreP")==0) return Form::idealP;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
297 if( strcmp(opType,"StoreN")==0) return Form::idealN;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
298 if( strcmp(opType,"Store16B")==0) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
299 if( strcmp(opType,"Store8B")==0) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 if( strcmp(opType,"Store4B")==0) return Form::idealB;
a61af66fc99e Initial load
duke
parents:
diff changeset
301 if( strcmp(opType,"Store8C")==0) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
302 if( strcmp(opType,"Store4C")==0) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 if( strcmp(opType,"Store2C")==0) return Form::idealC;
a61af66fc99e Initial load
duke
parents:
diff changeset
304 if( strcmp(opType,"Store2D")==0) return Form::idealD;
a61af66fc99e Initial load
duke
parents:
diff changeset
305 if( strcmp(opType,"Store4F")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
306 if( strcmp(opType,"Store2F")==0) return Form::idealF;
a61af66fc99e Initial load
duke
parents:
diff changeset
307 if( strcmp(opType,"Store4I")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
308 if( strcmp(opType,"Store2I")==0) return Form::idealI;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 if( strcmp(opType,"Store2L")==0) return Form::idealL;
a61af66fc99e Initial load
duke
parents:
diff changeset
310 assert( strcmp(opType,"Store") != 0, "Must type Stores" );
a61af66fc99e Initial load
duke
parents:
diff changeset
311 return Form::none;
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 Form::InterfaceType Form::interface_type(FormDict &globals) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
315 return Form::no_interface;
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 //------------------------------FormList---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
319 // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
320 FormList::~FormList() {
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // // This list may not own its elements
a61af66fc99e Initial load
duke
parents:
diff changeset
322 // Form *cur = _root;
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // Form *next = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // for( ; (cur = next) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // next = (Form *)cur->_next;
a61af66fc99e Initial load
duke
parents:
diff changeset
326 // delete cur;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
328 };
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 //------------------------------FormDict---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
331 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
332 FormDict::FormDict( CmpKey cmp, Hash hash, Arena *arena )
a61af66fc99e Initial load
duke
parents:
diff changeset
333 : _form(cmp, hash, arena) {
a61af66fc99e Initial load
duke
parents:
diff changeset
334 }
a61af66fc99e Initial load
duke
parents:
diff changeset
335 FormDict::~FormDict() {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 }
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // Return # of name-Form pairs in dict
a61af66fc99e Initial load
duke
parents:
diff changeset
339 int FormDict::Size(void) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
340 return _form.Size();
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 // Insert inserts the given key-value pair into the dictionary. The prior
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // value of the key is returned; NULL if the key was not previously defined.
a61af66fc99e Initial load
duke
parents:
diff changeset
345 const Form *FormDict::Insert(const char *name, Form *form) {
a61af66fc99e Initial load
duke
parents:
diff changeset
346 return (Form*)_form.Insert((void*)name, (void*)form);
a61af66fc99e Initial load
duke
parents:
diff changeset
347 }
a61af66fc99e Initial load
duke
parents:
diff changeset
348
a61af66fc99e Initial load
duke
parents:
diff changeset
349 // Finds the value of a given key; or NULL if not found.
a61af66fc99e Initial load
duke
parents:
diff changeset
350 // The dictionary is NOT changed.
a61af66fc99e Initial load
duke
parents:
diff changeset
351 const Form *FormDict::operator [](const char *name) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
352 return (Form*)_form[name];
a61af66fc99e Initial load
duke
parents:
diff changeset
353 }
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355 //------------------------------FormDict::private------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
356 // Disable public use of constructor, copy-ctor, operator =, operator ==
a61af66fc99e Initial load
duke
parents:
diff changeset
357 FormDict::FormDict( ) : _form(cmpkey,hashkey) {
a61af66fc99e Initial load
duke
parents:
diff changeset
358 assert( false, "NotImplemented");
a61af66fc99e Initial load
duke
parents:
diff changeset
359 }
a61af66fc99e Initial load
duke
parents:
diff changeset
360 FormDict::FormDict( const FormDict & fd) : _form(fd._form) {
a61af66fc99e Initial load
duke
parents:
diff changeset
361 }
a61af66fc99e Initial load
duke
parents:
diff changeset
362 FormDict &FormDict::operator =( const FormDict &rhs) {
a61af66fc99e Initial load
duke
parents:
diff changeset
363 assert( false, "NotImplemented");
a61af66fc99e Initial load
duke
parents:
diff changeset
364 _form = rhs._form;
a61af66fc99e Initial load
duke
parents:
diff changeset
365 return *this;
a61af66fc99e Initial load
duke
parents:
diff changeset
366 }
a61af66fc99e Initial load
duke
parents:
diff changeset
367 // == compares two dictionaries; they must have the same keys (their keys
a61af66fc99e Initial load
duke
parents:
diff changeset
368 // must match using CmpKey) and they must have the same values (pointer
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // comparison). If so 1 is returned, if not 0 is returned.
a61af66fc99e Initial load
duke
parents:
diff changeset
370 bool FormDict::operator ==(const FormDict &d) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
371 assert( false, "NotImplemented");
a61af66fc99e Initial load
duke
parents:
diff changeset
372 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
373 }
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 // Print out the dictionary contents as key-value pairs
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 558
diff changeset
376 static void dumpkey (const void* key) { fprintf(stdout, "%s", (char*) key); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
377 static void dumpform(const void* form) { fflush(stdout); ((Form*)form)->dump(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
378
a61af66fc99e Initial load
duke
parents:
diff changeset
379 void FormDict::dump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
380 _form.print(dumpkey, dumpform);
a61af66fc99e Initial load
duke
parents:
diff changeset
381 }
a61af66fc99e Initial load
duke
parents:
diff changeset
382
a61af66fc99e Initial load
duke
parents:
diff changeset
383 //------------------------------SourceForm-------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
384 SourceForm::SourceForm(char* code) : _code(code) { }; // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
385 SourceForm::~SourceForm() {
a61af66fc99e Initial load
duke
parents:
diff changeset
386 }
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 void SourceForm::dump() { // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
389 output(stderr);
a61af66fc99e Initial load
duke
parents:
diff changeset
390 }
a61af66fc99e Initial load
duke
parents:
diff changeset
391
a61af66fc99e Initial load
duke
parents:
diff changeset
392 void SourceForm::output(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
393 fprintf(fp,"\n//%s\n%s\n",classname(),(_code?_code:""));
a61af66fc99e Initial load
duke
parents:
diff changeset
394 }