< prev index next >

src/hotspot/share/c1/c1_Compilation.hpp

Print this page

 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  *
 23  */
 24 
 25 #ifndef SHARE_C1_C1_COMPILATION_HPP
 26 #define SHARE_C1_C1_COMPILATION_HPP
 27 
 28 #include "ci/ciEnv.hpp"
 29 #include "ci/ciMethodData.hpp"
 30 #include "code/exceptionHandlerTable.hpp"
 31 #include "compiler/compiler_globals.hpp"
 32 #include "compiler/compilerDirectives.hpp"
 33 #include "memory/resourceArea.hpp"
 34 #include "runtime/deoptimization.hpp"

 35 
 36 class CompilationResourceObj;
 37 class XHandlers;
 38 class ExceptionInfo;
 39 class DebugInformationRecorder;
 40 class FrameMap;
 41 class IR;
 42 class IRScope;
 43 class Instruction;
 44 class LinearScan;
 45 class OopMap;
 46 class LIR_Emitter;
 47 class LIR_Assembler;
 48 class CodeEmitInfo;
 49 class ciEnv;
 50 class ciMethod;
 51 class ValueStack;
 52 class LIR_OprDesc;
 53 class C1_MacroAssembler;
 54 class CFGPrinter;

 75   IR*                _hir;
 76   int                _max_spills;
 77   FrameMap*          _frame_map;
 78   C1_MacroAssembler* _masm;
 79   bool               _has_exception_handlers;
 80   bool               _has_fpu_code;
 81   bool               _has_unsafe_access;
 82   bool               _would_profile;
 83   bool               _has_method_handle_invokes;  // True if this method has MethodHandle invokes.
 84   bool               _has_reserved_stack_access;
 85   bool               _install_code;
 86   const char*        _bailout_msg;
 87   ExceptionInfoList* _exception_info_list;
 88   ExceptionHandlerTable _exception_handler_table;
 89   ImplicitExceptionTable _implicit_exception_table;
 90   LinearScan*        _allocator;
 91   CodeOffsets        _offsets;
 92   CodeBuffer         _code;
 93   bool               _has_access_indexed;
 94   int                _interpreter_frame_size; // Stack space needed in case of a deoptimization

 95 
 96   // compilation helpers
 97   void initialize();
 98   void build_hir();
 99   void emit_lir();
100 
101   void emit_code_epilog(LIR_Assembler* assembler);
102   int  emit_code_body();
103 
104   int  compile_java_method();
105   void install_code(int frame_size);
106   void compile_method();
107 
108   void generate_exception_handler_table();
109 
110   ExceptionInfoList* exception_info_list() const { return _exception_info_list; }
111   ExceptionHandlerTable* exception_handler_table() { return &_exception_handler_table; }
112 
113   void        set_allocator(LinearScan* allocator) { _allocator = allocator; }
114 

240   }
241   bool profile_inlined_calls() {
242     return profile_calls() && C1ProfileInlinedCalls;
243   }
244   bool profile_checkcasts() {
245     return env()->comp_level() == CompLevel_full_profile &&
246       C1UpdateMethodData && C1ProfileCheckcasts;
247   }
248   bool profile_parameters() {
249     return env()->comp_level() == CompLevel_full_profile &&
250       C1UpdateMethodData && MethodData::profile_parameters();
251   }
252   bool profile_arguments() {
253     return env()->comp_level() == CompLevel_full_profile &&
254       C1UpdateMethodData && MethodData::profile_arguments();
255   }
256   bool profile_return() {
257     return env()->comp_level() == CompLevel_full_profile &&
258       C1UpdateMethodData && MethodData::profile_return();
259   }




260   bool age_code() const {
261     return _method->profile_aging();
262   }
263 
264   // will compilation make optimistic assumptions that might lead to
265   // deoptimization and that the runtime will account for?
266   bool is_optimistic() {
267     return CompilerConfig::is_c1_only_no_jvmci() && !is_profiling() &&
268       (RangeCheckElimination || UseLoopInvariantCodeMotion) &&
269       method()->method_data()->trap_count(Deoptimization::Reason_none) == 0;
270   }
271 
272   ciKlass* cha_exact_type(ciType* type);
273 
274   // Dump inlining replay data to the stream.
275   void dump_inline_data(outputStream* out) { /* do nothing now */ }
276 
277   // How much stack space would the interpreter need in case of a
278   // deoptimization (worst case)
279   void update_interpreter_frame_size(int size) {
280     if (_interpreter_frame_size < size) {
281       _interpreter_frame_size = size;
282     }
283   }
284 
285   int interpreter_frame_size() const {
286     return _interpreter_frame_size;
287   }







288 };
289 
290 
291 // Macro definitions for unified bailout-support
292 // The methods bailout() and bailed_out() are present in all classes
293 // that might bailout, but forward all calls to Compilation
294 #define BAILOUT(msg)               { bailout(msg); return;              }
295 #define BAILOUT_(msg, res)         { bailout(msg); return res;          }
296 
297 #define CHECK_BAILOUT()            { if (bailed_out()) return;          }
298 #define CHECK_BAILOUT_(res)        { if (bailed_out()) return res;      }
299 
300 // BAILOUT check with reset of bound labels
301 #define CHECK_BAILOUT1(l1)         { if (bailed_out()) { l1.reset();                         return; } }
302 #define CHECK_BAILOUT2(l1, l2)     { if (bailed_out()) { l1.reset(); l2.reset();             return; } }
303 #define CHECK_BAILOUT3(l1, l2, l3) { if (bailed_out()) { l1.reset(); l2.reset(); l3.reset(); return; } }
304 
305 
306 class InstructionMark: public StackObj {
307  private:

 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  *
 23  */
 24 
 25 #ifndef SHARE_C1_C1_COMPILATION_HPP
 26 #define SHARE_C1_C1_COMPILATION_HPP
 27 
 28 #include "ci/ciEnv.hpp"
 29 #include "ci/ciMethodData.hpp"
 30 #include "code/exceptionHandlerTable.hpp"
 31 #include "compiler/compiler_globals.hpp"
 32 #include "compiler/compilerDirectives.hpp"
 33 #include "memory/resourceArea.hpp"
 34 #include "runtime/deoptimization.hpp"
 35 #include "runtime/sharedRuntime.hpp"
 36 
 37 class CompilationResourceObj;
 38 class XHandlers;
 39 class ExceptionInfo;
 40 class DebugInformationRecorder;
 41 class FrameMap;
 42 class IR;
 43 class IRScope;
 44 class Instruction;
 45 class LinearScan;
 46 class OopMap;
 47 class LIR_Emitter;
 48 class LIR_Assembler;
 49 class CodeEmitInfo;
 50 class ciEnv;
 51 class ciMethod;
 52 class ValueStack;
 53 class LIR_OprDesc;
 54 class C1_MacroAssembler;
 55 class CFGPrinter;

 76   IR*                _hir;
 77   int                _max_spills;
 78   FrameMap*          _frame_map;
 79   C1_MacroAssembler* _masm;
 80   bool               _has_exception_handlers;
 81   bool               _has_fpu_code;
 82   bool               _has_unsafe_access;
 83   bool               _would_profile;
 84   bool               _has_method_handle_invokes;  // True if this method has MethodHandle invokes.
 85   bool               _has_reserved_stack_access;
 86   bool               _install_code;
 87   const char*        _bailout_msg;
 88   ExceptionInfoList* _exception_info_list;
 89   ExceptionHandlerTable _exception_handler_table;
 90   ImplicitExceptionTable _implicit_exception_table;
 91   LinearScan*        _allocator;
 92   CodeOffsets        _offsets;
 93   CodeBuffer         _code;
 94   bool               _has_access_indexed;
 95   int                _interpreter_frame_size; // Stack space needed in case of a deoptimization
 96   CompiledEntrySignature _compiled_entry_signature;
 97 
 98   // compilation helpers
 99   void initialize();
100   void build_hir();
101   void emit_lir();
102 
103   void emit_code_epilog(LIR_Assembler* assembler);
104   int  emit_code_body();
105 
106   int  compile_java_method();
107   void install_code(int frame_size);
108   void compile_method();
109 
110   void generate_exception_handler_table();
111 
112   ExceptionInfoList* exception_info_list() const { return _exception_info_list; }
113   ExceptionHandlerTable* exception_handler_table() { return &_exception_handler_table; }
114 
115   void        set_allocator(LinearScan* allocator) { _allocator = allocator; }
116 

242   }
243   bool profile_inlined_calls() {
244     return profile_calls() && C1ProfileInlinedCalls;
245   }
246   bool profile_checkcasts() {
247     return env()->comp_level() == CompLevel_full_profile &&
248       C1UpdateMethodData && C1ProfileCheckcasts;
249   }
250   bool profile_parameters() {
251     return env()->comp_level() == CompLevel_full_profile &&
252       C1UpdateMethodData && MethodData::profile_parameters();
253   }
254   bool profile_arguments() {
255     return env()->comp_level() == CompLevel_full_profile &&
256       C1UpdateMethodData && MethodData::profile_arguments();
257   }
258   bool profile_return() {
259     return env()->comp_level() == CompLevel_full_profile &&
260       C1UpdateMethodData && MethodData::profile_return();
261   }
262   bool profile_array_accesses() {
263     return env()->comp_level() == CompLevel_full_profile &&
264       C1UpdateMethodData;
265   }
266   bool age_code() const {
267     return _method->profile_aging();
268   }
269 
270   // will compilation make optimistic assumptions that might lead to
271   // deoptimization and that the runtime will account for?
272   bool is_optimistic() {
273     return CompilerConfig::is_c1_only_no_jvmci() && !is_profiling() &&
274       (RangeCheckElimination || UseLoopInvariantCodeMotion) &&
275       method()->method_data()->trap_count(Deoptimization::Reason_none) == 0;
276   }
277 
278   ciKlass* cha_exact_type(ciType* type);
279 
280   // Dump inlining replay data to the stream.
281   void dump_inline_data(outputStream* out) { /* do nothing now */ }
282 
283   // How much stack space would the interpreter need in case of a
284   // deoptimization (worst case)
285   void update_interpreter_frame_size(int size) {
286     if (_interpreter_frame_size < size) {
287       _interpreter_frame_size = size;
288     }
289   }
290 
291   int interpreter_frame_size() const {
292     return _interpreter_frame_size;
293   }
294 
295   const CompiledEntrySignature* compiled_entry_signature() const {
296     return &_compiled_entry_signature;
297   }
298   bool needs_stack_repair() const {
299     return compiled_entry_signature()->c1_needs_stack_repair();
300   }
301 };
302 
303 
304 // Macro definitions for unified bailout-support
305 // The methods bailout() and bailed_out() are present in all classes
306 // that might bailout, but forward all calls to Compilation
307 #define BAILOUT(msg)               { bailout(msg); return;              }
308 #define BAILOUT_(msg, res)         { bailout(msg); return res;          }
309 
310 #define CHECK_BAILOUT()            { if (bailed_out()) return;          }
311 #define CHECK_BAILOUT_(res)        { if (bailed_out()) return res;      }
312 
313 // BAILOUT check with reset of bound labels
314 #define CHECK_BAILOUT1(l1)         { if (bailed_out()) { l1.reset();                         return; } }
315 #define CHECK_BAILOUT2(l1, l2)     { if (bailed_out()) { l1.reset(); l2.reset();             return; } }
316 #define CHECK_BAILOUT3(l1, l2, l3) { if (bailed_out()) { l1.reset(); l2.reset(); l3.reset(); return; } }
317 
318 
319 class InstructionMark: public StackObj {
320  private:
< prev index next >