RFR: 8080947: Add uint as a valid VM flag type

David Holmes david.holmes at oracle.com
Wed Jun 3 09:43:36 UTC 2015


Hi David,

On 3/06/2015 6:51 PM, David Lindholm wrote:
> Hi David,
>
> Thanks for looking at this. I have a few places where I convert uint and
> int to Java types, besides management.cpp also whitebox.cpp/java and
> VM.java . After discussing with several people we though it was most
> correct to go with JLONG as java type for both int and uint, since it is
> not certain that an uint will fit in a JINT and I wanted the same java
> type for both int and uint.
>
> I don't think the C spec specifies the size of int (please correct me if
> I'm wrong), so having JLONG as type for int and uint is safer than JINT.

ILP32 programming model defines 32-bit int, long and pointer.
LP64 programming model defines 64-bit long and 64-bit pointer, and so 
32-bit int.

We already assume/require that an int is equivalent of a jint

./cpu/x86/vm/jni_x86.h:  typedef int jint;

and the same for the other platforms. So int, uint, jint are all 32-bit.

However if you set a uint into a Java int you won't be able to read 
positive values >= 0x80000000, so using a jlong is necessary for that 
reason.

Sorry for the noise.

Cheers,
David H.



> But I can change to JINT if you think that is better.
>
>
> Thanks,
> David
>
> On 2015-06-03 10:01, David Holmes wrote:
>> Hi David,
>>
>> On 28/05/2015 9:28 PM, David Lindholm wrote:
>>> Hi,
>>>
>>> Please review this patch that adds uint and int as valid VM flag types.
>>> This patch adds the possibility to specify VM flags with types int and
>>> uint, it does not change the type of any flags.
>>>
>>>
>>> Webrev: http://cr.openjdk.java.net/~david/JDK-8080947/webrev.hotspot.00/
>>> Webrev: http://cr.openjdk.java.net/~david/JDK-8080947/webrev.jdk.00/
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8080947
>>
>> src/share/vm/services/management.cpp
>>
>> +   } else if (flag->is_int()) {
>> +     global->value.j = (jlong)flag->get_int();
>> +     global->type = JMM_VMGLOBAL_TYPE_JLONG;
>> +   } else if (flag->is_uint()) {
>> +     global->value.j = (jlong)flag->get_uint();
>> +     global->type = JMM_VMGLOBAL_TYPE_JLONG;
>>
>> These should be JINT types not JLONG.
>>
>> Cheers,
>> David H.
>> -------
>>
>>>
>>> Testing: Passed JPRT
>>>
>>>
>>> Thanks,
>>> David
>


More information about the hotspot-dev mailing list