changeset 17334:0563b652c052

Unify parsing of graal and hotspot Stable annotations
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 02 Oct 2014 10:57:03 -0700
parents fa821ca2611a
children 508e88b5f1d3
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/vmSymbols.hpp
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Thu Oct 02 10:54:54 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Thu Oct 02 10:57:03 2014 -0700
@@ -338,8 +338,11 @@
      * @return true if field has {@link Stable} annotation, false otherwise
      */
     public boolean isStable() {
-        Annotation annotation = getAnnotation(Stable.class);
-        return annotation != null;
+        if ((runtime().getConfig().jvmAccFieldStable & modifiers) != 0) {
+            return true;
+        }
+        assert getAnnotation(Stable.class) == null;
+        return false;
     }
 
     @Override
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Oct 02 10:54:54 2014 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Thu Oct 02 10:57:03 2014 -0700
@@ -1787,6 +1787,12 @@
     if (_location != _in_method)  break;  // only allow for methods
     if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Hidden;
+#ifdef GRAAL
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(com_oracle_graal_hotspot_Stable_signature):
+    if (_location != _in_field)   break;  // only allow for fields
+    // Ignore privilged for now
+    return _field_Stable;
+#endif
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
     if (_location != _in_field)   break;  // only allow for fields
     if (!privileged)              break;  // only allow in privileged code
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Oct 02 10:54:54 2014 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Oct 02 10:57:03 2014 -0700
@@ -356,6 +356,7 @@
   GRAAL_ONLY(template(compileMetaspaceMethod_name,               "compileMetaspaceMethod"))                                                       \
   GRAAL_ONLY(template(compileMetaspaceMethod_signature,          "(JIJI)V"))                                                                      \
   GRAAL_ONLY(template(graal_mirror_name,                         "graal_mirror"))                                                                 \
+  GRAAL_ONLY(template(com_oracle_graal_hotspot_Stable_signature, "Lcom/oracle/graal/hotspot/Stable;"))                                            \
                                                                                                   \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \