1769 const bool privileged = loader_data->is_the_null_class_loader_data() ||
1770 loader_data->is_ext_class_loader_data() ||
1771 loader_data->is_anonymous();
1772 switch (sid) {
1773 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1774 if (_location != _in_method) break; // only allow for methods
1775 if (!privileged) break; // only allow in privileged code
1776 return _method_CallerSensitive;
1777 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1778 if (_location != _in_method) break; // only allow for methods
1779 if (!privileged) break; // only allow in privileged code
1780 return _method_ForceInline;
1781 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1782 if (_location != _in_method) break; // only allow for methods
1783 if (!privileged) break; // only allow in privileged code
1784 return _method_DontInline;
1785 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1786 if (_location != _in_method) break; // only allow for methods
1787 if (!privileged) break; // only allow in privileged code
1788 return _method_LambdaForm_Compiled;
1789 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1790 if (_location != _in_method) break; // only allow for methods
1791 if (!privileged) break; // only allow in privileged code
1792 return _method_LambdaForm_Hidden;
1793 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
1794 if (_location != _in_field) break; // only allow for fields
1795 if (!privileged) break; // only allow in privileged code
1796 return _field_Stable;
1797 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1798 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1799 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1800 return _sun_misc_Contended;
1801 default: break;
1802 }
1803 return AnnotationCollector::_unknown;
1804 }
1805
1806 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1807 if (is_contended())
1808 f->set_contended_group(contended_group());
1810 f->set_stable(true);
1811 }
1812
1813 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1814 // If there's an error deallocate metadata for field annotations
1815 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1816 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1817 }
1818
1819 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1820 if (has_annotation(_method_CallerSensitive))
1821 m->set_caller_sensitive(true);
1822 if (has_annotation(_method_ForceInline))
1823 m->set_force_inline(true);
1824 if (has_annotation(_method_DontInline))
1825 m->set_dont_inline(true);
1826 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1827 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1828 if (has_annotation(_method_LambdaForm_Hidden))
1829 m->set_hidden(true);
1830 }
1831
1832 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1833 k->set_is_contended(is_contended());
1834 }
1835
1836
1837 #define MAX_ARGS_SIZE 255
1838 #define MAX_CODE_SIZE 65535
1839 #define INITIAL_MAX_LVT_NUMBER 256
1840
1841 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
1842 *
1843 * Rules for LVT's and LVTT's are:
1844 * - There can be any number of LVT's and LVTT's.
1845 * - If there are n LVT's, it is the same as if there was just
1846 * one LVT containing all the entries from the n LVT's.
1847 * - There may be no more than one LVT entry per local variable.
1848 * Two LVT entries are 'equal' if these fields are the same:
1849 * start_pc, length, name, slot
|
1769 const bool privileged = loader_data->is_the_null_class_loader_data() ||
1770 loader_data->is_ext_class_loader_data() ||
1771 loader_data->is_anonymous();
1772 switch (sid) {
1773 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1774 if (_location != _in_method) break; // only allow for methods
1775 if (!privileged) break; // only allow in privileged code
1776 return _method_CallerSensitive;
1777 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1778 if (_location != _in_method) break; // only allow for methods
1779 if (!privileged) break; // only allow in privileged code
1780 return _method_ForceInline;
1781 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1782 if (_location != _in_method) break; // only allow for methods
1783 if (!privileged) break; // only allow in privileged code
1784 return _method_DontInline;
1785 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1786 if (_location != _in_method) break; // only allow for methods
1787 if (!privileged) break; // only allow in privileged code
1788 return _method_LambdaForm_Compiled;
1789 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_IgnoreProfile_signature):
1790 if (_location != _in_method) break; // only allow for methods
1791 if (!privileged) break; // only allow in privileged code
1792 return _method_LambdaForm_IgnoreProfile;
1793 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1794 if (_location != _in_method) break; // only allow for methods
1795 if (!privileged) break; // only allow in privileged code
1796 return _method_LambdaForm_Hidden;
1797 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
1798 if (_location != _in_field) break; // only allow for fields
1799 if (!privileged) break; // only allow in privileged code
1800 return _field_Stable;
1801 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1802 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1803 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1804 return _sun_misc_Contended;
1805 default: break;
1806 }
1807 return AnnotationCollector::_unknown;
1808 }
1809
1810 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1811 if (is_contended())
1812 f->set_contended_group(contended_group());
1814 f->set_stable(true);
1815 }
1816
1817 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1818 // If there's an error deallocate metadata for field annotations
1819 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1820 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1821 }
1822
1823 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1824 if (has_annotation(_method_CallerSensitive))
1825 m->set_caller_sensitive(true);
1826 if (has_annotation(_method_ForceInline))
1827 m->set_force_inline(true);
1828 if (has_annotation(_method_DontInline))
1829 m->set_dont_inline(true);
1830 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1831 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1832 if (has_annotation(_method_LambdaForm_Hidden))
1833 m->set_hidden(true);
1834 if (has_annotation(_method_LambdaForm_IgnoreProfile))
1835 m->set_ignore_profile(true);
1836 }
1837
1838 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1839 k->set_is_contended(is_contended());
1840 }
1841
1842
1843 #define MAX_ARGS_SIZE 255
1844 #define MAX_CODE_SIZE 65535
1845 #define INITIAL_MAX_LVT_NUMBER 256
1846
1847 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
1848 *
1849 * Rules for LVT's and LVTT's are:
1850 * - There can be any number of LVT's and LVTT's.
1851 * - If there are n LVT's, it is the same as if there was just
1852 * one LVT containing all the entries from the n LVT's.
1853 * - There may be no more than one LVT entry per local variable.
1854 * Two LVT entries are 'equal' if these fields are the same:
1855 * start_pc, length, name, slot
|