1718 && s_size == (index - index0) // match size
1719 && s_tag_val == *(abase + tag_off)
1720 && member == vmSymbols::value_name()) {
1721 u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
1722 coll->set_contended_group(group_index);
1723 } else {
1724 coll->set_contended_group(0); // default contended group
1725 }
1726 coll->set_contended(true);
1727 } else {
1728 coll->set_contended(false);
1729 }
1730 }
1731 }
1732
1733 ClassFileParser::AnnotationCollector::ID
1734 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data,
1735 Symbol* name) {
1736 vmSymbols::SID sid = vmSymbols::find_sid(name);
1737 // Privileged code can use all annotations. Other code silently drops some.
1738 bool privileged = loader_data->is_the_null_class_loader_data() ||
1739 loader_data->is_anonymous();
1740 switch (sid) {
1741 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1742 if (_location != _in_method) break; // only allow for methods
1743 if (!privileged) break; // only allow in privileged code
1744 return _method_ForceInline;
1745 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1746 if (_location != _in_method) break; // only allow for methods
1747 if (!privileged) break; // only allow in privileged code
1748 return _method_DontInline;
1749 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1750 if (_location != _in_method) break; // only allow for methods
1751 if (!privileged) break; // only allow in privileged code
1752 return _method_LambdaForm_Compiled;
1753 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1754 if (_location != _in_method) break; // only allow for methods
1755 if (!privileged) break; // only allow in privileged code
1756 return _method_LambdaForm_Hidden;
1757 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1758 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1759 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1760 return _sun_misc_Contended;
1761 default: break;
1762 }
1763 return AnnotationCollector::_unknown;
1764 }
1765
1766 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1767 if (is_contended())
1768 f->set_contended_group(contended_group());
1769 }
1770
1771 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1772 // If there's an error deallocate metadata for field annotations
1773 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1774 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1775 }
1776
1777 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1778 if (has_annotation(_method_ForceInline))
1779 m->set_force_inline(true);
1780 if (has_annotation(_method_DontInline))
1781 m->set_dont_inline(true);
1782 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1783 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1784 if (has_annotation(_method_LambdaForm_Hidden))
1785 m->set_hidden(true);
1786 }
1787
1788 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1789 k->set_is_contended(is_contended());
1790 }
1791
1792
1793 #define MAX_ARGS_SIZE 255
1794 #define MAX_CODE_SIZE 65535
1795 #define INITIAL_MAX_LVT_NUMBER 256
1796
1797 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
|
1718 && s_size == (index - index0) // match size
1719 && s_tag_val == *(abase + tag_off)
1720 && member == vmSymbols::value_name()) {
1721 u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
1722 coll->set_contended_group(group_index);
1723 } else {
1724 coll->set_contended_group(0); // default contended group
1725 }
1726 coll->set_contended(true);
1727 } else {
1728 coll->set_contended(false);
1729 }
1730 }
1731 }
1732
1733 ClassFileParser::AnnotationCollector::ID
1734 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data,
1735 Symbol* name) {
1736 vmSymbols::SID sid = vmSymbols::find_sid(name);
1737 // Privileged code can use all annotations. Other code silently drops some.
1738 const bool privileged = loader_data->is_the_null_class_loader_data() ||
1739 loader_data->is_ext_class_loader_data() ||
1740 loader_data->is_anonymous();
1741 switch (sid) {
1742 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1743 if (_location != _in_method) break; // only allow for methods
1744 if (!privileged) break; // only allow in privileged code
1745 return _method_CallerSensitive;
1746 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1747 if (_location != _in_method) break; // only allow for methods
1748 if (!privileged) break; // only allow in privileged code
1749 return _method_ForceInline;
1750 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1751 if (_location != _in_method) break; // only allow for methods
1752 if (!privileged) break; // only allow in privileged code
1753 return _method_DontInline;
1754 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1755 if (_location != _in_method) break; // only allow for methods
1756 if (!privileged) break; // only allow in privileged code
1757 return _method_LambdaForm_Compiled;
1758 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1759 if (_location != _in_method) break; // only allow for methods
1760 if (!privileged) break; // only allow in privileged code
1761 return _method_LambdaForm_Hidden;
1762 case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1763 if (_location != _in_field && _location != _in_class) break; // only allow for fields and classes
1764 if (!EnableContended || (RestrictContended && !privileged)) break; // honor privileges
1765 return _sun_misc_Contended;
1766 default: break;
1767 }
1768 return AnnotationCollector::_unknown;
1769 }
1770
1771 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1772 if (is_contended())
1773 f->set_contended_group(contended_group());
1774 }
1775
1776 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1777 // If there's an error deallocate metadata for field annotations
1778 MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1779 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1780 }
1781
1782 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1783 if (has_annotation(_method_CallerSensitive))
1784 m->set_caller_sensitive(true);
1785 if (has_annotation(_method_ForceInline))
1786 m->set_force_inline(true);
1787 if (has_annotation(_method_DontInline))
1788 m->set_dont_inline(true);
1789 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1790 m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1791 if (has_annotation(_method_LambdaForm_Hidden))
1792 m->set_hidden(true);
1793 }
1794
1795 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1796 k->set_is_contended(is_contended());
1797 }
1798
1799
1800 #define MAX_ARGS_SIZE 255
1801 #define MAX_CODE_SIZE 65535
1802 #define INITIAL_MAX_LVT_NUMBER 256
1803
1804 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
|