Top


定義場所(file name)

hotspot/src/share/vm/utilities/exceptions.cpp

名前(function name)

void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {

本体部(body)

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

      assert(h_exception() != NULL, "exception should not be NULL");

  {- -------------------------------------------
  (1) (トレース出力)
      ---------------------------------------- -}

      // tracing (do this up front - so it works during boot strapping)
      if (TraceExceptions) {
        ttyLocker ttyl;
        ResourceMark rm;
        tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n"
                      "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
                      h_exception->print_value_string(),
                      message ? ": " : "", message ? message : "",
                      (address)h_exception(), file, line, thread);
      }

  {- -------------------------------------------
  (1) (デバッグ用の処理)
      ---------------------------------------- -}

      // for AbortVMOnException flag
      NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));

  {- -------------------------------------------
  (1) Exceptions::special_exception() を呼んで, 特殊ケースかどうかをチェックしておく.
      もし処理しなくていいケースなら, ここでリターン.
      ---------------------------------------- -}

      // Check for special boot-strapping/vm-thread handling
      if (special_exception(thread, file, line, h_exception)) return;

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

      assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");

  {- -------------------------------------------
  (1) pending_exception フィールドに例外オブジェクトをセットする.
      ---------------------------------------- -}

      // set the pending exception
      thread->set_pending_exception(h_exception(), file, line);

  {- -------------------------------------------
  (1) (トレース出力)
      ---------------------------------------- -}

      // vm log
      Events::log("throw_exception " INTPTR_FORMAT, (address)h_exception());
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.