RFR: 8259668: Make SubTasksDone use-once [v2]

Kim Barrett kim.barrett at oracle.com
Sun Feb 7 05:30:23 UTC 2021


> On Feb 5, 2021, at 6:10 AM, Albert Mingkun Yang <ayang at openjdk.java.net> wrote:
> 
> On Fri, 5 Feb 2021 09:34:58 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> 
>> An additional (as an extra CR, preexisting) cleanup could be moving more method definitions into the cpp file as they do not seem to be performance critical; but as mentioned, this is fine too.
> 
> I think it's best to not to hide the definitions from the caller. The current approach ensures an optimized build will have zero cost from having the assertion; otherwise, the call site needs a `callq` instruction (without LTO), probably insignificant, but a few extra lines in the header is fine, IMO.

Thomas’s suggestion was to change the class to have

  DEBUG_ONLY(volatile bool _verification_done = false;)
  void all_tasks_completed_impl(uint skipped[], size_t skipped_size) NOT_DEBUG_RETURN;

and eliminate the DEBUG_ONLY wrappers currently cluttering the calls to all_tasks_completed_impl.

A call in a not-debug build will have a trivial empty-bodied function that will be inlined to nothing.
With that change, I would expect any decent compiler to generate no code for a call to
all_tasks_completed in a product build.  We use this pattern a lot, with exactly that expectation.

I also think this change should be made.



More information about the hotspot-dev mailing list