comparison src/share/vm/graal/graalVMExits.cpp @ 2891:75a99b4f1c98

Rebranded C++ part from C1X to Graal.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 08 Jun 2011 14:01:51 +0200
parents c23d45daff9b
children d577d07cedec
comparison
equal deleted inserted replaced
2890:c23d45daff9b 2891:75a99b4f1c98
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 #include "precompiled.hpp" 24 #include "precompiled.hpp"
25 #include "c1x/c1x_VMExits.hpp" 25 #include "graal/graalVMExits.hpp"
26 26
27 // this is a *global* handle 27 // this is a *global* handle
28 jobject VMExits::_compilerPermObject; 28 jobject VMExits::_compilerPermObject;
29 jobject VMExits::_vmExitsPermObject; 29 jobject VMExits::_vmExitsPermObject;
30 jobject VMExits::_vmExitsPermKlass; 30 jobject VMExits::_vmExitsPermKlass;
31 31
32 KlassHandle VMExits::vmExitsKlass() { 32 KlassHandle VMExits::vmExitsKlass() {
33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) { 33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) {
34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current());
35 check_not_null(result, "Couldn't find class com.sun.hotspot.c1x.VMExits"); 35 check_not_null(result, "Couldn't find class com.sun.hotspot.graal.VMExits");
36 _vmExitsPermKlass = JNIHandles::make_global(result); 36 _vmExitsPermKlass = JNIHandles::make_global(result);
37 } 37 }
38 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass)); 38 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass));
39 } 39 }
40 40
41 Handle VMExits::compilerInstance() { 41 Handle VMExits::compilerInstance() {
42 if (JNIHandles::resolve(_compilerPermObject) == NULL) { 42 if (JNIHandles::resolve(_compilerPermObject) == NULL) {
43 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 43 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current());
44 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.c1x.CompilerImpl"); 44 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.CompilerImpl");
45 45
46 JavaValue result(T_OBJECT); 46 JavaValue result(T_OBJECT);
47 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::getInstance_name(), vmSymbols::getInstance_signature(), Thread::current()); 47 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::getInstance_name(), vmSymbols::getInstance_signature(), Thread::current());
48 check_pending_exception("Couldn't get Compiler"); 48 check_pending_exception("Couldn't get Compiler");
49 _compilerPermObject = JNIHandles::make_global((oop) result.get_jobject()); 49 _compilerPermObject = JNIHandles::make_global((oop) result.get_jobject());
51 return Handle(JNIHandles::resolve_non_null(_compilerPermObject)); 51 return Handle(JNIHandles::resolve_non_null(_compilerPermObject));
52 } 52 }
53 53
54 Handle VMExits::instance() { 54 Handle VMExits::instance() {
55 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) { 55 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) {
56 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 56 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
57 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.Compiler"); 57 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.Compiler");
58 58
59 JavaValue result(T_OBJECT); 59 JavaValue result(T_OBJECT);
60 JavaCallArguments args; 60 JavaCallArguments args;
61 args.set_receiver(compilerInstance()); 61 args.set_receiver(compilerInstance());
62 JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current()); 62 JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current());
65 } 65 }
66 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject)); 66 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject));
67 } 67 }
68 68
69 void VMExits::initializeCompiler() { 69 void VMExits::initializeCompiler() {
70 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 70 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current());
71 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.c1x.CompilerImpl"); 71 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.CompilerImpl");
72 72
73 JavaValue result(T_VOID); 73 JavaValue result(T_VOID);
74 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::initialize_name(), vmSymbols::void_method_signature(), Thread::current()); 74 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::initialize_name(), vmSymbols::void_method_signature(), Thread::current());
75 check_pending_exception("Couldn't initialize compiler"); 75 check_pending_exception("Couldn't initialize compiler");
76 } 76 }
77 77
78 jboolean VMExits::setOption(Handle option) { 78 jboolean VMExits::setOption(Handle option) {
79 assert(!option.is_null(), ""); 79 assert(!option.is_null(), "");
80 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 80 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current());
81 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.HotSpotOptions"); 81 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.HotSpotOptions");
82 82
83 Thread* THREAD = Thread::current(); 83 Thread* THREAD = Thread::current();
84 JavaValue result(T_BOOLEAN); 84 JavaValue result(T_BOOLEAN);
85 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setOption_name(), vmSymbols::setOption_signature(), option, THREAD); 85 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setOption_name(), vmSymbols::setOption_signature(), option, THREAD);
86 check_pending_exception("Error while calling setOption"); 86 check_pending_exception("Error while calling setOption");
87 return result.get_jboolean(); 87 return result.get_jboolean();
88 } 88 }
89 89
90 void VMExits::setDefaultOptions() { 90 void VMExits::setDefaultOptions() {
91 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 91 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_graal_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current());
92 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.HotSpotOptions"); 92 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.HotSpotOptions");
93 93
94 Thread* THREAD = Thread::current(); 94 Thread* THREAD = Thread::current();
95 JavaValue result(T_VOID); 95 JavaValue result(T_VOID);
96 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setDefaultOptions_name(), vmSymbols::void_method_signature(), THREAD); 96 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setDefaultOptions_name(), vmSymbols::void_method_signature(), THREAD);
97 check_pending_exception("Error while calling setDefaultOptions"); 97 check_pending_exception("Error while calling setDefaultOptions");