Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263392

Allow current thread to be specified in ExceptionMark

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 17
    • 17
    • hotspot
    • b14

    Description

      This is the current definition of EXCEPTION_MARK
      =============================
      // Use an EXCEPTION_MARK for 'local' exceptions. EXCEPTION_MARK makes sure that no
      // pending exception exists upon entering its scope and tests that no pending exception
      // exists when leaving the scope.

      // See also preserveException.hpp for PreserveExceptionMark
      // which preserves pre-existing exceptions and does not allow new
      // exceptions.

      #define EXCEPTION_MARK Thread* THREAD = NULL; ExceptionMark __em(THREAD);
      =============================

      But the constructor of ExceptionMark calls Thread:current(), which may be costly. If we already have a thread, we should use that instead. E.g.,

      {
          ExceptionMark em(curentThread);
          // call some xxx(CHECK) functions;
          // check and clean up PENDING_EXCEPTION
      }
          

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: