comparison src/share/vm/ci/ciMethod.cpp @ 6988:2cb439954abf

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 19 Nov 2012 15:36:13 +0100
parents e522a00b91aa bb33c6fdcf0d
children 291ffc492eb6
comparison
equal deleted inserted replaced
6963:dd0dd0321e2a 6988:2cb439954abf
29 #include "ci/ciMethod.hpp" 29 #include "ci/ciMethod.hpp"
30 #include "ci/ciMethodBlocks.hpp" 30 #include "ci/ciMethodBlocks.hpp"
31 #include "ci/ciMethodData.hpp" 31 #include "ci/ciMethodData.hpp"
32 #include "ci/ciStreams.hpp" 32 #include "ci/ciStreams.hpp"
33 #include "ci/ciSymbol.hpp" 33 #include "ci/ciSymbol.hpp"
34 #include "ci/ciReplay.hpp"
34 #include "ci/ciUtilities.hpp" 35 #include "ci/ciUtilities.hpp"
35 #include "classfile/systemDictionary.hpp" 36 #include "classfile/systemDictionary.hpp"
36 #include "compiler/abstractCompiler.hpp" 37 #include "compiler/abstractCompiler.hpp"
37 #include "compiler/compilerOracle.hpp" 38 #include "compiler/compilerOracle.hpp"
38 #include "compiler/methodLiveness.hpp" 39 #include "compiler/methodLiveness.hpp"
137 _interpreter_invocation_count = 0; 138 _interpreter_invocation_count = 0;
138 _interpreter_throwout_count = 0; 139 _interpreter_throwout_count = 0;
139 } 140 }
140 if (_interpreter_invocation_count == 0) 141 if (_interpreter_invocation_count == 0)
141 _interpreter_invocation_count = 1; 142 _interpreter_invocation_count = 1;
143 _instructions_size = -1;
144 #ifdef ASSERT
145 if (ReplayCompiles) {
146 ciReplay::initialize(this);
147 }
148 #endif
142 } 149 }
143 150
144 151
145 // ------------------------------------------------------------------ 152 // ------------------------------------------------------------------
146 // ciMethod::ciMethod 153 // ciMethod::ciMethod
159 _method_blocks( NULL), 166 _method_blocks( NULL),
160 _method_data( NULL) 167 _method_data( NULL)
161 #if defined(COMPILER2) || defined(SHARK) 168 #if defined(COMPILER2) || defined(SHARK)
162 , 169 ,
163 _flow( NULL), 170 _flow( NULL),
164 _bcea( NULL) 171 _bcea( NULL),
172 _instructions_size(-1)
165 #endif // COMPILER2 || SHARK 173 #endif // COMPILER2 || SHARK
166 { 174 {
167 // Usually holder and accessor are the same type but in some cases 175 // Usually holder and accessor are the same type but in some cases
168 // the holder has the wrong class loader (e.g. invokedynamic call 176 // the holder has the wrong class loader (e.g. invokedynamic call
169 // sites) so we pass the accessor. 177 // sites) so we pass the accessor.
866 if (md->is_empty()) return NULL; 874 if (md->is_empty()) return NULL;
867 return md; 875 return md;
868 } 876 }
869 877
870 // ------------------------------------------------------------------ 878 // ------------------------------------------------------------------
871 // ciMethod::will_link
872 //
873 // Will this method link in a specific calling context?
874 bool ciMethod::will_link(ciKlass* accessing_klass,
875 ciKlass* declared_method_holder,
876 Bytecodes::Code bc) {
877 if (!is_loaded()) {
878 // Method lookup failed.
879 return false;
880 }
881
882 // The link checks have been front-loaded into the get_method
883 // call. This method (ciMethod::will_link()) will be removed
884 // in the future.
885
886 return true;
887 }
888
889 // ------------------------------------------------------------------
890 // ciMethod::should_exclude 879 // ciMethod::should_exclude
891 // 880 //
892 // Should this method be excluded from compilation? 881 // Should this method be excluded from compilation?
893 bool ciMethod::should_exclude() { 882 bool ciMethod::should_exclude() {
894 check_is_loaded(); 883 check_is_loaded();
998 } 987 }
999 988
1000 // ------------------------------------------------------------------ 989 // ------------------------------------------------------------------
1001 // ciMethod::has_compiled_code 990 // ciMethod::has_compiled_code
1002 bool ciMethod::has_compiled_code() { 991 bool ciMethod::has_compiled_code() {
1003 VM_ENTRY_MARK; 992 return instructions_size() > 0;
1004 return get_Method()->code() != NULL;
1005 } 993 }
1006 994
1007 int ciMethod::comp_level() { 995 int ciMethod::comp_level() {
1008 check_is_loaded(); 996 check_is_loaded();
1009 VM_ENTRY_MARK; 997 VM_ENTRY_MARK;
1037 // This is a rough metric for "fat" methods, compared before inlining 1025 // This is a rough metric for "fat" methods, compared before inlining
1038 // with InlineSmallCode. The CodeBlob::code_size accessor includes 1026 // with InlineSmallCode. The CodeBlob::code_size accessor includes
1039 // junk like exception handler, stubs, and constant table, which are 1027 // junk like exception handler, stubs, and constant table, which are
1040 // not highly relevant to an inlined method. So we use the more 1028 // not highly relevant to an inlined method. So we use the more
1041 // specific accessor nmethod::insts_size. 1029 // specific accessor nmethod::insts_size.
1042 int ciMethod::instructions_size(int comp_level) { 1030 int ciMethod::instructions_size() {
1043 GUARDED_VM_ENTRY( 1031 if (_instructions_size == -1) {
1044 nmethod* code = get_Method()->code(); 1032 GUARDED_VM_ENTRY(
1045 if (code != NULL && (comp_level == CompLevel_any || comp_level == code->comp_level())) { 1033 nmethod* code = get_Method()->code();
1046 return code->insts_end() - code->verified_entry_point(); 1034 if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) {
1047 } 1035 _instructions_size = code->insts_end() - code->verified_entry_point();
1048 return 0; 1036 } else {
1049 ) 1037 _instructions_size = 0;
1038 }
1039 );
1040 }
1041 return _instructions_size;
1050 } 1042 }
1051 1043
1052 // ------------------------------------------------------------------ 1044 // ------------------------------------------------------------------
1053 // ciMethod::log_nmethod_identity 1045 // ciMethod::log_nmethod_identity
1054 void ciMethod::log_nmethod_identity(xmlStream* log) { 1046 void ciMethod::log_nmethod_identity(xmlStream* log) {
1164 return _method_blocks; 1156 return _method_blocks;
1165 } 1157 }
1166 1158
1167 #undef FETCH_FLAG_FROM_VM 1159 #undef FETCH_FLAG_FROM_VM
1168 1160
1161 void ciMethod::dump_replay_data(outputStream* st) {
1162 ASSERT_IN_VM;
1163 Method* method = get_Method();
1164 Klass* holder = method->method_holder();
1165 st->print_cr("ciMethod %s %s %s %d %d %d %d %d",
1166 holder->name()->as_quoted_ascii(),
1167 method->name()->as_quoted_ascii(),
1168 method->signature()->as_quoted_ascii(),
1169 method->invocation_counter()->raw_counter(),
1170 method->backedge_counter()->raw_counter(),
1171 interpreter_invocation_count(),
1172 interpreter_throwout_count(),
1173 _instructions_size);
1174 }
1169 1175
1170 // ------------------------------------------------------------------ 1176 // ------------------------------------------------------------------
1171 // ciMethod::print_codes 1177 // ciMethod::print_codes
1172 // 1178 //
1173 // Print a range of the bytecodes for this method. 1179 // Print a range of the bytecodes for this method.