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

Allow current thread to be specified in ExceptionMark

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      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

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

                Dates

                Created:
                Updated:
                Resolved: