RFR (XS): 8218192: Remove copy constructor for MemRegion

Kim Barrett kim.barrett at oracle.com
Thu Feb 7 00:10:16 UTC 2019


> On Feb 6, 2019, at 6:13 AM, Man Cao <manc at google.com> wrote:
> 
> Thank you both for the reviews and suggestions.
> I will add such comment in this patch.
> It is really helpful to know these little details.
> 
> For those other places that pass MemRegions by const-ref,
> do you think we should change them to pass-by-value if we
> validate that the compiler generates the same code as pass-by-ref?
> 
> I still think it might be better to just pass by const-ref for most
> places, as it will prevent this issue from happening even if the
> compiler failed to apply the optimization for pass-by-value.

This isn’t a compiler optimization, it’s part of the ABI-specified
calling convention, so not optional.

It’s also not the same as pass-by-ref.  The ABI says that when various
criteria are met that a struct is passed-by-value as its individual members
in registers.  Passed-by-ref passes a pointer to the struct, always.




More information about the hotspot-gc-dev mailing list