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

Remove code related to gtest death tests from assert macro

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10, 11, 12, 13
    • Fix Version/s: 13
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b09

      Description

      With https://bugs.openjdk.java.net/browse/JDK-8149591, the assert macro in debug.hpp was changed to include another condition:

      @@ -119,11 +128,13 @@
       #define vmassert(p, ...) \
       do { \
         if (!(p)) { \
      + if (is_executing_unit_tests()) { \
      + report_assert_msg(__VA_ARGS__); \
      + } \
           report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
           BREAKPOINT; \
         } \
       } while (0)

      The point of this coding is to write a short one line blurb to stderr in case of an assert to help gtest death tests (tests expecting the VM to assert with a given message) to recognize the assertion. For details, please see TEST_VM_ASSERT_MSG macro in test/hotspot/gtest/unittest.hpp).

      This does increase footprint of assert macros unnecessarily and should be done instead inside report_vm_error.

      Doing it inside report_vm_error() reduces the assert macro size from 18 to 11 instructions (x64).

      It also reduces size of the fastdebug libjvm.so by ~20Mb (394->375Mb) on linux x64.



        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stuefe Thomas Stuefe
                Reporter:
                stuefe Thomas Stuefe
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: