Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 3682:6c04a4f268e5
implement generic callback mechanism (CiGenericCallback)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 18 Nov 2011 11:52:59 +0100 |
parents | bc95d122df79 |
children | 6917cd12e8f8 |
comparison
equal
deleted
inserted
replaced
3681:753443a8c4ff | 3682:6c04a4f268e5 |
---|---|
1056 char message[jintAsStringSize]; | 1056 char message[jintAsStringSize]; |
1057 sprintf(message, "%d", index); | 1057 sprintf(message, "%d", index); |
1058 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)()); | 1058 thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)()); |
1059 JRT_END | 1059 JRT_END |
1060 | 1060 |
1061 JRT_ENTRY(void, graal_generic_callback(JavaThread* thread, oop _callback, oop _argument)) | |
1062 HandleMark hm; | |
1063 Handle callback(_callback); | |
1064 Handle argument(_argument); | |
1065 | |
1066 KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_cri_ci_CiGenericCallback(), SystemDictionary::java_system_loader(), NULL, thread); | |
1067 if (klass.is_null()) { | |
1068 tty->print_cr("couldn't resolve com_sun_cri_ci_CiGenericCallback"); | |
1069 } | |
1070 | |
1071 JavaValue result(T_OBJECT); | |
1072 JavaCallArguments args; | |
1073 args.push_oop(Handle(callback)); | |
1074 args.push_oop(Handle(argument)); | |
1075 JavaCalls::call_interface(&result, klass, vmSymbols::callback_name(), vmSymbols::callback_signature(), &args, thread); | |
1076 | |
1077 if (thread->has_pending_exception()) { | |
1078 Handle exception = PENDING_EXCEPTION; | |
1079 CLEAR_PENDING_EXCEPTION; | |
1080 | |
1081 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); | |
1082 JavaValue result(T_VOID); | |
1083 JavaCalls::call_virtual(&result, | |
1084 exception, | |
1085 KlassHandle(THREAD, | |
1086 SystemDictionary::Throwable_klass()), | |
1087 vmSymbols::printStackTrace_name(), | |
1088 vmSymbols::void_method_signature(), | |
1089 THREAD); | |
1090 } | |
1091 thread->set_vm_result((oop) result.get_jobject()); | |
1092 JRT_END | |
1093 | |
1061 | 1094 |
1062 | 1095 |
1063 | 1096 |
1064 OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { | 1097 OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { |
1065 | 1098 |
1947 __ leave(); | 1980 __ leave(); |
1948 __ ret(0); | 1981 __ ret(0); |
1949 break; | 1982 break; |
1950 } | 1983 } |
1951 | 1984 |
1985 case graal_generic_callback_id: { | |
1986 __ enter(); | |
1987 oop_maps = new OopMapSet(); | |
1988 OopMap* oop_map = save_live_registers(sasm, 0); | |
1989 int call_offset = __ call_RT(rax, noreg, (address)graal_generic_callback, j_rarg0, j_rarg1); | |
1990 oop_maps->add_gc_map(call_offset, oop_map); | |
1991 __ leave(); | |
1992 __ ret(0); | |
1993 break; | |
1994 } | |
1995 | |
1952 case graal_handle_exception_id: { | 1996 case graal_handle_exception_id: { |
1953 StubFrame f(sasm, "graal_handle_exception", dont_gc_arguments); | 1997 StubFrame f(sasm, "graal_handle_exception", dont_gc_arguments); |
1954 oop_maps = new OopMapSet(); | 1998 oop_maps = new OopMapSet(); |
1955 OopMap* oop_map = save_live_registers(sasm, 1, false); | 1999 OopMap* oop_map = save_live_registers(sasm, 1, false); |
1956 graal_generate_handle_exception(sasm, oop_maps, oop_map); | 2000 graal_generate_handle_exception(sasm, oop_maps, oop_map); |