< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page
rev 8471 : [mq]: dont_profile.8074551


1725 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data,
1726                                                                 Symbol* name) {
1727   vmSymbols::SID sid = vmSymbols::find_sid(name);
1728   // Privileged code can use all annotations.  Other code silently drops some.
1729   const bool privileged = loader_data->is_the_null_class_loader_data() ||
1730                           loader_data->is_ext_class_loader_data() ||
1731                           loader_data->is_anonymous();
1732   switch (sid) {
1733   case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1734     if (_location != _in_method)  break;  // only allow for methods
1735     if (!privileged)              break;  // only allow in privileged code
1736     return _method_CallerSensitive;
1737   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1738     if (_location != _in_method)  break;  // only allow for methods
1739     if (!privileged)              break;  // only allow in privileged code
1740     return _method_ForceInline;
1741   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1742     if (_location != _in_method)  break;  // only allow for methods
1743     if (!privileged)              break;  // only allow in privileged code
1744     return _method_DontInline;




1745   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
1746     if (_location != _in_method)  break;  // only allow for methods
1747     if (!privileged)              break;  // only allow in privileged code
1748     return _method_LambdaForm_Compiled;
1749   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
1750     if (_location != _in_method)  break;  // only allow for methods
1751     if (!privileged)              break;  // only allow in privileged code
1752     return _method_LambdaForm_Hidden;
1753   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
1754     if (_location != _in_field)   break;  // only allow for fields
1755     if (!privileged)              break;  // only allow in privileged code
1756     return _field_Stable;
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 }


1766 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1767   if (is_contended())
1768     f->set_contended_group(contended_group());
1769   if (is_stable())
1770     f->set_stable(true);
1771 }
1772 
1773 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1774   // If there's an error deallocate metadata for field annotations
1775   MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1776   MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1777 }
1778 
1779 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1780   if (has_annotation(_method_CallerSensitive))
1781     m->set_caller_sensitive(true);
1782   if (has_annotation(_method_ForceInline))
1783     m->set_force_inline(true);
1784   if (has_annotation(_method_DontInline))
1785     m->set_dont_inline(true);


1786   if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1787     m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1788   if (has_annotation(_method_LambdaForm_Hidden))
1789     m->set_hidden(true);
1790 }
1791 
1792 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1793   k->set_is_contended(is_contended());
1794 }
1795 
1796 
1797 #define MAX_ARGS_SIZE 255
1798 #define MAX_CODE_SIZE 65535
1799 #define INITIAL_MAX_LVT_NUMBER 256
1800 
1801 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
1802  *
1803  * Rules for LVT's and LVTT's are:
1804  *   - There can be any number of LVT's and LVTT's.
1805  *   - If there are n LVT's, it is the same as if there was just




1725 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data,
1726                                                                 Symbol* name) {
1727   vmSymbols::SID sid = vmSymbols::find_sid(name);
1728   // Privileged code can use all annotations.  Other code silently drops some.
1729   const bool privileged = loader_data->is_the_null_class_loader_data() ||
1730                           loader_data->is_ext_class_loader_data() ||
1731                           loader_data->is_anonymous();
1732   switch (sid) {
1733   case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature):
1734     if (_location != _in_method)  break;  // only allow for methods
1735     if (!privileged)              break;  // only allow in privileged code
1736     return _method_CallerSensitive;
1737   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
1738     if (_location != _in_method)  break;  // only allow for methods
1739     if (!privileged)              break;  // only allow in privileged code
1740     return _method_ForceInline;
1741   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
1742     if (_location != _in_method)  break;  // only allow for methods
1743     if (!privileged)              break;  // only allow in privileged code
1744     return _method_DontInline;
1745   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InjectedProfile_signature):
1746     if (_location != _in_method)  break;  // only allow for methods
1747     if (!privileged)              break;  // only allow in privileged code
1748     return _method_InjectedProfile;
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(java_lang_invoke_Stable_signature):
1758     if (_location != _in_field)   break;  // only allow for fields
1759     if (!privileged)              break;  // only allow in privileged code
1760     return _field_Stable;
1761   case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
1762     if (_location != _in_field && _location != _in_class)          break;  // only allow for fields and classes
1763     if (!EnableContended || (RestrictContended && !privileged))    break;  // honor privileges
1764     return _sun_misc_Contended;
1765   default: break;
1766   }
1767   return AnnotationCollector::_unknown;
1768 }


1770 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
1771   if (is_contended())
1772     f->set_contended_group(contended_group());
1773   if (is_stable())
1774     f->set_stable(true);
1775 }
1776 
1777 ClassFileParser::FieldAnnotationCollector::~FieldAnnotationCollector() {
1778   // If there's an error deallocate metadata for field annotations
1779   MetadataFactory::free_array<u1>(_loader_data, _field_annotations);
1780   MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations);
1781 }
1782 
1783 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
1784   if (has_annotation(_method_CallerSensitive))
1785     m->set_caller_sensitive(true);
1786   if (has_annotation(_method_ForceInline))
1787     m->set_force_inline(true);
1788   if (has_annotation(_method_DontInline))
1789     m->set_dont_inline(true);
1790   if (has_annotation(_method_InjectedProfile))
1791     m->set_has_injected_profile(true);
1792   if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
1793     m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
1794   if (has_annotation(_method_LambdaForm_Hidden))
1795     m->set_hidden(true);
1796 }
1797 
1798 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
1799   k->set_is_contended(is_contended());
1800 }
1801 
1802 
1803 #define MAX_ARGS_SIZE 255
1804 #define MAX_CODE_SIZE 65535
1805 #define INITIAL_MAX_LVT_NUMBER 256
1806 
1807 /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
1808  *
1809  * Rules for LVT's and LVTT's are:
1810  *   - There can be any number of LVT's and LVTT's.
1811  *   - If there are n LVT's, it is the same as if there was just


< prev index next >