changeset 17336:329eee851ee1

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Fri, 03 Oct 2014 09:56:14 -0700
parents 508e88b5f1d3 (diff) 6e590e01ecf9 (current diff)
children 8043c997764d
files
diffstat 6 files changed, 32 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Oct 03 16:22:48 2014 +0200
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Oct 03 09:56:14 2014 -0700
@@ -1210,9 +1210,13 @@
         return createTimer(format, arg1, arg2);
     }
 
-    public static Object convertFormatArg(Object arg) {
-        if (arg instanceof Class) {
-            Class<?> c = (Class<?>) arg;
+    /**
+     * There are paths where construction of formatted class names are common and the code below is
+     * surprisingly expensive, so compute it once and cache it.
+     */
+    private static final ClassValue<String> formattedClassName = new ClassValue<String>() {
+        @Override
+        protected String computeValue(Class<?> c) {
             final String simpleName = c.getSimpleName();
             Class<?> enclosingClass = c.getEnclosingClass();
             if (enclosingClass != null) {
@@ -1226,6 +1230,12 @@
                 return simpleName;
             }
         }
+    };
+
+    public static Object convertFormatArg(Object arg) {
+        if (arg instanceof Class) {
+            return formattedClassName.get((Class<?>) arg);
+        }
         return arg;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Fri Oct 03 16:22:48 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Fri Oct 03 09:56:14 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	Fri Oct 03 16:22:48 2014 +0200
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri Oct 03 09:56:14 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	Fri Oct 03 16:22:48 2014 +0200
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Oct 03 09:56:14 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>")                                   \
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Fri Oct 03 16:22:48 2014 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Fri Oct 03 09:56:14 2014 -0700
@@ -468,16 +468,16 @@
     // TODO (ds) not sure if this is correct - only used in OopMap constructor for non-product builds
     _parameter_count = 0;
   }
-  _sites_handle = JNIHandles::make_global(HotSpotCompiledCode::sites(compiled_code));
-  _exception_handlers_handle = JNIHandles::make_global(HotSpotCompiledCode::exceptionHandlers(compiled_code));
+  _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code));
+  _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code));
 
-  _code_handle = JNIHandles::make_global(CompilationResult::targetCode(comp_result));
+  _code_handle = JNIHandles::make_local(CompilationResult::targetCode(comp_result));
   _code_size = CompilationResult::targetCodeSize(comp_result);
   _total_frame_size = CompilationResult::totalFrameSize(comp_result);
   _custom_stack_area_offset = CompilationResult::customStackAreaOffset(comp_result);
 
   // Pre-calculate the constants section size.  This is required for PC-relative addressing.
-  _data_section_handle = JNIHandles::make_global(HotSpotCompiledCode::dataSection(compiled_code));
+  _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
   guarantee(DataSection::sectionAlignment(data_section()) <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
   arrayHandle data = (arrayOop) DataSection::data(data_section());
   _constants_size = data->length();
@@ -486,7 +486,7 @@
   }
 
 #ifndef PRODUCT
-  _comments_handle = JNIHandles::make_global((arrayOop) HotSpotCompiledCode::comments(compiled_code));
+  _comments_handle = JNIHandles::make_local((arrayOop) HotSpotCompiledCode::comments(compiled_code));
 #endif
 
   _next_call_type = INVOKE_INVALID;
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Fri Oct 03 16:22:48 2014 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.hpp	Fri Oct 03 09:56:14 2014 -0700
@@ -29,7 +29,7 @@
 /*
  * This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod.
  */
-class CodeInstaller {
+class CodeInstaller : public StackObj {
   friend class VMStructs;
 private:
   enum MarkId {
@@ -96,7 +96,7 @@
 
 public:
 
-  CodeInstaller() {};
+  CodeInstaller() {}
   GraalEnv::CodeInstallResult install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
 
   static address runtime_call_target_address(oop runtime_call);