diff src/share/vm/oops/instanceKlass.cpp @ 15926:af0e42dad358

reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
author Doug Simon <doug.simon@oracle.com>
date Tue, 27 May 2014 15:43:36 +0200
parents bd4c7b669bd8
children 66a9286203a2
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Tue May 27 13:16:12 2014 +0200
+++ b/src/share/vm/oops/instanceKlass.cpp	Tue May 27 15:43:36 2014 +0200
@@ -59,6 +59,10 @@
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
+#ifdef GRAAL
+#include "classfile/javaAssertions.hpp"
+#include "graal/graalVMToCompiler.hpp"
+#endif
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
@@ -1205,6 +1209,15 @@
 #ifdef GRAAL
   if (this_oop->is_subtype_of(SystemDictionary::Node_klass())) {
     if (this_oop() != SystemDictionary::Node_klass()) {
+      if (!VMToCompiler::is_HotSpotGraalRuntime_initialized() && JavaAssertions::systemClassDefault() == false) {
+        // We want to ensure that the process of initializing HotSpotGraalRuntime
+        // is fast since it executes at VM startup. We must avoid triggering
+        // class initialization of any Node classes during this process.
+        ResourceMark rm;
+        char buf[200];
+        jio_snprintf(buf, sizeof(buf), "Node subclass %s must not be initialized before HotSpotGraalRuntime is initialized", this_oop->name()->as_C_string());
+        THROW_MSG(vmSymbols::java_lang_InternalError(), buf);
+      }
       // Create the NodeClass for a Node subclass.
       TempNewSymbol sig = SymbolTable::new_symbol("(Ljava/lang/Class;)Lcom/oracle/graal/graph/NodeClass;", CHECK);
       JavaValue result(T_OBJECT);