Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalRuntime.cpp @ 16273:d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 27 Jun 2014 22:21:40 +0200 |
parents | d56a09df1a1f |
children | 60c3f610183e |
comparison
equal
deleted
inserted
replaced
16272:56cd93afdc15 | 16273:d6ffc6164830 |
---|---|
715 | 715 |
716 parse_arguments(hotSpotOptionsClass, THREAD); | 716 parse_arguments(hotSpotOptionsClass, THREAD); |
717 assert(HAS_PENDING_EXCEPTION, "must be"); | 717 assert(HAS_PENDING_EXCEPTION, "must be"); |
718 | 718 |
719 ResourceMark rm; | 719 ResourceMark rm; |
720 oop message = java_lang_Throwable::message(PENDING_EXCEPTION); | 720 Handle exception = PENDING_EXCEPTION; |
721 assert(message != NULL, "Graal argument parsing exception is expected to hava message"); | |
722 tty->print_cr("Error parsing Graal options: %s", java_lang_String::as_utf8_string(message)); | |
723 CLEAR_PENDING_EXCEPTION; | 721 CLEAR_PENDING_EXCEPTION; |
722 oop message = java_lang_Throwable::message(exception); | |
723 if (message != NULL) { | |
724 tty->print_cr("Error parsing Graal options: %s", java_lang_String::as_utf8_string(message)); | |
725 } else { | |
726 call_printStackTrace(exception, THREAD); | |
727 } | |
724 return JNI_ERR; | 728 return JNI_ERR; |
725 } | 729 } |
726 return JNI_OK; | 730 return JNI_OK; |
727 } | 731 } |
728 | 732 |
742 } | 746 } |
743 | 747 |
744 void GraalRuntime::check_required_value(const char* name, int name_len, const char* value, TRAPS) { | 748 void GraalRuntime::check_required_value(const char* name, int name_len, const char* value, TRAPS) { |
745 if (value == NULL) { | 749 if (value == NULL) { |
746 char buf[200]; | 750 char buf[200]; |
747 jio_snprintf(buf, sizeof(buf), "Value for option %.*s must use '-G:%.*s=<value>' format", name_len, name, name_len, name); | 751 jio_snprintf(buf, sizeof(buf), "Must use '-G:%.*s=<value>' format for %.*s option", name_len, name, name_len, name); |
748 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); | 752 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); |
749 } | 753 } |
750 } | 754 } |
751 | 755 |
752 void GraalRuntime::parse_argument(KlassHandle hotSpotOptionsClass, char* arg, TRAPS) { | 756 void GraalRuntime::parse_argument(KlassHandle hotSpotOptionsClass, char* arg, TRAPS) { |
949 JNIHandles::destroy_global(_HotSpotGraalRuntime_instance); | 953 JNIHandles::destroy_global(_HotSpotGraalRuntime_instance); |
950 _HotSpotGraalRuntime_instance = NULL; | 954 _HotSpotGraalRuntime_instance = NULL; |
951 } | 955 } |
952 } | 956 } |
953 | 957 |
958 void GraalRuntime::call_printStackTrace(Handle exception, Thread* thread) { | |
959 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); | |
960 JavaValue result(T_VOID); | |
961 JavaCalls::call_virtual(&result, | |
962 exception, | |
963 KlassHandle(thread, | |
964 SystemDictionary::Throwable_klass()), | |
965 vmSymbols::printStackTrace_name(), | |
966 vmSymbols::void_method_signature(), | |
967 thread); | |
968 } | |
969 | |
954 void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { | 970 void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { |
955 Thread* THREAD = Thread::current(); | 971 Thread* THREAD = Thread::current(); |
956 CLEAR_PENDING_EXCEPTION; | 972 CLEAR_PENDING_EXCEPTION; |
957 | |
958 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); | |
959 JavaValue result(T_VOID); | |
960 tty->print_cr(message); | 973 tty->print_cr(message); |
961 JavaCalls::call_virtual(&result, | 974 call_printStackTrace(exception, THREAD); |
962 exception, | |
963 KlassHandle(THREAD, | |
964 SystemDictionary::Throwable_klass()), | |
965 vmSymbols::printStackTrace_name(), | |
966 vmSymbols::void_method_signature(), | |
967 THREAD); | |
968 | |
969 vm_abort(dump_core); | 975 vm_abort(dump_core); |
970 } | 976 } |
971 | 977 |
972 Klass* GraalRuntime::load_required_class(Symbol* name) { | 978 Klass* GraalRuntime::load_required_class(Symbol* name) { |
973 Klass* klass = SystemDictionary::resolve_or_null(name, SystemDictionary::java_system_loader(), Handle(), Thread::current()); | 979 Klass* klass = SystemDictionary::resolve_or_null(name, SystemDictionary::java_system_loader(), Handle(), Thread::current()); |