Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classFileParser.cpp @ 8866:16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
Reviewed-by: kvn, jrose
author | twisti |
---|---|
date | Mon, 25 Mar 2013 17:13:26 -0700 |
parents | c8b31b461e1a |
children | cd9ad42dfde0 |
comparison
equal
deleted
inserted
replaced
8865:818a1ac7da7a | 8866:16885e702c88 |
---|---|
1733 ClassFileParser::AnnotationCollector::ID | 1733 ClassFileParser::AnnotationCollector::ID |
1734 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data, | 1734 ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data, |
1735 Symbol* name) { | 1735 Symbol* name) { |
1736 vmSymbols::SID sid = vmSymbols::find_sid(name); | 1736 vmSymbols::SID sid = vmSymbols::find_sid(name); |
1737 // Privileged code can use all annotations. Other code silently drops some. | 1737 // Privileged code can use all annotations. Other code silently drops some. |
1738 bool privileged = loader_data->is_the_null_class_loader_data() || | 1738 const bool privileged = loader_data->is_the_null_class_loader_data() || |
1739 loader_data->is_anonymous(); | 1739 loader_data->is_ext_class_loader_data() || |
1740 loader_data->is_anonymous(); | |
1740 switch (sid) { | 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; | |
1741 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature): | 1746 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature): |
1742 if (_location != _in_method) break; // only allow for methods | 1747 if (_location != _in_method) break; // only allow for methods |
1743 if (!privileged) break; // only allow in privileged code | 1748 if (!privileged) break; // only allow in privileged code |
1744 return _method_ForceInline; | 1749 return _method_ForceInline; |
1745 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature): | 1750 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature): |
1773 MetadataFactory::free_array<u1>(_loader_data, _field_annotations); | 1778 MetadataFactory::free_array<u1>(_loader_data, _field_annotations); |
1774 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations); | 1779 MetadataFactory::free_array<u1>(_loader_data, _field_type_annotations); |
1775 } | 1780 } |
1776 | 1781 |
1777 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) { | 1782 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) { |
1783 if (has_annotation(_method_CallerSensitive)) | |
1784 m->set_caller_sensitive(true); | |
1778 if (has_annotation(_method_ForceInline)) | 1785 if (has_annotation(_method_ForceInline)) |
1779 m->set_force_inline(true); | 1786 m->set_force_inline(true); |
1780 if (has_annotation(_method_DontInline)) | 1787 if (has_annotation(_method_DontInline)) |
1781 m->set_dont_inline(true); | 1788 m->set_dont_inline(true); |
1782 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none) | 1789 if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none) |