RFR(10)(S): 8181503: Can't compile hotspot with c++11

Gerard Ziemski gerard.ziemski at oracle.com
Wed Jun 14 13:23:09 UTC 2017


hi Thomas, Kim,

> On Jun 13, 2017, at 11:36 PM, Thomas Stüfe <thomas.stuefe at gmail.com> wrote:
> 
> Hi Gerard, Kim,
> 
> On Tue, Jun 13, 2017 at 9:59 PM, Gerard Ziemski <gerard.ziemski at oracle.com> wrote:
> 
> > On Jun 12, 2017, at 5:07 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
> >
> > src/share/vm/utilities/vmError.hpp
> >  38   static uint         _id;              // Solaris/Linux signals: 0 - SIGRTMAX
> >
> > I think changing the type of _id from int to uint is really not so
> > simple. There's a bit of a type mess in this area, with some functions
> > expecting or using int and others uint. _id is set from an int value.
> > It is passed to os::exception_name, which takes an int argument. The
> > windows implementation of that function immediately casts that
> > argument to a uint, but the posix implementation actually wants an int
> > value. OTOH, there are other places that expect or treat _id as a
> > uint. So the proposed change is really just rearranging the deck
> > chairs in that mess, and is not really much of an improvement.
> > I *think* using uint consistently throughout for this value could be
> > made to work, but I haven't completely worked through it.
> 
> Thanks Kim,
> 
> I didn’t see anywhere in the code the _id being compared using arithmetic (ex: “if (_id < 0)"), so I thought we were good using uint. Thanks for taking a closer look.
> 
> Would redefining the 3 troublesome enums from:
> 
> enum VMErrorType {
>  INTERNAL_ERROR   = 0xe0000000,
>  OOM_MALLOC_ERROR = 0xe0000001,
>  OOM_MMAP_ERROR   = 0xe0000002
> };
> 
> to:
> 
> enum VMErrorType {
>  INTERNAL_ERROR   = 0xe000000,
>  OOM_MALLOC_ERROR = 0xe000001,
>  OOM_MMAP_ERROR   = 0xe000002
> };
> 
> (i.e. removing one 0 from the defined values) be a good fix? SIGRTMAX is 64 (on Linux tested using “kill -l") so anything well above that would be user defined and therefore safe?
> 
> 
> We did something similar in our (SAPs) port to prevent between VMErrorType and existing SEH exception numbers. We extended the _id type to uint64_t and moved the VMErrorType enum values up to the upper 32bit (SEH numbers are DWORD, so 32bit unsigned). We also visibly changed them to not look in the debugger like typical SEH exception numbers.
> 
> enum VMErrorType {
>   INTERNAL_ERROR   = 0xab0000000,
>   OOM_MALLOC_ERROR = 0xab0000001,
>   OOM_MMAP_ERROR   = 0xab0000002,
> }
> 
> Code has been running in our VM for many years without issues.

Thank you for reviews and Thomas’ suggestion. I’m off until the end of this week, but I will think about this next week when I’m back.


cheers




More information about the hotspot-dev mailing list