1758 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1759 if (_location != _in_method) break; // only allow for methods
1760 if (!privileged) break; // only allow in privileged code
1761 return _method_CallerSensitive;
1762 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1763 if (_location != _in_method) break; // only allow for methods
1764 if (!privileged) break; // only allow in privileged code
1765 return _method_ForceInline;
1766 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1767 if (_location != _in_method) break; // only allow for methods
1768 if (!privileged) break; // only allow in privileged code
1769 return _method_DontInline;
1770 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1771 if (_location != _in_method) break; // only allow for methods
1772 if (!privileged) break; // only allow in privileged code
1773 return _method_LambdaForm_Compiled;
1774 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1775 if (_location != _in_method) break; // only allow for methods
1776 if (!privileged) break; // only allow in privileged code
1777 return _method_LambdaForm_Hidden;
1778 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1779 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1780 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1781 return _sun_misc_Contended;
1782 default: break;
1783 }
1784 return AnnotationCollector::_unknown;
1785 }
1786
1787 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1788 if (is_contended())
1789 f->set_contended_group(contended_group());
1790 }
1791
1792 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1793 // If there's an error deallocate metadata for field annotations
1794 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1795 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1796 }
1797
1798 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1799 if (has_annotation(_method_CallerSensitive))
1800 m->set_caller_sensitive(true);
1801 if (has_annotation(_method_ForceInline))
1802 m->set_force_inline(true);
1803 if (has_annotation(_method_DontInline))
1804 m->set_dont_inline(true);
1805 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1806 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1807 if (has_annotation(_method_LambdaForm_Hidden))
1808 m->set_hidden(true);
1809 }
|
1758 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1759 if (_location != _in_method) break; // only allow for methods
1760 if (!privileged) break; // only allow in privileged code
1761 return _method_CallerSensitive;
1762 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1763 if (_location != _in_method) break; // only allow for methods
1764 if (!privileged) break; // only allow in privileged code
1765 return _method_ForceInline;
1766 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1767 if (_location != _in_method) break; // only allow for methods
1768 if (!privileged) break; // only allow in privileged code
1769 return _method_DontInline;
1770 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1771 if (_location != _in_method) break; // only allow for methods
1772 if (!privileged) break; // only allow in privileged code
1773 return _method_LambdaForm_Compiled;
1774 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1775 if (_location != _in_method) break; // only allow for methods
1776 if (!privileged) break; // only allow in privileged code
1777 return _method_LambdaForm_Hidden;
1778 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_invoke_Stable_signature):
1779 if (_location != _in_field) break; // only allow for fields
1780 if (!privileged) break; // only allow in privileged code
1781 return _field_Stable;
1782 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1783 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1784 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1785 return _sun_misc_Contended;
1786 default: break;
1787 }
1788 return AnnotationCollector::_unknown;
1789 }
1790
1791 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1792 if (is_contended())
1793 f->set_contended_group(contended_group());
1794 if (is_stable())
1795 f->set_stable(true);
1796 }
1797
1798 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1799 // If there's an error deallocate metadata for field annotations
1800 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1801 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1802 }
1803
1804 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1805 if (has_annotation(_method_CallerSensitive))
1806 m->set_caller_sensitive(true);
1807 if (has_annotation(_method_ForceInline))
1808 m->set_force_inline(true);
1809 if (has_annotation(_method_DontInline))
1810 m->set_dont_inline(true);
1811 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1812 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1813 if (has_annotation(_method_LambdaForm_Hidden))
1814 m->set_hidden(true);
1815 }
|