28 #include "utilities/exceptions.hpp" 29 30 class BoolObjectClosure; 31 class constantPoolHandle; 32 class JavaThread; 33 class JVMCIEnv; 34 class JVMCIRuntime; 35 class Metadata; 36 class MetadataHandleBlock; 37 class OopClosure; 38 class OopStorage; 39 40 struct _jmetadata; 41 typedef struct _jmetadata *jmetadata; 42 43 class JVMCI : public AllStatic { 44 friend class JVMCIRuntime; 45 friend class JVMCIEnv; 46 47 private: 48 // Handles to objects in the HotSpot heap. 49 static OopStorage* _object_handles; 50 51 static OopStorage* object_handles(); 52 53 // Handles to Metadata objects. 54 static MetadataHandleBlock* _metadata_handles; 55 56 // Access to the HotSpotJVMCIRuntime used by the CompileBroker. 57 static JVMCIRuntime* _compiler_runtime; 58 59 // Access to the HotSpotJVMCIRuntime used by Java code running on the 60 // HotSpot heap. It will be the same as _compiler_runtime if 61 // UseJVMCINativeLibrary is false 62 static JVMCIRuntime* _java_runtime; 63 64 public: 65 enum CodeInstallResult { 66 ok, 67 dependencies_failed, 68 dependencies_invalid, 69 cache_full, 70 code_too_large 71 }; 72 73 static void do_unloading(bool unloading_occurred); 74 75 static void metadata_do(void f(Metadata*)); 76 77 static void oops_do(OopClosure* f); 78 79 static void shutdown(); 80 81 static bool shutdown_called(); 82 83 static bool is_compiler_initialized(); 84 85 /** 86 * Determines if the VM is sufficiently booted to initialize JVMCI. 87 */ 88 static bool can_initialize_JVMCI(); 89 90 static void initialize_globals(); 91 92 static void initialize_compiler(TRAPS); 93 94 static jobject make_global(const Handle& obj); 95 static void destroy_global(jobject handle); 96 static bool is_global_handle(jobject handle); 97 98 static jmetadata allocate_handle(const methodHandle& handle); 99 static jmetadata allocate_handle(const constantPoolHandle& handle); 100 101 static void release_handle(jmetadata handle); 102 103 static JVMCIRuntime* compiler_runtime() { return _compiler_runtime; } 104 static JVMCIRuntime* java_runtime() { return _java_runtime; } 105 }; 106 107 #endif // SHARE_JVMCI_JVMCI_HPP | 28 #include "utilities/exceptions.hpp" 29 30 class BoolObjectClosure; 31 class constantPoolHandle; 32 class JavaThread; 33 class JVMCIEnv; 34 class JVMCIRuntime; 35 class Metadata; 36 class MetadataHandleBlock; 37 class OopClosure; 38 class OopStorage; 39 40 struct _jmetadata; 41 typedef struct _jmetadata *jmetadata; 42 43 class JVMCI : public AllStatic { 44 friend class JVMCIRuntime; 45 friend class JVMCIEnv; 46 47 private: 48 // Access to the HotSpotJVMCIRuntime used by the CompileBroker. 49 static JVMCIRuntime* _compiler_runtime; 50 51 // True when at least one JVMCIRuntime::initialize_HotSpotJVMCIRuntime() 52 // execution has completed successfully. 53 static volatile bool _is_initialized; 54 55 // Handle created when loading the JVMCI shared library with os::dll_load. 56 // Must hold JVMCI_lock when initializing. 57 static void* _shared_library_handle; 58 59 // Argument to os::dll_load when loading JVMCI shared library 60 static char* _shared_library_path; 61 62 // Records whether JVMCI::shutdown has been called. 63 static volatile bool _in_shutdown; 64 65 // Access to the HotSpot heap based JVMCIRuntime 66 static JVMCIRuntime* _java_runtime; 67 68 public: 69 enum CodeInstallResult { 70 ok, 71 dependencies_failed, 72 dependencies_invalid, 73 cache_full, 74 code_too_large 75 }; 76 77 // Gets the handle to the loaded JVMCI shared library, loading it 78 // first if not yet loaded and `load` is true. The path from 79 // which the library is loaded is returned in `path`. If 80 // `load` is true then JVMCI_lock must be locked. 81 static void* get_shared_library(char*& path, bool load); 82 83 static void do_unloading(bool unloading_occurred); 84 85 static void metadata_do(void f(Metadata*)); 86 87 static void oops_do(OopClosure* f); 88 89 static void shutdown(); 90 91 // Returns whether JVMCI::shutdown has been called. 92 static bool in_shutdown(); 93 94 static bool is_compiler_initialized(); 95 96 /** 97 * Determines if the VM is sufficiently booted to initialize JVMCI. 98 */ 99 static bool can_initialize_JVMCI(); 100 101 static void initialize_globals(); 102 103 static void initialize_compiler(TRAPS); 104 105 static JVMCIRuntime* compiler_runtime() { return _compiler_runtime; } 106 // Gets the single runtime for JVMCI on the Java heap. This is the only 107 // JVMCI runtime available when !UseJVMCINativeLibrary. 108 static JVMCIRuntime* java_runtime() { return _java_runtime; } 109 }; 110 111 #endif // SHARE_JVMCI_JVMCI_HPP |