annotate src/share/vm/c1/c1_IR.hpp @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 0bf37f737702
children 52b4284cb496
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: 8860
diff changeset
2 * Copyright (c) 1999, 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: 1295
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
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: 1295
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: 1819
diff changeset
25 #ifndef SHARE_VM_C1_C1_IR_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
26 #define SHARE_VM_C1_C1_IR_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
28 #include "c1/c1_Instruction.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
29 #include "ci/ciExceptionHandler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
30 #include "ci/ciMethod.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
31 #include "ci/ciStreams.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
32 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
33
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // An XHandler is a C1 internal description for an exception handler
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class XHandler: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
38 ciExceptionHandler* _desc;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 BlockBegin* _entry_block; // Entry block of xhandler
a61af66fc99e Initial load
duke
parents:
diff changeset
41 LIR_List* _entry_code; // LIR-operations that must be executed before jumping to entry_block
a61af66fc99e Initial load
duke
parents:
diff changeset
42 int _entry_pco; // pco where entry_code (or entry_block if no entry_code) starts
a61af66fc99e Initial load
duke
parents:
diff changeset
43 int _phi_operand; // For resolving of phi functions at begin of entry_block
a61af66fc99e Initial load
duke
parents:
diff changeset
44 int _scope_count; // for filling ExceptionRangeEntry::scope_count
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
47 int _lir_op_id; // op_id of the LIR-operation throwing to this handler
a61af66fc99e Initial load
duke
parents:
diff changeset
48 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
52 XHandler(ciExceptionHandler* desc)
a61af66fc99e Initial load
duke
parents:
diff changeset
53 : _desc(desc)
a61af66fc99e Initial load
duke
parents:
diff changeset
54 , _entry_block(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
55 , _entry_code(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
56 , _entry_pco(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
57 , _phi_operand(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
58 , _scope_count(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
59 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
60 , _lir_op_id(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
61 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
62 { }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 XHandler(XHandler* other)
a61af66fc99e Initial load
duke
parents:
diff changeset
65 : _desc(other->_desc)
a61af66fc99e Initial load
duke
parents:
diff changeset
66 , _entry_block(other->_entry_block)
a61af66fc99e Initial load
duke
parents:
diff changeset
67 , _entry_code(other->_entry_code)
a61af66fc99e Initial load
duke
parents:
diff changeset
68 , _entry_pco(other->_entry_pco)
a61af66fc99e Initial load
duke
parents:
diff changeset
69 , _phi_operand(other->_phi_operand)
a61af66fc99e Initial load
duke
parents:
diff changeset
70 , _scope_count(other->_scope_count)
a61af66fc99e Initial load
duke
parents:
diff changeset
71 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
72 , _lir_op_id(other->_lir_op_id)
a61af66fc99e Initial load
duke
parents:
diff changeset
73 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
74 { }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // accessors for data of ciExceptionHandler
a61af66fc99e Initial load
duke
parents:
diff changeset
77 int beg_bci() const { return _desc->start(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 int end_bci() const { return _desc->limit(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int handler_bci() const { return _desc->handler_bci(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 bool is_catch_all() const { return _desc->is_catch_all(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 int catch_type() const { return _desc->catch_klass_index(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 ciInstanceKlass* catch_klass() const { return _desc->catch_klass(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 bool covers(int bci) const { return beg_bci() <= bci && bci < end_bci(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // accessors for additional fields
a61af66fc99e Initial load
duke
parents:
diff changeset
86 BlockBegin* entry_block() const { return _entry_block; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 LIR_List* entry_code() const { return _entry_code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 int entry_pco() const { return _entry_pco; }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 int phi_operand() const { assert(_phi_operand != -1, "not set"); return _phi_operand; }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 int scope_count() const { assert(_scope_count != -1, "not set"); return _scope_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 DEBUG_ONLY(int lir_op_id() const { return _lir_op_id; });
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 void set_entry_block(BlockBegin* entry_block) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 assert(entry_block->is_set(BlockBegin::exception_entry_flag), "must be an exception handler entry");
a61af66fc99e Initial load
duke
parents:
diff changeset
95 assert(entry_block->bci() == handler_bci(), "bci's must correspond");
a61af66fc99e Initial load
duke
parents:
diff changeset
96 _entry_block = entry_block;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98 void set_entry_code(LIR_List* entry_code) { _entry_code = entry_code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void set_entry_pco(int entry_pco) { _entry_pco = entry_pco; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void set_phi_operand(int phi_operand) { _phi_operand = phi_operand; }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void set_scope_count(int scope_count) { _scope_count = scope_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 DEBUG_ONLY(void set_lir_op_id(int lir_op_id) { _lir_op_id = lir_op_id; });
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 bool equals(XHandler* other) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 };
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 define_array(_XHandlerArray, XHandler*)
a61af66fc99e Initial load
duke
parents:
diff changeset
108 define_stack(_XHandlerList, _XHandlerArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // XHandlers is the C1 internal list of exception handlers for a method
a61af66fc99e Initial load
duke
parents:
diff changeset
112 class XHandlers: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
114 _XHandlerList _list;
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
118 XHandlers() : _list() { }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 XHandlers(ciMethod* method);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 XHandlers(XHandlers* other);
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
123 int length() const { return _list.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 XHandler* handler_at(int i) const { return _list.at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 bool has_handlers() const { return _list.length() > 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 void append(XHandler* h) { _list.append(h); }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 XHandler* remove_last() { return _list.pop(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 bool could_catch(ciInstanceKlass* klass, bool type_is_exact) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 bool equals(XHandlers* others) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
131 };
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 class IRScope;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 define_array(IRScopeArray, IRScope*)
a61af66fc99e Initial load
duke
parents:
diff changeset
136 define_stack(IRScopeList, IRScopeArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 class Compilation;
a61af66fc99e Initial load
duke
parents:
diff changeset
139 class IRScope: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
142 Compilation* _compilation; // the current compilation
a61af66fc99e Initial load
duke
parents:
diff changeset
143 IRScope* _caller; // the caller scope, or NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
144 int _level; // the inlining level
a61af66fc99e Initial load
duke
parents:
diff changeset
145 ciMethod* _method; // the corresponding method
a61af66fc99e Initial load
duke
parents:
diff changeset
146 IRScopeList _callees; // the inlined method scopes
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // graph
a61af66fc99e Initial load
duke
parents:
diff changeset
149 XHandlers* _xhandlers; // the exception handlers
a61af66fc99e Initial load
duke
parents:
diff changeset
150 int _number_of_locks; // the number of monitor lock slots needed
a61af66fc99e Initial load
duke
parents:
diff changeset
151 bool _monitor_pairing_ok; // the monitor pairing info
4966
701a83c86f28 7120481: storeStore barrier in constructor with final field
jiangli
parents: 1972
diff changeset
152 bool _wrote_final; // has written final field
0
a61af66fc99e Initial load
duke
parents:
diff changeset
153 BlockBegin* _start; // the start block, successsors are method entries
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155 BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
158 BlockBegin* build_graph(Compilation* compilation, int osr_bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
162 IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph = false);
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
165 Compilation* compilation() const { return _compilation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
166 IRScope* caller() const { return _caller; }
a61af66fc99e Initial load
duke
parents:
diff changeset
167 int level() const { return _level; }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 ciMethod* method() const { return _method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
169 int max_stack() const; // NOTE: expensive
a61af66fc99e Initial load
duke
parents:
diff changeset
170 BitMap& requires_phi_function() { return _requires_phi_function; }
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
173 bool is_top_scope() const { return _caller == NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 void add_callee(IRScope* callee) { _callees.append(callee); }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 int number_of_callees() const { return _callees.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
176 IRScope* callee_no(int i) const { return _callees.at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // accessors, graph
a61af66fc99e Initial load
duke
parents:
diff changeset
179 bool is_valid() const { return start() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
180 XHandlers* xhandlers() const { return _xhandlers; }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 int number_of_locks() const { return _number_of_locks; }
a61af66fc99e Initial load
duke
parents:
diff changeset
182 void set_min_number_of_locks(int n) { if (n > _number_of_locks) _number_of_locks = n; }
a61af66fc99e Initial load
duke
parents:
diff changeset
183 bool monitor_pairing_ok() const { return _monitor_pairing_ok; }
a61af66fc99e Initial load
duke
parents:
diff changeset
184 BlockBegin* start() const { return _start; }
4966
701a83c86f28 7120481: storeStore barrier in constructor with final field
jiangli
parents: 1972
diff changeset
185 void set_wrote_final() { _wrote_final = true; }
701a83c86f28 7120481: storeStore barrier in constructor with final field
jiangli
parents: 1972
diff changeset
186 bool wrote_final () const { return _wrote_final; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
187 };
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 //
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // IRScopeDebugInfo records the debug information for a particular IRScope
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // in a particular CodeEmitInfo. This allows the information to be computed
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // once early enough for the OopMap to be available to the LIR and also to be
a61af66fc99e Initial load
duke
parents:
diff changeset
194 // reemited for different pcs using the same CodeEmitInfo without recomputing
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // everything.
a61af66fc99e Initial load
duke
parents:
diff changeset
196 //
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 class IRScopeDebugInfo: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
199 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
200 IRScope* _scope;
a61af66fc99e Initial load
duke
parents:
diff changeset
201 int _bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 GrowableArray<ScopeValue*>* _locals;
a61af66fc99e Initial load
duke
parents:
diff changeset
203 GrowableArray<ScopeValue*>* _expressions;
a61af66fc99e Initial load
duke
parents:
diff changeset
204 GrowableArray<MonitorValue*>* _monitors;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 IRScopeDebugInfo* _caller;
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
208 IRScopeDebugInfo(IRScope* scope,
a61af66fc99e Initial load
duke
parents:
diff changeset
209 int bci,
a61af66fc99e Initial load
duke
parents:
diff changeset
210 GrowableArray<ScopeValue*>* locals,
a61af66fc99e Initial load
duke
parents:
diff changeset
211 GrowableArray<ScopeValue*>* expressions,
a61af66fc99e Initial load
duke
parents:
diff changeset
212 GrowableArray<MonitorValue*>* monitors,
a61af66fc99e Initial load
duke
parents:
diff changeset
213 IRScopeDebugInfo* caller):
a61af66fc99e Initial load
duke
parents:
diff changeset
214 _scope(scope)
a61af66fc99e Initial load
duke
parents:
diff changeset
215 , _locals(locals)
a61af66fc99e Initial load
duke
parents:
diff changeset
216 , _bci(bci)
a61af66fc99e Initial load
duke
parents:
diff changeset
217 , _expressions(expressions)
a61af66fc99e Initial load
duke
parents:
diff changeset
218 , _monitors(monitors)
a61af66fc99e Initial load
duke
parents:
diff changeset
219 , _caller(caller) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221
a61af66fc99e Initial load
duke
parents:
diff changeset
222 IRScope* scope() { return _scope; }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 int bci() { return _bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
224 GrowableArray<ScopeValue*>* locals() { return _locals; }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 GrowableArray<ScopeValue*>* expressions() { return _expressions; }
a61af66fc99e Initial load
duke
parents:
diff changeset
226 GrowableArray<MonitorValue*>* monitors() { return _monitors; }
a61af66fc99e Initial load
duke
parents:
diff changeset
227 IRScopeDebugInfo* caller() { return _caller; }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
229 //Whether we should reexecute this bytecode for deopt
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
230 bool should_reexecute();
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
231
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1253
diff changeset
232 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool topmost, bool is_method_handle_invoke = false) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
233 if (caller() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // Order is significant: Must record caller first.
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
235 caller()->record_debug_info(recorder, pc_offset, false/*topmost*/);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237 DebugToken* locvals = recorder->create_scope_values(locals());
a61af66fc99e Initial load
duke
parents:
diff changeset
238 DebugToken* expvals = recorder->create_scope_values(expressions());
a61af66fc99e Initial load
duke
parents:
diff changeset
239 DebugToken* monvals = recorder->create_monitor_values(monitors());
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
240 // reexecute allowed only for the topmost frame
1135
e66fd840cb6b 6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents: 948
diff changeset
241 bool reexecute = topmost ? should_reexecute() : false;
1253
f70b0d9ab095 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 1135
diff changeset
242 bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
f70b0d9ab095 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 1135
diff changeset
243 recorder->describe_scope(pc_offset, scope()->method(), bci(), reexecute, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 };
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 class CodeEmitInfo: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
249 friend class LinearScan;
a61af66fc99e Initial load
duke
parents:
diff changeset
250 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
251 IRScopeDebugInfo* _scope_debug_info;
a61af66fc99e Initial load
duke
parents:
diff changeset
252 IRScope* _scope;
a61af66fc99e Initial load
duke
parents:
diff changeset
253 XHandlers* _exception_handlers;
a61af66fc99e Initial load
duke
parents:
diff changeset
254 OopMap* _oop_map;
a61af66fc99e Initial load
duke
parents:
diff changeset
255 ValueStack* _stack; // used by deoptimization (contains also monitors
1564
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
256 bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 6842
diff changeset
257 bool _deoptimize_on_exception;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
260 Compilation* compilation() const { return scope()->compilation(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 // use scope from ValueStack
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 6842
diff changeset
265 CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception = false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 // make a copy
1819
f02a8bbe6ed4 6986046: C1 valuestack cleanup
roland
parents: 1584
diff changeset
268 CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack = NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
269
a61af66fc99e Initial load
duke
parents:
diff changeset
270 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
271 OopMap* oop_map() { return _oop_map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 ciMethod* method() const { return _scope->method(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
273 IRScope* scope() const { return _scope; }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 XHandlers* exception_handlers() const { return _exception_handlers; }
a61af66fc99e Initial load
duke
parents:
diff changeset
275 ValueStack* stack() const { return _stack; }
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 6842
diff changeset
276 bool deoptimize_on_exception() const { return _deoptimize_on_exception; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278 void add_register_oop(LIR_Opr opr);
1564
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
279 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
280
1564
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
281 bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
282 void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
17980
0bf37f737702 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 17467
diff changeset
283
0bf37f737702 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 17467
diff changeset
284 int interpreter_frame_size() const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
285 };
a61af66fc99e Initial load
duke
parents:
diff changeset
286
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 class IR: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
290 Compilation* _compilation; // the current compilation
a61af66fc99e Initial load
duke
parents:
diff changeset
291 IRScope* _top_scope; // the root of the scope hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
292 WordSize _locals_size; // the space required for all locals
a61af66fc99e Initial load
duke
parents:
diff changeset
293 int _num_loops; // Total number of loops
a61af66fc99e Initial load
duke
parents:
diff changeset
294 BlockList* _code; // the blocks in code generation order w/ use counts
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
298 IR(Compilation* compilation, ciMethod* method, int osr_bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
301 bool is_valid() const { return top_scope()->is_valid(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 Compilation* compilation() const { return _compilation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
303 IRScope* top_scope() const { return _top_scope; }
a61af66fc99e Initial load
duke
parents:
diff changeset
304 int number_of_locks() const { return top_scope()->number_of_locks(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
305 ciMethod* method() const { return top_scope()->method(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
306 BlockBegin* start() const { return top_scope()->start(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
307 BlockBegin* std_entry() const { return start()->end()->as_Base()->std_entry(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
308 BlockBegin* osr_entry() const { return start()->end()->as_Base()->osr_entry(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
309 WordSize locals_size() const { return _locals_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
310 int locals_size_in_words() const { return in_words(_locals_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
311 BlockList* code() const { return _code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 int num_loops() const { return _num_loops; }
a61af66fc99e Initial load
duke
parents:
diff changeset
313 int max_stack() const { return top_scope()->max_stack(); } // expensive
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // ir manipulation
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 6842
diff changeset
316 void optimize_blocks();
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 6842
diff changeset
317 void eliminate_null_checks();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
318 void compute_predecessors();
a61af66fc99e Initial load
duke
parents:
diff changeset
319 void split_critical_edges();
a61af66fc99e Initial load
duke
parents:
diff changeset
320 void compute_code();
a61af66fc99e Initial load
duke
parents:
diff changeset
321 void compute_use_counts();
a61af66fc99e Initial load
duke
parents:
diff changeset
322
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // The linear-scan order and the code emission order are equal, but
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // this may change in future
a61af66fc99e Initial load
duke
parents:
diff changeset
325 BlockList* linear_scan_order() { assert(_code != NULL, "not computed"); return _code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
326
a61af66fc99e Initial load
duke
parents:
diff changeset
327 // iteration
a61af66fc99e Initial load
duke
parents:
diff changeset
328 void iterate_preorder (BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
329 void iterate_postorder (BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
330 void iterate_linear_scan_order(BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
331
a61af66fc99e Initial load
duke
parents:
diff changeset
332 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
333 static void print(BlockBegin* start, bool cfg_only, bool live_only = false) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
334 void print(bool cfg_only, bool live_only = false) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
335 void verify() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
336 };
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338
a61af66fc99e Initial load
duke
parents:
diff changeset
339 // Globally do instruction substitution and remove substituted
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // instructions from the instruction list.
a61af66fc99e Initial load
duke
parents:
diff changeset
341 //
a61af66fc99e Initial load
duke
parents:
diff changeset
342
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1579
diff changeset
343 class SubstitutionResolver: public BlockClosure, ValueVisitor {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1579
diff changeset
344 virtual void visit(Value* v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
345
a61af66fc99e Initial load
duke
parents:
diff changeset
346 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
347 SubstitutionResolver(IR* hir) {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 hir->iterate_preorder(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351 SubstitutionResolver(BlockBegin* block) {
a61af66fc99e Initial load
duke
parents:
diff changeset
352 block->iterate_preorder(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
353 }
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355 virtual void block_do(BlockBegin* block);
a61af66fc99e Initial load
duke
parents:
diff changeset
356 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
357
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1819
diff changeset
358 #endif // SHARE_VM_C1_C1_IR_HPP