1749 return _method_LambdaForm_Compiled; |
1749 return _method_LambdaForm_Compiled; |
1750 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature): |
1750 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature): |
1751 if (_location != _in_method) break; // only allow for methods |
1751 if (_location != _in_method) break; // only allow for methods |
1752 if (!privileged) break; // only allow in privileged code |
1752 if (!privileged) break; // only allow in privileged code |
1753 return _method_LambdaForm_Hidden; |
1753 return _method_LambdaForm_Hidden; |
|
1754 case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_HotSpotIntrinsicCandidate_signature): |
|
1755 if (_location != _in_method) break; // only allow for methods |
|
1756 if (!privileged) break; // only allow in privileged code |
|
1757 return _method_HotSpotIntrinsicCandidate; |
1754 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature): |
1758 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature): |
1755 if (_location != _in_field) break; // only allow for fields |
1759 if (_location != _in_field) break; // only allow for fields |
1756 if (!privileged) break; // only allow in privileged code |
1760 if (!privileged) break; // only allow in privileged code |
1757 return _field_Stable; |
1761 return _field_Stable; |
1758 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature): |
1762 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature): |
1788 m->set_has_injected_profile(true); |
1792 m->set_has_injected_profile(true); |
1789 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none) |
1793 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none) |
1790 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm); |
1794 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm); |
1791 if (has_annotation(_method_LambdaForm_Hidden)) |
1795 if (has_annotation(_method_LambdaForm_Hidden)) |
1792 m->set_hidden(true); |
1796 m->set_hidden(true); |
|
1797 if (has_annotation(_method_HotSpotIntrinsicCandidate) && !m->is_synthetic()) |
|
1798 m->set_intrinsic_candidate(true); |
1793 } |
1799 } |
1794 |
1800 |
1795 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) { |
1801 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) { |
1796 k->set_is_contended(is_contended()); |
1802 k->set_is_contended(is_contended()); |
1797 } |
1803 } |
4130 |
4136 |
4131 // Set up Method*::intrinsic_id as soon as we know the names of methods. |
4137 // Set up Method*::intrinsic_id as soon as we know the names of methods. |
4132 // (We used to do this lazily, but now we query it in Rewriter, |
4138 // (We used to do this lazily, but now we query it in Rewriter, |
4133 // which is eagerly done for every method, so we might as well do it now, |
4139 // which is eagerly done for every method, so we might as well do it now, |
4134 // when everything is fresh in memory.) |
4140 // when everything is fresh in memory.) |
4135 if (Method::klass_id_for_intrinsics(this_klass()) != vmSymbols::NO_SID) { |
4141 vmSymbols::SID klass_id = Method::klass_id_for_intrinsics(this_klass()); |
|
4142 if (klass_id != vmSymbols::NO_SID) { |
4136 for (int j = 0; j < methods->length(); j++) { |
4143 for (int j = 0; j < methods->length(); j++) { |
4137 methods->at(j)->init_intrinsic_id(); |
4144 Method* method = methods->at(j); |
|
4145 method->init_intrinsic_id(); |
|
4146 |
|
4147 if (CheckIntrinsics) { |
|
4148 // Check if an intrinsic is defined for method 'method', |
|
4149 // but the method is not annotated with @HotSpotIntrinsicCandidate. |
|
4150 if (method->intrinsic_id() != vmIntrinsics::_none && |
|
4151 !method->intrinsic_candidate()) { |
|
4152 tty->print("Compiler intrinsic is defined for method [%s], " |
|
4153 "but the method is not annotated with @HotSpotIntrinsicCandidate.%s", |
|
4154 method->name_and_sig_as_C_string(), |
|
4155 NOT_DEBUG(" Method will not be inlined.") DEBUG_ONLY(" Exiting.") |
|
4156 ); |
|
4157 tty->cr(); |
|
4158 DEBUG_ONLY(vm_exit(1)); |
|
4159 } |
|
4160 // Check is the method 'method' is annotated with @HotSpotIntrinsicCandidate, |
|
4161 // but there is no intrinsic available for it. |
|
4162 if (method->intrinsic_candidate() && |
|
4163 method->intrinsic_id() == vmIntrinsics::_none) { |
|
4164 tty->print("Method [%s] is annotated with @HotSpotIntrinsicCandidate, " |
|
4165 "but no compiler intrinsic is defined for the method.%s", |
|
4166 method->name_and_sig_as_C_string(), |
|
4167 NOT_DEBUG("") DEBUG_ONLY(" Exiting.") |
|
4168 ); |
|
4169 tty->cr(); |
|
4170 DEBUG_ONLY(vm_exit(1)); |
|
4171 } |
|
4172 } |
|
4173 } |
|
4174 |
|
4175 if (CheckIntrinsics) { |
|
4176 // Check for orphan methods in the current class. A method m |
|
4177 // of a class C is orphan if an intrinsic is defined for method m, |
|
4178 // but class C does not declare m. |
|
4179 |
|
4180 for (int id = vmIntrinsics::FIRST_ID; id < (int)vmIntrinsics::ID_LIMIT; id++) { |
|
4181 if (id == vmIntrinsics::_compiledLambdaForm) { |
|
4182 // The _compiledLamdbdaForm intrinsic is a special marker for bytecode |
|
4183 // generated for the JVM from a LambdaForm and therefore no method |
|
4184 // is defined for it. |
|
4185 continue; |
|
4186 } |
|
4187 |
|
4188 if (vmIntrinsics::class_for(vmIntrinsics::ID_from(id)) == klass_id) { |
|
4189 // Check if the current class contains a method with the same |
|
4190 // name, flags, signature. |
|
4191 bool match = false; |
|
4192 for (int j = 0; j < methods->length(); j++) { |
|
4193 Method* method = methods->at(j); |
|
4194 if (id == method->intrinsic_id()) { |
|
4195 match = true; |
|
4196 break; |
|
4197 } |
|
4198 } |
|
4199 |
|
4200 if (!match) { |
|
4201 char buf[1000]; |
|
4202 tty->print("Compiler intrinsic is defined for method [%s], " |
|
4203 "but the method is not available in class [%s].%s", |
|
4204 vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID_from(id), buf, sizeof(buf)), |
|
4205 this_klass->name()->as_C_string(), |
|
4206 NOT_DEBUG("") DEBUG_ONLY(" Exiting.") |
|
4207 ); |
|
4208 tty->cr(); |
|
4209 DEBUG_ONLY(vm_exit(1)); |
|
4210 } |
|
4211 } |
|
4212 } |
4138 } |
4213 } |
4139 } |
4214 } |
4140 |
4215 |
4141 if (cached_class_file != NULL) { |
4216 if (cached_class_file != NULL) { |
4142 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes |
4217 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes |