# HG changeset patch # User Roland Schatz # Date 1458658559 -3600 # Node ID e0a15983ab5113cb433d9b3d74f901354549e423 # Parent e876a461e6465cdc4a51329c485da9c3afcd8788 Create exception throwing routines for exceptions with complex messages. diff -r e876a461e646 -r e0a15983ab51 jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java --- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Wed Mar 23 10:42:47 2016 +0100 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Tue Mar 22 15:55:59 2016 +0100 @@ -1418,6 +1418,8 @@ @HotSpotVMValue(expression = "JVMCIRuntime::monitorenter", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorenterAddress; @HotSpotVMValue(expression = "JVMCIRuntime::monitorexit", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorexitAddress; @HotSpotVMValue(expression = "JVMCIRuntime::throw_and_post_jvmti_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwAndPostJvmtiExceptionAddress; + @HotSpotVMValue(expression = "JVMCIRuntime::throw_klass_external_name_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwKlassExternalNameExceptionAddress; + @HotSpotVMValue(expression = "JVMCIRuntime::throw_class_cast_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwClassCastExceptionAddress; @HotSpotVMValue(expression = "JVMCIRuntime::log_primitive", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrimitiveAddress; @HotSpotVMValue(expression = "JVMCIRuntime::log_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logObjectAddress; @HotSpotVMValue(expression = "JVMCIRuntime::log_printf", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrintfAddress; diff -r e876a461e646 -r e0a15983ab51 src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Wed Mar 23 10:42:47 2016 +0100 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Tue Mar 22 15:55:59 2016 +0100 @@ -415,6 +415,17 @@ SharedRuntime::throw_and_post_jvmti_exception(thread, name, message); JRT_END +JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, Symbol* exception, Klass* klass)) + ResourceMark rm(thread); + SharedRuntime::throw_and_post_jvmti_exception(thread, exception, klass->external_name()); +JRT_END + +JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, Symbol* exception, Klass* objKlass, Klass* targetKlass, const char* desc)) + ResourceMark rm(thread); + const char* message = SharedRuntime::generate_class_cast_message(objKlass->external_name(), targetKlass->external_name(), desc); + SharedRuntime::throw_and_post_jvmti_exception(thread, exception, message); +JRT_END + JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline)) ttyLocker ttyl; diff -r e876a461e646 -r e0a15983ab51 src/share/vm/jvmci/jvmciRuntime.hpp --- a/src/share/vm/jvmci/jvmciRuntime.hpp Wed Mar 23 10:42:47 2016 +0100 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Tue Mar 22 15:55:59 2016 +0100 @@ -203,7 +203,6 @@ static address exception_handler_for_pc(JavaThread* thread); static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock); static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock); - static void throw_and_post_jvmti_exception(JavaThread* thread, Symbol* name, const char* message); static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value); static oopDesc* load_and_clear_exception(JavaThread* thread); static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3); @@ -218,6 +217,12 @@ static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child); static void new_store_pre_barrier(JavaThread* thread); + // used to throw exceptions from compiled JVMCI code + static void throw_and_post_jvmti_exception(JavaThread* thread, Symbol* exception, const char* message); + // helper methods to throw exception with complex messages + static void throw_klass_external_name_exception(JavaThread* thread, Symbol* exception, Klass* klass); + static void throw_class_cast_exception(JavaThread* thread, Symbol* exception, Klass* objKlass, Klass* targetKlass, const char* desc); + // Test only function static int test_deoptimize_call_int(JavaThread* thread, int value); };