RFR (xs) 8145940: TempNewSymbol should have correct copy and assignment functions

Kim Barrett kim.barrett at oracle.com
Tue Jan 12 20:27:10 UTC 2016

On Jan 12, 2016, at 7:34 AM, Markus Gronlund <markus.gronlund at oracle.com> wrote:
> Hi Kim,
> Thanks a lot for the (detailed) reminder about the copy-and-swap idiom. I agree with your reasoning.
> About the return value from operator=, I would suggest retaining the void as-is as well.
> Maybe we should investigate if it is possible to have the functions in SymbolTable that increment Symbol*'s return a TempNewSymbol( or some other "smartptr" concept) instead of a direct Symbol*?
> In that case we could make the type conversion constructor private and make SymbolTable a friend of TempNewSymbol - this would avoid accidental wrapping of arbitrary Symbol*'s. I will look into the possibility of this.

I thought I suggested something like this to Coleen a while ago, but it didn’t work out for some reason?  But I might be misremembering.

In such a scheme the conversion constructor doesn’t need to be private with friend access for SymbolTable.  Instead, the conversion constructor can increment the refcount and the SymbolTable functions that return symbol references make use of that behavior.

More information about the hotspot-runtime-dev mailing list