414 bool _has_irreducible_loop; // Found irreducible loops |
413 bool _has_irreducible_loop; // Found irreducible loops |
415 // JSR 292 |
414 // JSR 292 |
416 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes. |
415 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes. |
417 RTMState _rtm_state; // State of Restricted Transactional Memory usage |
416 RTMState _rtm_state; // State of Restricted Transactional Memory usage |
418 int _loop_opts_cnt; // loop opts round |
417 int _loop_opts_cnt; // loop opts round |
|
418 bool _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry |
419 |
419 |
420 // Compilation environment. |
420 // Compilation environment. |
421 Arena _comp_arena; // Arena with lifetime equivalent to Compile |
421 Arena _comp_arena; // Arena with lifetime equivalent to Compile |
422 void* _barrier_set_state; // Potential GC barrier state for Compile |
422 void* _barrier_set_state; // Potential GC barrier state for Compile |
423 ciEnv* _env; // CI interface |
423 ciEnv* _env; // CI interface |
474 // Type management |
474 // Type management |
475 Arena _Compile_types; // Arena for all types |
475 Arena _Compile_types; // Arena for all types |
476 Arena* _type_arena; // Alias for _Compile_types except in Initialize_shared() |
476 Arena* _type_arena; // Alias for _Compile_types except in Initialize_shared() |
477 Dict* _type_dict; // Intern table |
477 Dict* _type_dict; // Intern table |
478 CloneMap _clone_map; // used for recording history of cloned nodes |
478 CloneMap _clone_map; // used for recording history of cloned nodes |
479 void* _type_hwm; // Last allocation (see Type::operator new/delete) |
|
480 size_t _type_last_size; // Last allocation size (see Type::operator new/delete) |
479 size_t _type_last_size; // Last allocation size (see Type::operator new/delete) |
481 ciMethod* _last_tf_m; // Cache for |
480 ciMethod* _last_tf_m; // Cache for |
482 const TypeFunc* _last_tf; // TypeFunc::make |
481 const TypeFunc* _last_tf; // TypeFunc::make |
483 AliasType** _alias_types; // List of alias types seen so far. |
482 AliasType** _alias_types; // List of alias types seen so far. |
484 int _num_alias_types; // Logical length of _alias_types |
483 int _num_alias_types; // Logical length of _alias_types |
655 void set_inlining_incrementally(bool z) { _inlining_incrementally = z; } |
654 void set_inlining_incrementally(bool z) { _inlining_incrementally = z; } |
656 int inlining_incrementally() const { return _inlining_incrementally; } |
655 int inlining_incrementally() const { return _inlining_incrementally; } |
657 void set_do_cleanup(bool z) { _do_cleanup = z; } |
656 void set_do_cleanup(bool z) { _do_cleanup = z; } |
658 int do_cleanup() const { return _do_cleanup; } |
657 int do_cleanup() const { return _do_cleanup; } |
659 void set_major_progress() { _major_progress++; } |
658 void set_major_progress() { _major_progress++; } |
|
659 void restore_major_progress(int progress) { _major_progress += progress; } |
660 void clear_major_progress() { _major_progress = 0; } |
660 void clear_major_progress() { _major_progress = 0; } |
661 int max_inline_size() const { return _max_inline_size; } |
661 int max_inline_size() const { return _max_inline_size; } |
662 void set_freq_inline_size(int n) { _freq_inline_size = n; } |
662 void set_freq_inline_size(int n) { _freq_inline_size = n; } |
663 int freq_inline_size() const { return _freq_inline_size; } |
663 int freq_inline_size() const { return _freq_inline_size; } |
664 void set_max_inline_size(int n) { _max_inline_size = n; } |
664 void set_max_inline_size(int n) { _max_inline_size = n; } |
712 void set_rtm_state(RTMState s) { _rtm_state = s; } |
712 void set_rtm_state(RTMState s) { _rtm_state = s; } |
713 bool use_rtm() const { return (_rtm_state & NoRTM) == 0; } |
713 bool use_rtm() const { return (_rtm_state & NoRTM) == 0; } |
714 bool profile_rtm() const { return _rtm_state == ProfileRTM; } |
714 bool profile_rtm() const { return _rtm_state == ProfileRTM; } |
715 uint max_node_limit() const { return (uint)_max_node_limit; } |
715 uint max_node_limit() const { return (uint)_max_node_limit; } |
716 void set_max_node_limit(uint n) { _max_node_limit = n; } |
716 void set_max_node_limit(uint n) { _max_node_limit = n; } |
|
717 bool clinit_barrier_on_entry() { return _clinit_barrier_on_entry; } |
|
718 void set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; } |
717 |
719 |
718 // check the CompilerOracle for special behaviours for this compile |
720 // check the CompilerOracle for special behaviours for this compile |
719 bool method_has_option(const char * option) { |
721 bool method_has_option(const char * option) { |
720 return method() != NULL && method()->has_option(option); |
722 return method() != NULL && method()->has_option(option); |
721 } |
723 } |
742 } |
744 } |
743 #endif |
745 #endif |
744 C->_latest_stage_start_counter.stamp(); |
746 C->_latest_stage_start_counter.stamp(); |
745 } |
747 } |
746 |
748 |
747 void print_method(CompilerPhaseType cpt, int level = 1) { |
749 bool should_print(int level = 1) { |
|
750 #ifndef PRODUCT |
|
751 return (_printer && _printer->should_print(level)); |
|
752 #else |
|
753 return false; |
|
754 #endif |
|
755 } |
|
756 |
|
757 void print_method(CompilerPhaseType cpt, int level = 1, int idx = 0) { |
748 EventCompilerPhase event; |
758 EventCompilerPhase event; |
749 if (event.should_commit()) { |
759 if (event.should_commit()) { |
750 event.set_starttime(C->_latest_stage_start_counter); |
760 event.set_starttime(C->_latest_stage_start_counter); |
751 event.set_phase((u1) cpt); |
761 event.set_phase((u1) cpt); |
752 event.set_compileId(C->_compile_id); |
762 event.set_compileId(C->_compile_id); |
753 event.set_phaseLevel(level); |
763 event.set_phaseLevel(level); |
754 event.commit(); |
764 event.commit(); |
755 } |
765 } |
756 |
766 |
757 |
|
758 #ifndef PRODUCT |
767 #ifndef PRODUCT |
759 if (_printer && _printer->should_print(level)) { |
768 if (should_print(level)) { |
760 _printer->print_method(CompilerPhaseTypeHelper::to_string(cpt), level); |
769 char output[1024]; |
|
770 if (idx != 0) { |
|
771 sprintf(output, "%s:%d", CompilerPhaseTypeHelper::to_string(cpt), idx); |
|
772 } else { |
|
773 sprintf(output, "%s", CompilerPhaseTypeHelper::to_string(cpt)); |
|
774 } |
|
775 _printer->print_method(output, level); |
761 } |
776 } |
762 #endif |
777 #endif |
763 C->_latest_stage_start_counter.stamp(); |
778 C->_latest_stage_start_counter.stamp(); |
764 } |
779 } |
765 |
780 |
957 void grow_node_notes(GrowableArray<Node_Notes*>* arr, int grow_by); |
972 void grow_node_notes(GrowableArray<Node_Notes*>* arr, int grow_by); |
958 |
973 |
959 // Type management |
974 // Type management |
960 Arena* type_arena() { return _type_arena; } |
975 Arena* type_arena() { return _type_arena; } |
961 Dict* type_dict() { return _type_dict; } |
976 Dict* type_dict() { return _type_dict; } |
962 void* type_hwm() { return _type_hwm; } |
|
963 size_t type_last_size() { return _type_last_size; } |
977 size_t type_last_size() { return _type_last_size; } |
964 int num_alias_types() { return _num_alias_types; } |
978 int num_alias_types() { return _num_alias_types; } |
965 |
979 |
966 void init_type_arena() { _type_arena = &_Compile_types; } |
980 void init_type_arena() { _type_arena = &_Compile_types; } |
967 void set_type_arena(Arena* a) { _type_arena = a; } |
981 void set_type_arena(Arena* a) { _type_arena = a; } |
968 void set_type_dict(Dict* d) { _type_dict = d; } |
982 void set_type_dict(Dict* d) { _type_dict = d; } |
969 void set_type_hwm(void* p) { _type_hwm = p; } |
|
970 void set_type_last_size(size_t sz) { _type_last_size = sz; } |
983 void set_type_last_size(size_t sz) { _type_last_size = sz; } |
971 |
984 |
972 const TypeFunc* last_tf(ciMethod* m) { |
985 const TypeFunc* last_tf(ciMethod* m) { |
973 return (m == _last_tf_m) ? _last_tf : NULL; |
986 return (m == _last_tf_m) ? _last_tf : NULL; |
974 } |
987 } |
1169 uint scratch_emit_size(const Node* n); |
1182 uint scratch_emit_size(const Node* n); |
1170 void set_in_scratch_emit_size(bool x) { _in_scratch_emit_size = x; } |
1183 void set_in_scratch_emit_size(bool x) { _in_scratch_emit_size = x; } |
1171 bool in_scratch_emit_size() const { return _in_scratch_emit_size; } |
1184 bool in_scratch_emit_size() const { return _in_scratch_emit_size; } |
1172 |
1185 |
1173 enum ScratchBufferBlob { |
1186 enum ScratchBufferBlob { |
1174 #if defined(PPC64) |
|
1175 MAX_inst_size = 2048, |
1187 MAX_inst_size = 2048, |
1176 #else |
|
1177 MAX_inst_size = 1024, |
|
1178 #endif |
|
1179 MAX_locs_size = 128, // number of relocInfo elements |
1188 MAX_locs_size = 128, // number of relocInfo elements |
1180 MAX_const_size = 128, |
1189 MAX_const_size = 128, |
1181 MAX_stubs_size = 128 |
1190 MAX_stubs_size = 128 |
1182 }; |
1191 }; |
1183 |
1192 |
1248 ObjectValue* sv ); |
1257 ObjectValue* sv ); |
1249 |
1258 |
1250 // Process an OopMap Element while emitting nodes |
1259 // Process an OopMap Element while emitting nodes |
1251 void Process_OopMap_Node(MachNode *mach, int code_offset); |
1260 void Process_OopMap_Node(MachNode *mach, int code_offset); |
1252 |
1261 |
|
1262 class BufferSizingData { |
|
1263 public: |
|
1264 int _stub; |
|
1265 int _code; |
|
1266 int _const; |
|
1267 int _reloc; |
|
1268 |
|
1269 BufferSizingData() : |
|
1270 _stub(0), |
|
1271 _code(0), |
|
1272 _const(0), |
|
1273 _reloc(0) |
|
1274 { }; |
|
1275 }; |
|
1276 |
1253 // Initialize code buffer |
1277 // Initialize code buffer |
1254 CodeBuffer* init_buffer(uint* blk_starts); |
1278 void estimate_buffer_size(int& const_req); |
|
1279 CodeBuffer* init_buffer(BufferSizingData& buf_sizes); |
1255 |
1280 |
1256 // Write out basic block data to code buffer |
1281 // Write out basic block data to code buffer |
1257 void fill_buffer(CodeBuffer* cb, uint* blk_starts); |
1282 void fill_buffer(CodeBuffer* cb, uint* blk_starts); |
1258 |
1283 |
1259 // Determine which variable sized branches can be shortened |
1284 // Determine which variable sized branches can be shortened |
1260 void shorten_branches(uint* blk_starts, int& code_size, int& reloc_size, int& stub_size); |
1285 void shorten_branches(uint* blk_starts, BufferSizingData& buf_sizes); |
1261 |
1286 |
1262 // Compute the size of first NumberOfLoopInstrToAlign instructions |
1287 // Compute the size of first NumberOfLoopInstrToAlign instructions |
1263 // at the head of a loop. |
1288 // at the head of a loop. |
1264 void compute_loop_first_inst_sizes(); |
1289 void compute_loop_first_inst_sizes(); |
1265 |
1290 |
1379 |
1404 |
1380 // supporting clone_map |
1405 // supporting clone_map |
1381 CloneMap& clone_map(); |
1406 CloneMap& clone_map(); |
1382 void set_clone_map(Dict* d); |
1407 void set_clone_map(Dict* d); |
1383 |
1408 |
1384 bool is_compiling_clinit_for(ciKlass* k); |
1409 bool needs_clinit_barrier(ciField* ik, ciMethod* accessing_method); |
|
1410 bool needs_clinit_barrier(ciMethod* ik, ciMethod* accessing_method); |
|
1411 bool needs_clinit_barrier(ciInstanceKlass* ik, ciMethod* accessing_method); |
1385 }; |
1412 }; |
1386 |
1413 |
1387 #endif // SHARE_OPTO_COMPILE_HPP |
1414 #endif // SHARE_OPTO_COMPILE_HPP |