RFR: 8309717: C2: Remove Arena::move_contents usage

Tobias Hartmann thartmann at openjdk.org
Mon Jun 12 12:01:50 UTC 2023


On Fri, 9 Jun 2023 10:17:46 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Hi,
> 
> Instead of using `Arena::move_contents` we can just see the arena swap as a form of double buffering, reducing this to a pointer swap and a clear. This allows us to remove `Arena::move_contents`, cleaning up the arena code.
> 
> Since this requires allocating another pointer for `Compile`, I took the time to move some members around in order to reduce the padding. This means that this patch does *not* introduce a size change for `Compile`.
> 
> I'm currently running tier1-3 tests.
> 
> Thanks for considering this,
> Johan

Looks reasonable to me.

src/hotspot/share/opto/compile.hpp line 812:

> 810:   void         set_unique(uint i)          { _unique = i; }
> 811:   Arena*       node_arena()                { return _node_arena; }
> 812:   Arena*       old_arena()                 { return &_node_arena_one == _node_arena ? &_node_arena_two : &_node_arena_one; }

Suggestion:

  Arena*       old_arena()                 { return (&_node_arena_one == _node_arena) ? &_node_arena_two : &_node_arena_one; }

src/hotspot/share/opto/matcher.cpp line 338:

> 336: 
> 337:   // Swap out to old-space; emptying new-space
> 338:   Arena *old = C->swap_old_and_new();

Suggestion:

  Arena* old = C->swap_old_and_new();

-------------

Marked as reviewed by thartmann (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14391#pullrequestreview-1474737149
PR Review Comment: https://git.openjdk.org/jdk/pull/14391#discussion_r1226543328
PR Review Comment: https://git.openjdk.org/jdk/pull/14391#discussion_r1226543705


More information about the hotspot-dev mailing list