< prev index next >

src/hotspot/share/interpreter/interpreterRuntime.cpp

Print this page
rev 49948 : 8201593: Print array length in ArrayIndexOutOfBoundsException.
Reviewed-by: dholmes, mdoerr, smonteith


  41 #include "oops/constantPool.hpp"
  42 #include "oops/cpCache.inline.hpp"
  43 #include "oops/instanceKlass.hpp"
  44 #include "oops/methodData.hpp"
  45 #include "oops/objArrayKlass.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/nativeLookup.hpp"
  51 #include "runtime/atomic.hpp"
  52 #include "runtime/biasedLocking.hpp"
  53 #include "runtime/compilationPolicy.hpp"
  54 #include "runtime/deoptimization.hpp"
  55 #include "runtime/fieldDescriptor.hpp"
  56 #include "runtime/frame.inline.hpp"
  57 #include "runtime/handles.inline.hpp"
  58 #include "runtime/icache.hpp"
  59 #include "runtime/interfaceSupport.inline.hpp"
  60 #include "runtime/java.hpp"

  61 #include "runtime/jfieldIDWorkaround.hpp"
  62 #include "runtime/osThread.hpp"
  63 #include "runtime/sharedRuntime.hpp"
  64 #include "runtime/stubRoutines.hpp"
  65 #include "runtime/synchronizer.hpp"
  66 #include "runtime/threadCritical.hpp"
  67 #include "utilities/align.hpp"
  68 #include "utilities/copy.hpp"
  69 #include "utilities/events.hpp"
  70 #ifdef COMPILER2
  71 #include "opto/runtime.hpp"
  72 #endif
  73 
  74 class UnlockFlagSaver {
  75   private:
  76     JavaThread* _thread;
  77     bool _do_not_unlock;
  78   public:
  79     UnlockFlagSaver(JavaThread* t) {
  80       _thread = t;


 429   }
 430   // create exception
 431   Handle exception = Exceptions::new_exception(thread, s, message);
 432   thread->set_vm_result(exception());
 433 IRT_END
 434 
 435 
 436 IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
 437   ResourceMark rm(thread);
 438   const char* klass_name = obj->klass()->external_name();
 439   // lookup exception klass
 440   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
 441   if (ProfileTraps) {
 442     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
 443   }
 444   // create exception, with klass name as detail message
 445   Handle exception = Exceptions::new_exception(thread, s, klass_name);
 446   thread->set_vm_result(exception());
 447 IRT_END
 448 
 449 
 450 IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, char* name, jint index))
 451   char message[jintAsStringSize];
 452   // lookup exception klass
 453   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
 454   if (ProfileTraps) {
 455     note_trap(thread, Deoptimization::Reason_range_check, CHECK);
 456   }
 457   // create exception
 458   sprintf(message, "%d", index);
 459   THROW_MSG(s, message);



 460 IRT_END
 461 
 462 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
 463   JavaThread* thread, oopDesc* obj))
 464 
 465   ResourceMark rm(thread);
 466   char* message = SharedRuntime::generate_class_cast_message(
 467     thread, obj->klass());
 468 
 469   if (ProfileTraps) {
 470     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
 471   }
 472 
 473   // create exception
 474   THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
 475 IRT_END
 476 
 477 // exception_handler_for_exception(...) returns the continuation address,
 478 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
 479 // The exception oop is returned to make sure it is preserved over GC (it




  41 #include "oops/constantPool.hpp"
  42 #include "oops/cpCache.inline.hpp"
  43 #include "oops/instanceKlass.hpp"
  44 #include "oops/methodData.hpp"
  45 #include "oops/objArrayKlass.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/nativeLookup.hpp"
  51 #include "runtime/atomic.hpp"
  52 #include "runtime/biasedLocking.hpp"
  53 #include "runtime/compilationPolicy.hpp"
  54 #include "runtime/deoptimization.hpp"
  55 #include "runtime/fieldDescriptor.hpp"
  56 #include "runtime/frame.inline.hpp"
  57 #include "runtime/handles.inline.hpp"
  58 #include "runtime/icache.hpp"
  59 #include "runtime/interfaceSupport.inline.hpp"
  60 #include "runtime/java.hpp"
  61 #include "runtime/javaCalls.hpp"
  62 #include "runtime/jfieldIDWorkaround.hpp"
  63 #include "runtime/osThread.hpp"
  64 #include "runtime/sharedRuntime.hpp"
  65 #include "runtime/stubRoutines.hpp"
  66 #include "runtime/synchronizer.hpp"
  67 #include "runtime/threadCritical.hpp"
  68 #include "utilities/align.hpp"
  69 #include "utilities/copy.hpp"
  70 #include "utilities/events.hpp"
  71 #ifdef COMPILER2
  72 #include "opto/runtime.hpp"
  73 #endif
  74 
  75 class UnlockFlagSaver {
  76   private:
  77     JavaThread* _thread;
  78     bool _do_not_unlock;
  79   public:
  80     UnlockFlagSaver(JavaThread* t) {
  81       _thread = t;


 430   }
 431   // create exception
 432   Handle exception = Exceptions::new_exception(thread, s, message);
 433   thread->set_vm_result(exception());
 434 IRT_END
 435 
 436 
 437 IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
 438   ResourceMark rm(thread);
 439   const char* klass_name = obj->klass()->external_name();
 440   // lookup exception klass
 441   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
 442   if (ProfileTraps) {
 443     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
 444   }
 445   // create exception, with klass name as detail message
 446   Handle exception = Exceptions::new_exception(thread, s, klass_name);
 447   thread->set_vm_result(exception());
 448 IRT_END
 449 
 450 IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, arrayOopDesc* a, jint index))




 451   if (ProfileTraps) {
 452     note_trap(thread, Deoptimization::Reason_range_check, CHECK);
 453   }
 454 
 455   ResourceMark rm(thread);
 456   stringStream ss;
 457   ss.print("Index %d out-of-bounds for length %d.", index, a->length());
 458 
 459   THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
 460 IRT_END
 461 
 462 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
 463   JavaThread* thread, oopDesc* obj))
 464 
 465   ResourceMark rm(thread);
 466   char* message = SharedRuntime::generate_class_cast_message(
 467     thread, obj->klass());
 468 
 469   if (ProfileTraps) {
 470     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
 471   }
 472 
 473   // create exception
 474   THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
 475 IRT_END
 476 
 477 // exception_handler_for_exception(...) returns the continuation address,
 478 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
 479 // The exception oop is returned to make sure it is preserved over GC (it


< prev index next >