RFR: 8178836: Improve PtrQueue index abstraction
Thomas Schatzl
thomas.schatzl at oracle.com
Mon May 8 13:43:00 UTC 2017
Hi Kim,
thanks for keeping on improving the ptrqueue stuff, much appreciated
:)
On Mon, 2017-05-08 at 07:04 -0400, Kim Barrett wrote:
> >
> > On May 5, 2017, at 7:49 AM, Mikael Gerdin <mikael.gerdin at oracle.com
> > > wrote:
> >
> > Hi Kim,
> >
> > On 2017-05-05 07:46, Kim Barrett wrote:
> > >
> > > Still looking for a second review.
> > >
> > > >
> > > > On Apr 22, 2017, at 1:19 PM, Kim Barrett <kim.barrett at oracle.co
> > > > m> wrote:
> > > >
> > > [...]
> > Good cleanup. A step in the right direction but I'm still confused
> > by mixing of sizes and offsets in both bytes and elements.
> >
> > Just to get this straight:
> > PtrQueueSet::buffer_size used to return the byte size of buffers
> > because PtrQueueSet::_sz was set to a byte size but now the byte
> > sizes are more contained in PtrQueue?
> The idea is that nearly everything now deals with sizes and offsets
> as element indexes rather than byte offsets. The exception is that
> the internal representation of _index and the buffer size (was _sz,
> now _capacity_in_bytes) is in bytes.
>
> The reason for _index being represented as a byte offset is so the
> compiler can generate code using the _index that doesn't need to
> scale it from an element index to a byte offset. (The compiler
> obtains access to the _index via byte_offset_to_index.) Whether that
> matters is platform-dependent, but using byte offsets always seems
> preferable to making the representation depend on the platform.
>
> Even internally to PtrQueue we now mostly index() and capacity() to
> get values in elements.
Looks good in case you were still looking for somebody to look at.
Some minor issues in case you need something for the next change:
- I would prefer to keep the use of pointer_delta() at
satbMarkQueue.cpp:141. While unusual and probably the VM won't get to
this point when done, buffers can be of uintx size (see e.g.
G1SATBBufferSize). I.e. the result of this calculation (ptrdiff_t) may
overflow.
Alternatively limit G1SATBBufferSize etc. to something realistic.
Pre-existing issues:
- maybe document for PtrQueueSet::_buffer_size that it is in elements.
- ptrQueue.hpp:258: remove the "All these variables are are protected
by the TLOQ_CBL_mon. XXX ???" sentence. Apart from having two
predicates, this sentence refers to a non-existing monitor.
- ptrQueue.hpp:273: mentions non-existing TLOQ_FL_lock.
- PtrQueueSet::buf_free_list_sz may need expansion of the "sz".
Thanks,
Thomas
More information about the hotspot-gc-dev
mailing list