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

Remove code related to gtest death tests from assert macro

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 9, 10, 11, 12, 13
    • hotspot
    • b09

      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.



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

              Created:
              Updated:
              Resolved: