< prev index next >

src/hotspot/share/c1/c1_Compilation.hpp

Print this page

 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/compilerDefinitions.inline.hpp"
 33 #include "compiler/compilerDirectives.hpp"
 34 #include "memory/resourceArea.hpp"
 35 #include "runtime/deoptimization.hpp"

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

 79   bool               _has_fpu_code;
 80   bool               _has_unsafe_access;
 81   bool               _has_irreducible_loops;
 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               _has_monitors; // Fastpath monitors detection for Continuations
 86   bool               _has_scoped_access; // For shared scope closure
 87   bool               _install_code;
 88   const char*        _bailout_msg;
 89   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 90   bool               _oom;
 91   ExceptionInfoList* _exception_info_list;
 92   ExceptionHandlerTable _exception_handler_table;
 93   ImplicitExceptionTable _implicit_exception_table;
 94   LinearScan*        _allocator;
 95   CodeOffsets        _offsets;
 96   CodeBuffer         _code;
 97   bool               _has_access_indexed;
 98   int                _interpreter_frame_size; // Stack space needed in case of a deoptimization

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

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




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







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

 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/compilerDefinitions.inline.hpp"
 33 #include "compiler/compilerDirectives.hpp"
 34 #include "memory/resourceArea.hpp"
 35 #include "runtime/deoptimization.hpp"
 36 #include "runtime/sharedRuntime.hpp"
 37 
 38 class CompilationFailureInfo;
 39 class CompilationResourceObj;
 40 class XHandlers;
 41 class ExceptionInfo;
 42 class DebugInformationRecorder;
 43 class FrameMap;
 44 class IR;
 45 class IRScope;
 46 class Instruction;
 47 class LinearScan;
 48 class OopMap;
 49 class LIR_Emitter;
 50 class LIR_Assembler;
 51 class CodeEmitInfo;
 52 class ciEnv;
 53 class ciMethod;
 54 class ValueStack;
 55 class C1_MacroAssembler;
 56 class CFGPrinter;

 80   bool               _has_fpu_code;
 81   bool               _has_unsafe_access;
 82   bool               _has_irreducible_loops;
 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               _has_monitors; // Fastpath monitors detection for Continuations
 87   bool               _has_scoped_access; // For shared scope closure
 88   bool               _install_code;
 89   const char*        _bailout_msg;
 90   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 91   bool               _oom;
 92   ExceptionInfoList* _exception_info_list;
 93   ExceptionHandlerTable _exception_handler_table;
 94   ImplicitExceptionTable _implicit_exception_table;
 95   LinearScan*        _allocator;
 96   CodeOffsets        _offsets;
 97   CodeBuffer         _code;
 98   bool               _has_access_indexed;
 99   int                _interpreter_frame_size; // Stack space needed in case of a deoptimization
100   CompiledEntrySignature _compiled_entry_signature;
101   int                _immediate_oops_patched;
102 
103   // compilation helpers
104   void initialize();
105   void build_hir();
106   void emit_lir();
107 
108   void emit_code_epilog(LIR_Assembler* assembler);
109   int  emit_code_body();
110 
111   int  compile_java_method();
112   void install_code(int frame_size);
113   void compile_method();
114 
115   void generate_exception_handler_table();
116 
117   ExceptionInfoList* exception_info_list() const { return _exception_info_list; }
118   ExceptionHandlerTable* exception_handler_table() { return &_exception_handler_table; }
119 
120   void        set_allocator(LinearScan* allocator) { _allocator = allocator; }

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