< prev index next >

src/share/vm/jvmci/jvmciRuntime.hpp

Print this page


   1 /*
   2  * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  53   void warn(const char* message) {
  54     warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
  55   }
  56  public:
  57   ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {}
  58   void parse_line(char* line) {
  59     _lineNo++;
  60     do_line(line);
  61   }
  62   virtual void do_line(char* line) = 0;
  63   int lineNo() { return _lineNo; }
  64   bool is_aborted() { return _abort; }
  65   void set_filename(char* path) {_filename = path; _lineNo = 0;}
  66 };
  67 
  68 class JVMCIRuntime: public AllStatic {
  69  private:
  70   static jobject _HotSpotJVMCIRuntime_instance;
  71   static bool _HotSpotJVMCIRuntime_initialized;
  72   static bool _well_known_classes_initialized;
  73   static const char* _compiler;
  74 
  75   static int _trivial_prefixes_count;
  76   static char** _trivial_prefixes;
  77 
  78   static bool _shutdown_called;
  79 
  80   /**
  81    * Instantiates a service object, calls its default constructor and returns it.
  82    *
  83    * @param name the name of a class implementing jdk.vm.ci.service.Service
  84    */
  85   static Handle create_Service(const char* name, TRAPS);
  86 
  87  public:
  88 
  89   /**
  90    * Parses *.properties files in jre/lib/jvmci/ and adds the properties to plist.
  91    */
  92   static void init_system_properties(SystemProperty** plist);
  93 
  94   /**
  95    * Saves the value of the "jvmci.compiler" system property for processing
  96    * when JVMCI is initialized.
  97    */
  98   static void save_compiler(const char* compiler);
  99 
 100   static bool is_HotSpotJVMCIRuntime_initialized() { return _HotSpotJVMCIRuntime_initialized; }
 101 
 102   /**
 103    * Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
 104    */
 105   static Handle get_HotSpotJVMCIRuntime(TRAPS) {
 106     initialize_JVMCI(CHECK_(Handle()));
 107     return Handle(JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
 108   }
 109 
 110   static jobject get_HotSpotJVMCIRuntime_jobject(TRAPS) {
 111     initialize_JVMCI(CHECK_NULL);
 112     assert(_HotSpotJVMCIRuntime_initialized, "must be");
 113     return _HotSpotJVMCIRuntime_instance;
 114   }
 115 
 116   static Handle callStatic(const char* className, const char* methodName, const char* returnType, JavaCallArguments* args, TRAPS);
 117 
 118   /**
 119    * Trigger initialization of HotSpotJVMCIRuntime through JVMCI.getRuntime()
 120    */
 121   static void initialize_JVMCI(TRAPS);
 122 
 123   /**
 124    * Explicitly initialize HotSpotJVMCIRuntime itself
 125    */
 126   static void initialize_HotSpotJVMCIRuntime(TRAPS);
 127 
 128   static void initialize_well_known_classes(TRAPS);
 129 
 130   static void metadata_do(void f(Metadata*));
 131 
 132   static void shutdown(TRAPS);
 133 
 134   static bool shutdown_called() {
 135     return _shutdown_called;
 136   }
 137 
 138   static bool treat_as_trivial(Method* method);
 139   static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure);
 140 
 141   static BasicType kindToBasicType(Handle kind, TRAPS);
 142 
 143   // The following routines are all called from compiled JVMCI code
 144 
 145   static void new_instance(JavaThread* thread, Klass* klass);
 146   static void new_array(JavaThread* thread, Klass* klass, jint length);
 147   static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
 148   static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
 149   static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
 150   static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
 151   static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
 152   static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
 153   static address exception_handler_for_pc(JavaThread* thread);
 154   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
 155   static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
 156   static void create_null_exception(JavaThread* thread);
 157   static void create_out_of_bounds_exception(JavaThread* thread, jint index);
 158   static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
 159   static oopDesc* load_and_clear_exception(JavaThread* thread);


   1 /*
   2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  53   void warn(const char* message) {
  54     warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
  55   }
  56  public:
  57   ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {}
  58   void parse_line(char* line) {
  59     _lineNo++;
  60     do_line(line);
  61   }
  62   virtual void do_line(char* line) = 0;
  63   int lineNo() { return _lineNo; }
  64   bool is_aborted() { return _abort; }
  65   void set_filename(char* path) {_filename = path; _lineNo = 0;}
  66 };
  67 
  68 class JVMCIRuntime: public AllStatic {
  69  private:
  70   static jobject _HotSpotJVMCIRuntime_instance;
  71   static bool _HotSpotJVMCIRuntime_initialized;
  72   static bool _well_known_classes_initialized;

  73 
  74   static int _trivial_prefixes_count;
  75   static char** _trivial_prefixes;
  76 
  77   static bool _shutdown_called;
  78 
  79   /**
  80    * Instantiates a service object, calls its default constructor and returns it.
  81    *
  82    * @param name the name of a class implementing jdk.vm.ci.service.Service
  83    */
  84   static Handle create_Service(const char* name, TRAPS);
  85 
  86  public:
  87   static bool is_HotSpotJVMCIRuntime_initialized() {
  88     return _HotSpotJVMCIRuntime_initialized;
  89   }










  90 
  91   /**
  92    * Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
  93    */
  94   static Handle get_HotSpotJVMCIRuntime(TRAPS) {
  95     initialize_JVMCI(CHECK_(Handle()));
  96     return Handle(JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
  97   }
  98 
  99   static jobject get_HotSpotJVMCIRuntime_jobject(TRAPS) {
 100     initialize_JVMCI(CHECK_NULL);
 101     assert(_HotSpotJVMCIRuntime_initialized, "must be");
 102     return _HotSpotJVMCIRuntime_instance;
 103   }
 104 
 105   static Handle callStatic(const char* className, const char* methodName, const char* returnType, JavaCallArguments* args, TRAPS);
 106 
 107   /**
 108    * Trigger initialization of HotSpotJVMCIRuntime through JVMCI.getRuntime()
 109    */
 110   static void initialize_JVMCI(TRAPS);
 111 
 112   /**
 113    * Explicitly initialize HotSpotJVMCIRuntime itself
 114    */
 115   static void initialize_HotSpotJVMCIRuntime(TRAPS);
 116 
 117   static void initialize_well_known_classes(TRAPS);
 118 
 119   static void metadata_do(void f(Metadata*));
 120 
 121   static void shutdown(TRAPS);
 122 
 123   static bool shutdown_called() {
 124     return _shutdown_called;
 125   }
 126 
 127   static bool treat_as_trivial(Method* method);

 128 
 129   static BasicType kindToBasicType(Handle kind, TRAPS);
 130 
 131   // The following routines are all called from compiled JVMCI code
 132 
 133   static void new_instance(JavaThread* thread, Klass* klass);
 134   static void new_array(JavaThread* thread, Klass* klass, jint length);
 135   static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
 136   static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
 137   static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
 138   static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
 139   static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
 140   static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
 141   static address exception_handler_for_pc(JavaThread* thread);
 142   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
 143   static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
 144   static void create_null_exception(JavaThread* thread);
 145   static void create_out_of_bounds_exception(JavaThread* thread, jint index);
 146   static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
 147   static oopDesc* load_and_clear_exception(JavaThread* thread);


< prev index next >