comparison src/share/vm/c1x/c1x_VMExits.cpp @ 1437:9e5e83ca2259

Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Mon, 25 Oct 2010 16:47:52 +0200
parents b61a43cd1255
children 2c754f3a2722
comparison
equal deleted inserted replaced
1436:9dae1aae168a 1437:9e5e83ca2259
23 */ 23 */
24 24
25 # include "incls/_precompiled.incl" 25 # include "incls/_precompiled.incl"
26 # include "incls/_c1x_VMExits.cpp.incl" 26 # include "incls/_c1x_VMExits.cpp.incl"
27 27
28 // these are *local* handles, and they need to be cleared before compileMethod returns
29 KlassHandle VMExits::_vmExitsKlass;
30 Handle VMExits::_vmExitsObject;
31
32 // this is a *global* handle 28 // this is a *global* handle
33 jobject VMExits::_vmExitsPermObject; 29 jobject VMExits::_vmExitsPermObject;
34 30 jobject VMExits::_vmExitsPermKlass;
35 KlassHandle &VMExits::vmExitsKlass() { 31
36 if (_vmExitsKlass.is_null()) { 32 KlassHandle VMExits::vmExitsKlass() {
37 _vmExitsKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) {
38 if (_vmExitsKlass.is_null()) { 34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current());
35 if (result == NULL) {
39 fatal("Could not find class com.sun.hotspot.c1x.VMExits"); 36 fatal("Could not find class com.sun.hotspot.c1x.VMExits");
40 } 37 }
38 _vmExitsPermKlass = JNIHandles::make_global(result);
41 } 39 }
42 return _vmExitsKlass; 40 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass));
43 } 41 }
44 42
45 Handle &VMExits::instance() { 43 Handle VMExits::instance() {
46 if (_vmExitsObject.is_null()) { 44 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) {
47 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());
48 KlassHandle compiler_klass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 46 JavaValue result(T_OBJECT);
49 JavaValue result(T_OBJECT); 47 JavaCallArguments args;
50 JavaCallArguments args; 48 JavaCalls::call_static(&result, compiler_klass(), vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current());
51 JavaCalls::call_static(&result, compiler_klass(), vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current()); 49 check_pending_exception("Couldn't get VMExits");
52 check_pending_exception("Couldn't get VMExits"); 50 oop res = (oop) result.get_jobject();
53 oop res = (oop) result.get_jobject(); 51 _vmExitsPermObject = JNIHandles::make_global(res);
54 _vmExitsPermObject = JNIHandles::make_global(res);
55 }
56 _vmExitsObject = JNIHandles::resolve(_vmExitsPermObject);
57 } 52 }
58 return _vmExitsObject; 53 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject));
54 }
55
56 jboolean VMExits::setOption(Handle option) {
57 assert(!option.is_null(), "");
58 Thread* THREAD = Thread::current();
59 JavaValue result(T_BOOLEAN);
60 JavaCallArguments args;
61 args.push_oop(instance());
62 args.push_oop(option);
63 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::setOption_name(), vmSymbols::setOption_signature(), &args, THREAD);
64 check_pending_exception("Error while calling setOption");
65 return result.get_jboolean();
59 } 66 }
60 67
61 void VMExits::compileMethod(jlong methodVmId, Handle name, int entry_bci) { 68 void VMExits::compileMethod(jlong methodVmId, Handle name, int entry_bci) {
62 assert(!name.is_null(), "just checking"); 69 assert(!name.is_null(), "just checking");
63 Thread* THREAD = Thread::current(); 70 Thread* THREAD = Thread::current();
67 args.push_long(methodVmId); 74 args.push_long(methodVmId);
68 args.push_oop(name); 75 args.push_oop(name);
69 args.push_int(entry_bci); 76 args.push_int(entry_bci);
70 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD); 77 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
71 check_pending_exception("Error while calling compileMethod"); 78 check_pending_exception("Error while calling compileMethod");
72
73 // TODO hack hack
74 _vmExitsKlass = KlassHandle();
75 _vmExitsObject = Handle();
76 } 79 }
77 80
78 oop VMExits::createRiMethodResolved(jlong vmId, Handle name, TRAPS) { 81 oop VMExits::createRiMethodResolved(jlong vmId, Handle name, TRAPS) {
79 assert(!name.is_null(), "just checking"); 82 assert(!name.is_null(), "just checking");
80 JavaValue result(T_OBJECT); 83 JavaValue result(T_OBJECT);