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 *
87 LIR_List* entry_code() const { return _entry_code; }
88 int entry_pco() const { return _entry_pco; }
89 int phi_operand() const { assert(_phi_operand != -1, "not set"); return _phi_operand; }
90 int scope_count() const { assert(_scope_count != -1, "not set"); return _scope_count; }
91 DEBUG_ONLY(int lir_op_id() const { return _lir_op_id; });
92
93 void set_entry_block(BlockBegin* entry_block) {
94 assert(entry_block->is_set(BlockBegin::exception_entry_flag), "must be an exception handler entry");
95 assert(entry_block->bci() == handler_bci(), "bci's must correspond");
96 _entry_block = entry_block;
97 }
98 void set_entry_code(LIR_List* entry_code) { _entry_code = entry_code; }
99 void set_entry_pco(int entry_pco) { _entry_pco = entry_pco; }
100 void set_phi_operand(int phi_operand) { _phi_operand = phi_operand; }
101 void set_scope_count(int scope_count) { _scope_count = scope_count; }
102 DEBUG_ONLY(void set_lir_op_id(int lir_op_id) { _lir_op_id = lir_op_id; });
103
104 bool equals(XHandler* other) const;
105 };
106
107 define_array(_XHandlerArray, XHandler*)
108 define_stack(_XHandlerList, _XHandlerArray)
109
110
111 // XHandlers is the C1 internal list of exception handlers for a method
112 class XHandlers: public CompilationResourceObj {
113 private:
114 _XHandlerList _list;
115
116 public:
117 // creation
118 XHandlers() : _list() { }
119 XHandlers(ciMethod* method);
120 XHandlers(XHandlers* other);
121
122 // accessors
123 int length() const { return _list.length(); }
124 XHandler* handler_at(int i) const { return _list.at(i); }
125 bool has_handlers() const { return _list.length() > 0; }
126 void append(XHandler* h) { _list.append(h); }
127 XHandler* remove_last() { return _list.pop(); }
128
129 bool could_catch(ciInstanceKlass* klass, bool type_is_exact) const;
130 bool equals(XHandlers* others) const;
131 };
132
133
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
|
1 /*
2 * Copyright (c) 1999, 2016, 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 *
87 LIR_List* entry_code() const { return _entry_code; }
88 int entry_pco() const { return _entry_pco; }
89 int phi_operand() const { assert(_phi_operand != -1, "not set"); return _phi_operand; }
90 int scope_count() const { assert(_scope_count != -1, "not set"); return _scope_count; }
91 DEBUG_ONLY(int lir_op_id() const { return _lir_op_id; });
92
93 void set_entry_block(BlockBegin* entry_block) {
94 assert(entry_block->is_set(BlockBegin::exception_entry_flag), "must be an exception handler entry");
95 assert(entry_block->bci() == handler_bci(), "bci's must correspond");
96 _entry_block = entry_block;
97 }
98 void set_entry_code(LIR_List* entry_code) { _entry_code = entry_code; }
99 void set_entry_pco(int entry_pco) { _entry_pco = entry_pco; }
100 void set_phi_operand(int phi_operand) { _phi_operand = phi_operand; }
101 void set_scope_count(int scope_count) { _scope_count = scope_count; }
102 DEBUG_ONLY(void set_lir_op_id(int lir_op_id) { _lir_op_id = lir_op_id; });
103
104 bool equals(XHandler* other) const;
105 };
106
107 typedef GrowableArray<XHandler*> _XHandlerList;
108
109 // XHandlers is the C1 internal list of exception handlers for a method
110 class XHandlers: public CompilationResourceObj {
111 private:
112 _XHandlerList _list;
113
114 public:
115 // creation
116 XHandlers() : _list() { }
117 XHandlers(ciMethod* method);
118 XHandlers(XHandlers* other);
119
120 // accessors
121 int length() const { return _list.length(); }
122 XHandler* handler_at(int i) const { return _list.at(i); }
123 bool has_handlers() const { return _list.length() > 0; }
124 void append(XHandler* h) { _list.append(h); }
125 XHandler* remove_last() { return _list.pop(); }
126
127 bool could_catch(ciInstanceKlass* klass, bool type_is_exact) const;
128 bool equals(XHandlers* others) const;
129 };
130
131
132 class IRScope;
133 typedef GrowableArray<IRScope*> IRScopeList;
134
135 class Compilation;
136 class IRScope: public CompilationResourceObj {
137 private:
138 // hierarchy
139 Compilation* _compilation; // the current compilation
140 IRScope* _caller; // the caller scope, or NULL
141 int _level; // the inlining level
142 ciMethod* _method; // the corresponding method
143 IRScopeList _callees; // the inlined method scopes
144
145 // graph
146 XHandlers* _xhandlers; // the exception handlers
147 int _number_of_locks; // the number of monitor lock slots needed
148 bool _monitor_pairing_ok; // the monitor pairing info
149 bool _wrote_final; // has written final field
150 bool _wrote_fields; // has written fields
151 bool _wrote_volatile; // has written volatile field
152 BlockBegin* _start; // the start block, successsors are method entries
153
|