diff src/share/vm/jvmci/jvmciRuntime.hpp @ 23379:24505bf61633

allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
author Doug Simon <doug.simon@oracle.com>
date Mon, 09 May 2016 16:08:16 +0200
parents 041534002323
children 0226d6bcb0d2
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciRuntime.hpp	Mon May 09 11:31:54 2016 +0200
+++ b/src/share/vm/jvmci/jvmciRuntime.hpp	Mon May 09 16:08:16 2016 +0200
@@ -68,6 +68,16 @@
 };
 
 class JVMCIRuntime: public AllStatic {
+ public:
+  // Constants describing whether JVMCI wants to be able to adjust the compilation
+  // level selected for a method by the VM compilation policy and if so, based on
+  // what information about the method being schedule for compilation.
+  enum CompLevelAdjustment {
+     none = 0,             // no adjustment
+     by_holder = 1,        // adjust based on declaring class of method
+     by_full_signature = 2 // adjust based on declaring class, name and signature of method
+   };
+
  private:
   static jobject _HotSpotJVMCIRuntime_instance;
   static bool _HotSpotJVMCIRuntime_initialized;
@@ -75,6 +85,8 @@
   static int _trivial_prefixes_count;
   static char** _trivial_prefixes;
 
+  static CompLevelAdjustment _comp_level_adjustment;
+
   static bool _shutdown_called;
 
   /**
@@ -84,6 +96,8 @@
    */
   static Handle create_Service(const char* name, TRAPS);
 
+  static CompLevel adjust_comp_level_inner(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread);
+
  public:
   /**
    * Parses *.properties files in jre/lib/jvmci/ and adds the properties to plist.
@@ -136,6 +150,18 @@
   static bool treat_as_trivial(Method* method);
 
   /**
+   * Lets JVMCI modify the compilation level currently selected for a method by
+   * the VM compilation policy.
+   *
+   * @param method the method being scheduled for compilation
+   * @param is_osr specifies if the compilation is an OSR compilation
+   * @param level the compilation level currently selected by the VM compilation policy
+   * @param thread the current thread
+   * @return the compilation level to use for the compilation
+   */
+  static CompLevel adjust_comp_level(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread);
+
+  /**
    * Given an interface representing a JVMCI service, gets an array of objects, one per
    * known implementation of the service.
    */