comparison src/share/vm/c1x/c1x_VMExits.cpp @ 2284:569d3fe7d65c

non-static VMEntries and VMExits, CompilationServer simplifications
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 07 Apr 2011 15:32:25 +0200
parents 9c96c873c42b
children 762de4b26788
comparison
equal deleted inserted replaced
2282:0309d394eb5f 2284:569d3fe7d65c
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "c1x/c1x_VMExits.hpp" 26 #include "c1x/c1x_VMExits.hpp"
27 27
28 // this is a *global* handle 28 // this is a *global* handle
29 jobject VMExits::_compilerPermObject;
30 jobject VMExits::_compilerPermKlass;
29 jobject VMExits::_vmExitsPermObject; 31 jobject VMExits::_vmExitsPermObject;
30 jobject VMExits::_vmExitsPermKlass; 32 jobject VMExits::_vmExitsPermKlass;
33
34 KlassHandle VMExits::compilerKlass() {
35 if (JNIHandles::resolve(_compilerPermKlass) == NULL) {
36 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
37 if (result == NULL) {
38 fatal("Couldn't find class com.sun.hotspot.c1x.Compiler");
39 }
40 _compilerPermKlass = JNIHandles::make_global(result);
41 }
42 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_compilerPermKlass));
43 }
31 44
32 KlassHandle VMExits::vmExitsKlass() { 45 KlassHandle VMExits::vmExitsKlass() {
33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) { 46 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()); 47 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current());
35 if (result == NULL) { 48 if (result == NULL) {
36 fatal("Could not find class com.sun.hotspot.c1x.VMExits"); 49 fatal("Couldn't find class com.sun.hotspot.c1x.VMExits");
37 } 50 }
38 _vmExitsPermKlass = JNIHandles::make_global(result); 51 _vmExitsPermKlass = JNIHandles::make_global(result);
39 } 52 }
40 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass)); 53 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass));
41 } 54 }
42 55
56 Handle VMExits::compilerInstance() {
57 if (JNIHandles::resolve(_compilerPermObject) == NULL) {
58 JavaValue result(T_OBJECT);
59 JavaCalls::call_static(&result, compilerKlass(), vmSymbols::getInstance_name(), vmSymbols::getInstance_signature(), Thread::current());
60 check_pending_exception("Couldn't get Compiler");
61 _compilerPermObject = JNIHandles::make_global((oop) result.get_jobject());
62 }
63 return Handle(JNIHandles::resolve_non_null(_compilerPermObject));
64 }
65
43 Handle VMExits::instance() { 66 Handle VMExits::instance() {
44 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) { 67 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) {
45 KlassHandle compiler_klass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
46 if (compiler_klass.is_null()) {
47 fatal("Could not find class com.sun.hotspot.c1x.Compiler");
48 }
49 JavaValue result(T_OBJECT); 68 JavaValue result(T_OBJECT);
50 JavaCallArguments args; 69 JavaCalls::call_virtual(&result, compilerInstance(), compilerKlass(), vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), Thread::current());
51 JavaCalls::call_static(&result, compiler_klass(), vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current());
52 check_pending_exception("Couldn't get VMExits"); 70 check_pending_exception("Couldn't get VMExits");
53 oop res = (oop) result.get_jobject(); 71 _vmExitsPermObject = JNIHandles::make_global((oop) result.get_jobject());
54 _vmExitsPermObject = JNIHandles::make_global(res);
55 } 72 }
56 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject)); 73 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject));
57 } 74 }
58 75
59 jboolean VMExits::setOption(Handle option) { 76 jboolean VMExits::setOption(Handle option) {