RFR: 8247912: Make narrowOop a scoped enum [v2]

Ioi Lam iklam at openjdk.java.net
Tue Sep 22 15:47:46 UTC 2020


On Tue, 22 Sep 2020 15:38:21 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Kim Barrett has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - improve assertion
>>  - remove NarrowType
>
> Marked as reviewed by iklam (Reviewer).

> > Also, should we allow only unsigned types for T? I think using signed types here is prone to error and should be
> > flagged.
> 
> It turns out we can't restrict it to unsigned types, at least not very easily. For example,
> CDS calls this with an intptr_t value. I suppose CDS could do conversion itself before
> calling this, but that seems a little odd. And I don't know how many more there are after
> changing that one.

But shouldn't intptr_t be unsigned? I tested with this:

#include <type_traits>
#include <stdio.h>

int main() {
  printf("%d %d\n", std::is_signed<int>::value, std::is_signed<int*>::value);
}

and it prints out "1 0".

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

PR: https://git.openjdk.java.net/jdk/pull/273


More information about the shenandoah-dev mailing list