Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp Sun Mar 24 12:43:13 2013 -0700 +++ b/src/share/vm/classfile/classFileParser.cpp Mon Mar 25 17:13:26 2013 -0700 @@ -1735,9 +1735,14 @@ Symbol* name) { vmSymbols::SID sid = vmSymbols::find_sid(name); // Privileged code can use all annotations. Other code silently drops some. - bool privileged = loader_data->is_the_null_class_loader_data() || - loader_data->is_anonymous(); + const bool privileged = loader_data->is_the_null_class_loader_data() || + loader_data->is_ext_class_loader_data() || + loader_data->is_anonymous(); switch (sid) { + case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature): + if (_location != _in_method) break; // only allow for methods + if (!privileged) break; // only allow in privileged code + return _method_CallerSensitive; case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature): if (_location != _in_method) break; // only allow for methods if (!privileged) break; // only allow in privileged code @@ -1775,6 +1780,8 @@ } void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) { + if (has_annotation(_method_CallerSensitive)) + m->set_caller_sensitive(true); if (has_annotation(_method_ForceInline)) m->set_force_inline(true); if (has_annotation(_method_DontInline))