1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
134 class IRScope;
135 define_array(IRScopeArray, IRScope*)
136 define_stack(IRScopeList, IRScopeArray)
137
138 class Compilation;
139 class IRScope: public CompilationResourceObj {
140 private:
141 // hierarchy
142 Compilation* _compilation; // the current compilation
143 IRScope* _caller; // the caller scope, or NULL
144 int _level; // the inlining level
145 ciMethod* _method; // the corresponding method
146 IRScopeList _callees; // the inlined method scopes
147
148 // graph
149 XHandlers* _xhandlers; // the exception handlers
150 int _number_of_locks; // the number of monitor lock slots needed
151 bool _monitor_pairing_ok; // the monitor pairing info
152 bool _wrote_final; // has written final field
153 bool _wrote_fields; // has written fields
154 BlockBegin* _start; // the start block, successsors are method entries
155
156 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable
157
158 // helper functions
159 BlockBegin* build_graph(Compilation* compilation, int osr_bci);
160
161 public:
162 // creation
163 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false);
164
165 // accessors
166 Compilation* compilation() const { return _compilation; }
167 IRScope* caller() const { return _caller; }
168 int level() const { return _level; }
169 ciMethod* method() const { return _method; }
170 int max_stack() const; // NOTE: expensive
171 BitMap& requires_phi_function() { return _requires_phi_function; }
172
173 // hierarchy
174 bool is_top_scope() const { return _caller == NULL; }
175 void add_callee(IRScope* callee) { _callees.append(callee); }
176 int number_of_callees() const { return _callees.length(); }
177 IRScope* callee_no(int i) const { return _callees.at(i); }
178
179 // accessors, graph
180 bool is_valid() const { return start() != NULL; }
181 XHandlers* xhandlers() const { return _xhandlers; }
182 int number_of_locks() const { return _number_of_locks; }
183 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; }
184 bool monitor_pairing_ok() const { return _monitor_pairing_ok; }
185 BlockBegin* start() const { return _start; }
186 void set_wrote_final() { _wrote_final = true; }
187 bool wrote_final () const { return _wrote_final; }
188 void set_wrote_fields() { _wrote_fields = true; }
189 bool wrote_fields () const { return _wrote_fields; }
190
191 };
192
193
194 //
195 // IRScopeDebugInfo records the debug information for a particular IRScope
196 // in a particular CodeEmitInfo. This allows the information to be computed
197 // once early enough for the OopMap to be available to the LIR and also to be
198 // reemited for different pcs using the same CodeEmitInfo without recomputing
199 // everything.
200 //
201
202 class IRScopeDebugInfo: public CompilationResourceObj {
203 private:
204 IRScope* _scope;
205 int _bci;
206 GrowableArray<ScopeValue*>* _locals;
207 GrowableArray<ScopeValue*>* _expressions;
208 GrowableArray<MonitorValue*>* _monitors;
209 IRScopeDebugInfo* _caller;
210
|
1 /*
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
134 class IRScope;
135 define_array(IRScopeArray, IRScope*)
136 define_stack(IRScopeList, IRScopeArray)
137
138 class Compilation;
139 class IRScope: public CompilationResourceObj {
140 private:
141 // hierarchy
142 Compilation* _compilation; // the current compilation
143 IRScope* _caller; // the caller scope, or NULL
144 int _level; // the inlining level
145 ciMethod* _method; // the corresponding method
146 IRScopeList _callees; // the inlined method scopes
147
148 // graph
149 XHandlers* _xhandlers; // the exception handlers
150 int _number_of_locks; // the number of monitor lock slots needed
151 bool _monitor_pairing_ok; // the monitor pairing info
152 bool _wrote_final; // has written final field
153 bool _wrote_fields; // has written fields
154 bool _wrote_volatile; // has written volatile field
155 BlockBegin* _start; // the start block, successsors are method entries
156
157 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable
158
159 // helper functions
160 BlockBegin* build_graph(Compilation* compilation, int osr_bci);
161
162 public:
163 // creation
164 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false);
165
166 // accessors
167 Compilation* compilation() const { return _compilation; }
168 IRScope* caller() const { return _caller; }
169 int level() const { return _level; }
170 ciMethod* method() const { return _method; }
171 int max_stack() const; // NOTE: expensive
172 BitMap& requires_phi_function() { return _requires_phi_function; }
173
174 // hierarchy
175 bool is_top_scope() const { return _caller == NULL; }
176 void add_callee(IRScope* callee) { _callees.append(callee); }
177 int number_of_callees() const { return _callees.length(); }
178 IRScope* callee_no(int i) const { return _callees.at(i); }
179
180 // accessors, graph
181 bool is_valid() const { return start() != NULL; }
182 XHandlers* xhandlers() const { return _xhandlers; }
183 int number_of_locks() const { return _number_of_locks; }
184 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; }
185 bool monitor_pairing_ok() const { return _monitor_pairing_ok; }
186 BlockBegin* start() const { return _start; }
187 void set_wrote_final() { _wrote_final = true; }
188 bool wrote_final () const { return _wrote_final; }
189 void set_wrote_fields() { _wrote_fields = true; }
190 bool wrote_fields () const { return _wrote_fields; }
191 void set_wrote_volatile() { _wrote_final = true; }
192 bool wrote_volatile () const { return _wrote_final; }
193 };
194
195
196 //
197 // IRScopeDebugInfo records the debug information for a particular IRScope
198 // in a particular CodeEmitInfo. This allows the information to be computed
199 // once early enough for the OopMap to be available to the LIR and also to be
200 // reemited for different pcs using the same CodeEmitInfo without recomputing
201 // everything.
202 //
203
204 class IRScopeDebugInfo: public CompilationResourceObj {
205 private:
206 IRScope* _scope;
207 int _bci;
208 GrowableArray<ScopeValue*>* _locals;
209 GrowableArray<ScopeValue*>* _expressions;
210 GrowableArray<MonitorValue*>* _monitors;
211 IRScopeDebugInfo* _caller;
212
|