70 _holder(holder) |
70 _holder(holder) |
71 { |
71 { |
72 assert(h_m() != NULL, "no null method"); |
72 assert(h_m() != NULL, "no null method"); |
73 |
73 |
74 if (LogTouchedMethods) { |
74 if (LogTouchedMethods) { |
75 h_m()->log_touched(Thread::current()); |
75 h_m->log_touched(Thread::current()); |
76 } |
76 } |
77 // These fields are always filled in in loaded methods. |
77 // These fields are always filled in in loaded methods. |
78 _flags = ciFlags(h_m()->access_flags()); |
78 _flags = ciFlags(h_m->access_flags()); |
79 |
79 |
80 // Easy to compute, so fill them in now. |
80 // Easy to compute, so fill them in now. |
81 _max_stack = h_m()->max_stack(); |
81 _max_stack = h_m->max_stack(); |
82 _max_locals = h_m()->max_locals(); |
82 _max_locals = h_m->max_locals(); |
83 _code_size = h_m()->code_size(); |
83 _code_size = h_m->code_size(); |
84 _intrinsic_id = h_m()->intrinsic_id(); |
84 _intrinsic_id = h_m->intrinsic_id(); |
85 _handler_count = h_m()->exception_table_length(); |
85 _handler_count = h_m->exception_table_length(); |
86 _size_of_parameters = h_m()->size_of_parameters(); |
86 _size_of_parameters = h_m->size_of_parameters(); |
87 _uses_monitors = h_m()->access_flags().has_monitor_bytecodes(); |
87 _uses_monitors = h_m->access_flags().has_monitor_bytecodes(); |
88 _balanced_monitors = !_uses_monitors || h_m()->access_flags().is_monitor_matching(); |
88 _balanced_monitors = !_uses_monitors || h_m->access_flags().is_monitor_matching(); |
89 _is_c1_compilable = !h_m()->is_not_c1_compilable(); |
89 _is_c1_compilable = !h_m->is_not_c1_compilable(); |
90 _is_c2_compilable = !h_m()->is_not_c2_compilable(); |
90 _is_c2_compilable = !h_m->is_not_c2_compilable(); |
91 _can_be_parsed = true; |
91 _can_be_parsed = true; |
92 _has_reserved_stack_access = h_m()->has_reserved_stack_access(); |
92 _has_reserved_stack_access = h_m->has_reserved_stack_access(); |
93 _is_overpass = h_m()->is_overpass(); |
93 _is_overpass = h_m->is_overpass(); |
94 // Lazy fields, filled in on demand. Require allocation. |
94 // Lazy fields, filled in on demand. Require allocation. |
95 _code = NULL; |
95 _code = NULL; |
96 _exception_handlers = NULL; |
96 _exception_handlers = NULL; |
97 _liveness = NULL; |
97 _liveness = NULL; |
98 _method_blocks = NULL; |
98 _method_blocks = NULL; |
112 } |
112 } |
113 } else { |
113 } else { |
114 DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint()); |
114 DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint()); |
115 } |
115 } |
116 |
116 |
117 if (h_m()->method_holder()->is_linked()) { |
117 if (h_m->method_holder()->is_linked()) { |
118 _can_be_statically_bound = h_m()->can_be_statically_bound(); |
118 _can_be_statically_bound = h_m->can_be_statically_bound(); |
119 } else { |
119 } else { |
120 // Have to use a conservative value in this case. |
120 // Have to use a conservative value in this case. |
121 _can_be_statically_bound = false; |
121 _can_be_statically_bound = false; |
122 } |
122 } |
123 |
123 |
124 // Adjust the definition of this condition to be more useful: |
124 // Adjust the definition of this condition to be more useful: |
125 // %%% take these conditions into account in vtable generation |
125 // %%% take these conditions into account in vtable generation |
126 if (!_can_be_statically_bound && h_m()->is_private()) |
126 if (!_can_be_statically_bound && h_m->is_private()) |
127 _can_be_statically_bound = true; |
127 _can_be_statically_bound = true; |
128 if (_can_be_statically_bound && h_m()->is_abstract()) |
128 if (_can_be_statically_bound && h_m->is_abstract()) |
129 _can_be_statically_bound = false; |
129 _can_be_statically_bound = false; |
130 |
130 |
131 // generating _signature may allow GC and therefore move m. |
131 // generating _signature may allow GC and therefore move m. |
132 // These fields are always filled in. |
132 // These fields are always filled in. |
133 _name = env->get_symbol(h_m()->name()); |
133 _name = env->get_symbol(h_m->name()); |
134 ciSymbol* sig_symbol = env->get_symbol(h_m()->signature()); |
134 ciSymbol* sig_symbol = env->get_symbol(h_m->signature()); |
135 constantPoolHandle cpool = h_m()->constants(); |
135 constantPoolHandle cpool(Thread::current(), h_m->constants()); |
136 _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol); |
136 _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol); |
137 _method_data = NULL; |
137 _method_data = NULL; |
138 _nmethod_age = h_m()->nmethod_age(); |
138 _nmethod_age = h_m->nmethod_age(); |
139 // Take a snapshot of these values, so they will be commensurate with the MDO. |
139 // Take a snapshot of these values, so they will be commensurate with the MDO. |
140 if (ProfileInterpreter || TieredCompilation) { |
140 if (ProfileInterpreter || TieredCompilation) { |
141 int invcnt = h_m()->interpreter_invocation_count(); |
141 int invcnt = h_m->interpreter_invocation_count(); |
142 // if the value overflowed report it as max int |
142 // if the value overflowed report it as max int |
143 _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ; |
143 _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ; |
144 _interpreter_throwout_count = h_m()->interpreter_throwout_count(); |
144 _interpreter_throwout_count = h_m->interpreter_throwout_count(); |
145 } else { |
145 } else { |
146 _interpreter_invocation_count = 0; |
146 _interpreter_invocation_count = 0; |
147 _interpreter_throwout_count = 0; |
147 _interpreter_throwout_count = 0; |
148 } |
148 } |
149 if (_interpreter_invocation_count == 0) |
149 if (_interpreter_invocation_count == 0) |
429 // OSR when loading the locals. |
429 // OSR when loading the locals. |
430 |
430 |
431 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) { |
431 ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) { |
432 VM_ENTRY_MARK; |
432 VM_ENTRY_MARK; |
433 InterpreterOopMap mask; |
433 InterpreterOopMap mask; |
434 OopMapCache::compute_one_oop_map(get_Method(), bci, &mask); |
434 OopMapCache::compute_one_oop_map(methodHandle(THREAD, get_Method()), bci, &mask); |
435 int mask_size = max_locals(); |
435 int mask_size = max_locals(); |
436 ResourceBitMap result(mask_size); |
436 ResourceBitMap result(mask_size); |
437 int i; |
437 int i; |
438 for (i = 0; i < mask_size ; i++ ) { |
438 for (i = 0; i < mask_size ; i++ ) { |
439 if (mask.is_oop(i)) result.set_bit(i); |
439 if (mask.is_oop(i)) result.set_bit(i); |
747 |
747 |
748 methodHandle target; |
748 methodHandle target; |
749 { |
749 { |
750 MutexLocker locker(Compile_lock); |
750 MutexLocker locker(Compile_lock); |
751 Klass* context = actual_recv->get_Klass(); |
751 Klass* context = actual_recv->get_Klass(); |
752 target = Dependencies::find_unique_concrete_method(context, |
752 target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, |
753 root_m->get_Method()); |
753 root_m->get_Method())); |
754 // %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods. |
754 // %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods. |
755 } |
755 } |
756 |
756 |
757 #ifndef PRODUCT |
757 #ifndef PRODUCT |
758 if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) { |
758 if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) { |
808 Symbol* h_name = name()->get_symbol(); |
808 Symbol* h_name = name()->get_symbol(); |
809 Symbol* h_signature = signature()->get_symbol(); |
809 Symbol* h_signature = signature()->get_symbol(); |
810 |
810 |
811 LinkInfo link_info(resolved, h_name, h_signature, caller_klass, |
811 LinkInfo link_info(resolved, h_name, h_signature, caller_klass, |
812 check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check); |
812 check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check); |
813 methodHandle m; |
813 Method* m = NULL; |
814 // Only do exact lookup if receiver klass has been linked. Otherwise, |
814 // Only do exact lookup if receiver klass has been linked. Otherwise, |
815 // the vtable has not been setup, and the LinkResolver will fail. |
815 // the vtable has not been setup, and the LinkResolver will fail. |
816 if (recv->is_array_klass() |
816 if (recv->is_array_klass() |
817 || |
817 || |
818 (InstanceKlass::cast(recv)->is_linked() && !exact_receiver->is_interface())) { |
818 (InstanceKlass::cast(recv)->is_linked() && !exact_receiver->is_interface())) { |
821 } else { |
821 } else { |
822 m = LinkResolver::resolve_virtual_call_or_null(recv, link_info); |
822 m = LinkResolver::resolve_virtual_call_or_null(recv, link_info); |
823 } |
823 } |
824 } |
824 } |
825 |
825 |
826 if (m.is_null()) { |
826 if (m == NULL) { |
827 // Return NULL only if there was a problem with lookup (uninitialized class, etc.) |
827 // Return NULL only if there was a problem with lookup (uninitialized class, etc.) |
828 return NULL; |
828 return NULL; |
829 } |
829 } |
830 |
830 |
831 ciMethod* result = this; |
831 ciMethod* result = this; |
832 if (m() != get_Method()) { |
832 if (m != get_Method()) { |
833 result = CURRENT_THREAD_ENV->get_method(m()); |
833 result = CURRENT_THREAD_ENV->get_method(m); |
834 } |
834 } |
835 |
835 |
836 // Don't return abstract methods because they aren't |
836 // Don't return abstract methods because they aren't |
837 // optimizable or interesting. |
837 // optimizable or interesting. |
838 if (result->is_abstract()) { |
838 if (result->is_abstract()) { |
1266 { |
1267 { |
1267 EXCEPTION_MARK; |
1268 EXCEPTION_MARK; |
1268 HandleMark hm(THREAD); |
1269 HandleMark hm(THREAD); |
1269 constantPoolHandle pool (THREAD, get_Method()->constants()); |
1270 constantPoolHandle pool (THREAD, get_Method()->constants()); |
1270 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual); |
1271 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual); |
1271 methodHandle spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD); |
1272 Method* spec_method = LinkResolver::resolve_method_statically(code, pool, refinfo_index, THREAD); |
1272 if (HAS_PENDING_EXCEPTION) { |
1273 if (HAS_PENDING_EXCEPTION) { |
1273 CLEAR_PENDING_EXCEPTION; |
1274 CLEAR_PENDING_EXCEPTION; |
1274 return false; |
1275 return false; |
1275 } else { |
1276 } else { |
1276 return (spec_method->is_static() == is_static); |
1277 return (spec_method->is_static() == is_static); |