< prev index next >

src/hotspot/share/ci/ciEnv.hpp

Print this page

 22  *
 23  */
 24 
 25 #ifndef SHARE_CI_CIENV_HPP
 26 #define SHARE_CI_CIENV_HPP
 27 
 28 #include "ci/ciClassList.hpp"
 29 #include "ci/ciObjectFactory.hpp"
 30 #include "classfile/vmClassMacros.hpp"
 31 #include "code/debugInfoRec.hpp"
 32 #include "code/dependencies.hpp"
 33 #include "code/exceptionHandlerTable.hpp"
 34 #include "compiler/compiler_globals.hpp"
 35 #include "compiler/compilerThread.hpp"
 36 #include "compiler/cHeapStringHolder.hpp"
 37 #include "oops/methodData.hpp"
 38 #include "runtime/javaThread.hpp"
 39 
 40 class CompileTask;
 41 class OopMapSet;

 42 
 43 // ciEnv
 44 //
 45 // This class is the top level broker for requests from the compiler
 46 // to the VM.
 47 class ciEnv : StackObj {
 48   CI_PACKAGE_ACCESS_TO
 49   friend class CompileBroker;
 50   friend class Dependencies;  // for get_object, during logging
 51   friend class RecordLocation;
 52   friend class PrepareExtraDataClosure;
 53 
 54 private:
 55   Arena*           _arena;       // Alias for _ciEnv_arena except in init_shared_objects()
 56   Arena            _ciEnv_arena;
 57   ciObjectFactory* _factory;
 58   OopRecorder*     _oop_recorder;
 59   DebugInformationRecorder* _debug_info;
 60   Dependencies*    _dependencies;
 61   CHeapStringHolder _failure_reason;

357 
358   // The compiler task which has created this env.
359   // May be useful to find out compile_id, comp_level, etc.
360   CompileTask* task() const { return _task; }
361 
362   // Handy forwards to the task:
363   int comp_level();   // task()->comp_level()
364   int compile_id();  // task()->compile_id()
365 
366   // Register the result of a compilation.
367   void register_method(ciMethod*                 target,
368                        int                       entry_bci,
369                        CodeOffsets*              offsets,
370                        int                       orig_pc_offset,
371                        CodeBuffer*               code_buffer,
372                        int                       frame_words,
373                        OopMapSet*                oop_map_set,
374                        ExceptionHandlerTable*    handler_table,
375                        ImplicitExceptionTable*   inc_table,
376                        AbstractCompiler*         compiler,


377                        bool                      has_unsafe_access,
378                        bool                      has_wide_vectors,
379                        bool                      has_monitors,
380                        bool                      has_scoped_access,
381                        int                       immediate_oops_patched);


382 
383   // Access to certain well known ciObjects.
384 #define VM_CLASS_FUNC(name, ignore_s) \
385   ciInstanceKlass* name() { \
386     return _##name;\
387   }
388   VM_CLASSES_DO(VM_CLASS_FUNC)
389 #undef VM_CLASS_FUNC
390 
391   ciInstance* NullPointerException_instance() {
392     assert(_NullPointerException_instance != nullptr, "initialization problem");
393     return _NullPointerException_instance;
394   }
395   ciInstance* ArithmeticException_instance() {
396     assert(_ArithmeticException_instance != nullptr, "initialization problem");
397     return _ArithmeticException_instance;
398   }
399   ciInstance* ArrayIndexOutOfBoundsException_instance() {
400     assert(_ArrayIndexOutOfBoundsException_instance != nullptr, "initialization problem");
401     return _ArrayIndexOutOfBoundsException_instance;

451 
452   // Notice that a method has been inlined in the current compile;
453   // used only for statistics.
454   void notice_inlined_method(ciMethod* method);
455 
456   // Total number of bytecodes in inlined methods in this compile
457   int num_inlined_bytecodes() const;
458 
459   // Output stream for logging compilation info.
460   CompileLog* log() { return _log; }
461   void set_log(CompileLog* log) { _log = log; }
462 
463   void record_failure(const char* reason);      // Record failure and report later
464   void report_failure(const char* reason);      // Report failure immediately
465   void record_method_not_compilable(const char* reason, bool all_tiers = false);
466   void record_out_of_memory_failure();
467 
468   // RedefineClasses support
469   void metadata_do(MetadataClosure* f) { _factory->metadata_do(f); }
470 







471   // Replay support
472 private:
473   static int klass_compare(const InstanceKlass* const &ik1, const InstanceKlass* const &ik2) {
474     if (ik1 > ik2) {
475       return 1;
476     } else if (ik1 < ik2) {
477       return -1;
478     } else {
479       return 0;
480     }
481   }
482   bool dyno_loc(const InstanceKlass* ik, const char *&loc) const;
483   void set_dyno_loc(const InstanceKlass* ik);
484   void record_best_dyno_loc(const InstanceKlass* ik);
485   bool print_dyno_loc(outputStream* out, const InstanceKlass* ik) const;
486 
487   GrowableArray<const InstanceKlass*>* _dyno_klasses;
488   GrowableArray<const char *>*         _dyno_locs;
489 
490 #define MAX_DYNO_NAME_LENGTH 1024

495   void dump_replay_data(int compile_id);
496   void dump_inline_data(int compile_id);
497   void dump_replay_data(outputStream* out);
498   void dump_replay_data_unsafe(outputStream* out);
499   void dump_replay_data_helper(outputStream* out);
500   void dump_compile_data(outputStream* out);
501   void dump_replay_data_version(outputStream* out);
502 
503   const char *dyno_name(const InstanceKlass* ik) const;
504   const char *replay_name(const InstanceKlass* ik) const;
505   const char *replay_name(ciKlass* i) const;
506 
507   void record_lambdaform(Thread* thread, oop obj);
508   void record_member(Thread* thread, oop obj);
509   void record_mh(Thread* thread, oop obj);
510   void record_call_site_obj(Thread* thread, oop obj);
511   void record_call_site_method(Thread* thread, Method* adapter);
512   void process_invokedynamic(const constantPoolHandle &cp, int index, JavaThread* thread);
513   void process_invokehandle(const constantPoolHandle &cp, int index, JavaThread* thread);
514   void find_dynamic_call_sites();




515 };
516 
517 #endif // SHARE_CI_CIENV_HPP

 22  *
 23  */
 24 
 25 #ifndef SHARE_CI_CIENV_HPP
 26 #define SHARE_CI_CIENV_HPP
 27 
 28 #include "ci/ciClassList.hpp"
 29 #include "ci/ciObjectFactory.hpp"
 30 #include "classfile/vmClassMacros.hpp"
 31 #include "code/debugInfoRec.hpp"
 32 #include "code/dependencies.hpp"
 33 #include "code/exceptionHandlerTable.hpp"
 34 #include "compiler/compiler_globals.hpp"
 35 #include "compiler/compilerThread.hpp"
 36 #include "compiler/cHeapStringHolder.hpp"
 37 #include "oops/methodData.hpp"
 38 #include "runtime/javaThread.hpp"
 39 
 40 class CompileTask;
 41 class OopMapSet;
 42 class SCCEntry;
 43 
 44 // ciEnv
 45 //
 46 // This class is the top level broker for requests from the compiler
 47 // to the VM.
 48 class ciEnv : StackObj {
 49   CI_PACKAGE_ACCESS_TO
 50   friend class CompileBroker;
 51   friend class Dependencies;  // for get_object, during logging
 52   friend class RecordLocation;
 53   friend class PrepareExtraDataClosure;
 54 
 55 private:
 56   Arena*           _arena;       // Alias for _ciEnv_arena except in init_shared_objects()
 57   Arena            _ciEnv_arena;
 58   ciObjectFactory* _factory;
 59   OopRecorder*     _oop_recorder;
 60   DebugInformationRecorder* _debug_info;
 61   Dependencies*    _dependencies;
 62   CHeapStringHolder _failure_reason;

358 
359   // The compiler task which has created this env.
360   // May be useful to find out compile_id, comp_level, etc.
361   CompileTask* task() const { return _task; }
362 
363   // Handy forwards to the task:
364   int comp_level();   // task()->comp_level()
365   int compile_id();  // task()->compile_id()
366 
367   // Register the result of a compilation.
368   void register_method(ciMethod*                 target,
369                        int                       entry_bci,
370                        CodeOffsets*              offsets,
371                        int                       orig_pc_offset,
372                        CodeBuffer*               code_buffer,
373                        int                       frame_words,
374                        OopMapSet*                oop_map_set,
375                        ExceptionHandlerTable*    handler_table,
376                        ImplicitExceptionTable*   inc_table,
377                        AbstractCompiler*         compiler,
378                        bool                      has_clinit_barriers,
379                        bool                      for_preload,
380                        bool                      has_unsafe_access,
381                        bool                      has_wide_vectors,
382                        bool                      has_monitors,
383                        bool                      has_scoped_access,
384                        int                       immediate_oops_patched,
385                        bool                      install_code,
386                        SCCEntry*                 entry = nullptr);
387 
388   // Access to certain well known ciObjects.
389 #define VM_CLASS_FUNC(name, ignore_s) \
390   ciInstanceKlass* name() { \
391     return _##name;\
392   }
393   VM_CLASSES_DO(VM_CLASS_FUNC)
394 #undef VM_CLASS_FUNC
395 
396   ciInstance* NullPointerException_instance() {
397     assert(_NullPointerException_instance != nullptr, "initialization problem");
398     return _NullPointerException_instance;
399   }
400   ciInstance* ArithmeticException_instance() {
401     assert(_ArithmeticException_instance != nullptr, "initialization problem");
402     return _ArithmeticException_instance;
403   }
404   ciInstance* ArrayIndexOutOfBoundsException_instance() {
405     assert(_ArrayIndexOutOfBoundsException_instance != nullptr, "initialization problem");
406     return _ArrayIndexOutOfBoundsException_instance;

456 
457   // Notice that a method has been inlined in the current compile;
458   // used only for statistics.
459   void notice_inlined_method(ciMethod* method);
460 
461   // Total number of bytecodes in inlined methods in this compile
462   int num_inlined_bytecodes() const;
463 
464   // Output stream for logging compilation info.
465   CompileLog* log() { return _log; }
466   void set_log(CompileLog* log) { _log = log; }
467 
468   void record_failure(const char* reason);      // Record failure and report later
469   void report_failure(const char* reason);      // Report failure immediately
470   void record_method_not_compilable(const char* reason, bool all_tiers = false);
471   void record_out_of_memory_failure();
472 
473   // RedefineClasses support
474   void metadata_do(MetadataClosure* f) { _factory->metadata_do(f); }
475 
476 private:
477   SCCEntry* _scc_clinit_barriers_entry;
478 
479 public:
480   void  set_scc_clinit_barriers_entry(SCCEntry* entry) { _scc_clinit_barriers_entry = entry; }
481   SCCEntry* scc_clinit_barriers_entry()          const { return _scc_clinit_barriers_entry; }
482 
483   // Replay support
484 private:
485   static int klass_compare(const InstanceKlass* const &ik1, const InstanceKlass* const &ik2) {
486     if (ik1 > ik2) {
487       return 1;
488     } else if (ik1 < ik2) {
489       return -1;
490     } else {
491       return 0;
492     }
493   }
494   bool dyno_loc(const InstanceKlass* ik, const char *&loc) const;
495   void set_dyno_loc(const InstanceKlass* ik);
496   void record_best_dyno_loc(const InstanceKlass* ik);
497   bool print_dyno_loc(outputStream* out, const InstanceKlass* ik) const;
498 
499   GrowableArray<const InstanceKlass*>* _dyno_klasses;
500   GrowableArray<const char *>*         _dyno_locs;
501 
502 #define MAX_DYNO_NAME_LENGTH 1024

507   void dump_replay_data(int compile_id);
508   void dump_inline_data(int compile_id);
509   void dump_replay_data(outputStream* out);
510   void dump_replay_data_unsafe(outputStream* out);
511   void dump_replay_data_helper(outputStream* out);
512   void dump_compile_data(outputStream* out);
513   void dump_replay_data_version(outputStream* out);
514 
515   const char *dyno_name(const InstanceKlass* ik) const;
516   const char *replay_name(const InstanceKlass* ik) const;
517   const char *replay_name(ciKlass* i) const;
518 
519   void record_lambdaform(Thread* thread, oop obj);
520   void record_member(Thread* thread, oop obj);
521   void record_mh(Thread* thread, oop obj);
522   void record_call_site_obj(Thread* thread, oop obj);
523   void record_call_site_method(Thread* thread, Method* adapter);
524   void process_invokedynamic(const constantPoolHandle &cp, int index, JavaThread* thread);
525   void process_invokehandle(const constantPoolHandle &cp, int index, JavaThread* thread);
526   void find_dynamic_call_sites();
527 
528   bool is_precompiled();
529   bool is_fully_initialized(InstanceKlass* ik);
530   InstanceKlass::ClassState compute_init_state_for_precompiled(InstanceKlass* ik);
531 };
532 
533 #endif // SHARE_CI_CIENV_HPP
< prev index next >