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