comparison src/share/vm/ci/ciMethod.cpp @ 4137:04b9a2566eec

Merge with hsx23/hotspot.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 17 Dec 2011 21:40:27 +0100
parents 47edfca346ab 5eb9169b1a14
children 597bc897257d
comparison
equal deleted inserted replaced
3737:9dc19b7d89a3 4137:04b9a2566eec
147 // ------------------------------------------------------------------ 147 // ------------------------------------------------------------------
148 // ciMethod::ciMethod 148 // ciMethod::ciMethod
149 // 149 //
150 // Unloaded method. 150 // Unloaded method.
151 ciMethod::ciMethod(ciInstanceKlass* holder, 151 ciMethod::ciMethod(ciInstanceKlass* holder,
152 ciSymbol* name, 152 ciSymbol* name,
153 ciSymbol* signature) : ciObject(ciMethodKlass::make()) { 153 ciSymbol* signature,
154 // These fields are always filled in. 154 ciInstanceKlass* accessor) :
155 _name = name; 155 ciObject(ciMethodKlass::make()),
156 _holder = holder; 156 _name( name),
157 _signature = new (CURRENT_ENV->arena()) ciSignature(_holder, constantPoolHandle(), signature); 157 _holder( holder),
158 _intrinsic_id = vmIntrinsics::_none; 158 _intrinsic_id( vmIntrinsics::_none),
159 _liveness = NULL; 159 _liveness( NULL),
160 _can_be_statically_bound = false; 160 _can_be_statically_bound(false),
161 _method_blocks = NULL; 161 _method_blocks( NULL),
162 _method_data = NULL; 162 _method_data( NULL)
163 #if defined(COMPILER2) || defined(SHARK) 163 #if defined(COMPILER2) || defined(SHARK)
164 _flow = NULL; 164 ,
165 _bcea = NULL; 165 _flow( NULL),
166 _bcea( NULL)
166 #endif // COMPILER2 || SHARK 167 #endif // COMPILER2 || SHARK
168 {
169 // Usually holder and accessor are the same type but in some cases
170 // the holder has the wrong class loader (e.g. invokedynamic call
171 // sites) so we pass the accessor.
172 _signature = new (CURRENT_ENV->arena()) ciSignature(accessor, constantPoolHandle(), signature);
167 } 173 }
168 174
169 175
170 // ------------------------------------------------------------------ 176 // ------------------------------------------------------------------
171 // ciMethod::load_code 177 // ciMethod::load_code
1009 nmethod* nm = get_methodOop()->code(); 1015 nmethod* nm = get_methodOop()->code();
1010 if (nm != NULL) return nm->comp_level(); 1016 if (nm != NULL) return nm->comp_level();
1011 return 0; 1017 return 0;
1012 } 1018 }
1013 1019
1020 int ciMethod::highest_osr_comp_level() {
1021 check_is_loaded();
1022 VM_ENTRY_MARK;
1023 return get_methodOop()->highest_osr_comp_level();
1024 }
1025
1026 // ------------------------------------------------------------------
1027 // ciMethod::code_size_for_inlining
1028 //
1029 // Code size for inlining decisions.
1030 //
1031 // Don't fully count method handle adapters against inlining budgets:
1032 // the metric we use here is the number of call sites in the adapter
1033 // as they are probably the instructions which generate some code.
1034 int ciMethod::code_size_for_inlining() {
1035 check_is_loaded();
1036
1037 // Method handle adapters
1038 if (is_method_handle_adapter()) {
1039 // Count call sites
1040 int call_site_count = 0;
1041 ciBytecodeStream iter(this);
1042 while (iter.next() != ciBytecodeStream::EOBC()) {
1043 if (Bytecodes::is_invoke(iter.cur_bc())) {
1044 call_site_count++;
1045 }
1046 }
1047 return call_site_count;
1048 }
1049
1050 // Normal method
1051 return code_size();
1052 }
1053
1014 // ------------------------------------------------------------------ 1054 // ------------------------------------------------------------------
1015 // ciMethod::instructions_size 1055 // ciMethod::instructions_size
1016 // 1056 //
1017 // This is a rough metric for "fat" methods, compared before inlining 1057 // This is a rough metric for "fat" methods, compared before inlining
1018 // with InlineSmallCode. The CodeBlob::code_size accessor includes 1058 // with InlineSmallCode. The CodeBlob::code_size accessor includes