diff src/share/vm/graal/graalRuntime.hpp @ 16006:66a9286203a2

decoupled Graal runtime initialization and Graal compilation queue initialization
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Jun 2014 11:51:27 +0200
parents b35b1dc75ec0
children d56a09df1a1f
line wrap: on
line diff
--- a/src/share/vm/graal/graalRuntime.hpp	Tue Jun 03 11:01:58 2014 +0200
+++ b/src/share/vm/graal/graalRuntime.hpp	Tue Jun 03 11:51:27 2014 +0200
@@ -31,6 +31,7 @@
 class GraalRuntime: public CHeapObj<mtCompiler> {
  private:
 
+  static jobject _HotSpotGraalRuntime_instance;
   static address _external_deopt_i2c_entry;
 
   /**
@@ -77,6 +78,11 @@
   static bool set_option(KlassHandle hotSpotOptionsClass, const char* name, int name_len, Handle name_handle, const char* value, TRAPS);
 
   /**
+   * Java call to HotSpotOptions.setOption(String name, OptionValue<?> option, char spec, String stringValue, long primitiveValue)
+   */
+  static void set_option_helper(KlassHandle hotSpotOptionsClass, Handle name, Handle option, jchar spec, Handle stringValue, jlong primitiveValue);
+
+  /**
    * Instantiates a service object, calls its default constructor and returns it.
    *
    * @param name the name of a class implementing com.oracle.graal.api.runtime.Service
@@ -87,6 +93,20 @@
 
   static void initialize_natives(JNIEnv *env, jclass c2vmClass);
 
+  static bool is_HotSpotGraalRuntime_initialized() { return _HotSpotGraalRuntime_instance != NULL; }
+
+  /**
+   * Gets the singleton HotSpotGraalRuntime instance, initializing it if necessary
+   */
+  static Handle get_HotSpotGraalRuntime();
+
+  static jobject get_HotSpotGraalRuntime_jobject() {
+    get_HotSpotGraalRuntime();
+    return _HotSpotGraalRuntime_instance;
+  }
+
+  static void shutdown();
+
   /**
    * Given an interface representing a Graal service (i.e. sub-interface of
    * com.oracle.graal.api.runtime.Service), gets an array of objects, one per
@@ -97,6 +117,19 @@
    */
   static Handle get_service_impls(KlassHandle serviceKlass, TRAPS);
 
+  /**
+   * Aborts the VM due to an unexpected exception.
+   */
+  static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false);
+
+#define GUARANTEE_NO_PENDING_EXCEPTION(error_message) do { \
+    if (HAS_PENDING_EXCEPTION) { \
+      GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, error_message); \
+    } \
+  } while (0);
+
+  static Klass* load_required_class(Symbol* name);
+
   static BufferBlob* initialize_buffer_blob();
 
   static bool parse_arguments(KlassHandle hotSpotOptionsClass, TRAPS);