review request for 6781583
Martin Buchholz
martinrb at google.com
Fri Dec 5 12:26:42 PST 2008
I think the JDK should provide, along with every "java native" type like jlong,
a format macro that can be used along with that type in format strings.
This should be done in the same header file that provides the type.
This would allow not only code in the JDK, but also user native code,
to be able to use format strings portably.
E.g. here's jni_md.h
#ifdef _LP64 /* 64-bit Solaris */
typedef long jlong;
#else
typedef long long jlong;
#endif
we could do something like
#ifdef _LP64 /* 64-bit Solaris */
typedef long jlong;
#define JNI_PRIjlong "ld"
#else
typedef long long jlong;
#define JNI_PRIjlong "lld"
#endif
This would be more work, because it would be a change to the
Java Platform (JNI spec), but it's the right thing to do.
Martin
On Fri, Dec 5, 2008 at 11:28, Xiaobin Lu <Xiaobin.Lu at sun.com> wrote:
> Webrev: http://webrev.invokedynamic.info/xiaobin.lu/6781583/webrev/
>
> Details:
>
> Due to more restrictions on implicit type conversion put to the latest GCC
> compiler such as GCC 4.3.2, the hotspot build fails on 64 bit platforms.
> I've fixed part of the problem on 32 bit platform with 6718830 & 6681796,
> however, I just noticed that we need to do more on 64 bit platforms as well.
>
> One of the thing you might notice with the fix is that I explicitly use
> "%lld" to print jlong instead of using PTR_FORMAT. The reason of doing this
> is that jlong is defined as "long long int", and PTR_FORMAT is actually used
> to print "long int" on 64 bit platforms. GCC 4.3.2 doesn't even allow
> conversions between "long long" and "long" even though they have the same
> size on most of today's 64 bit platforms. Other part of the fix is pretty
> straightforward.
>
> Reviewed by:
>
> Verified by:
> JPRT
> Built on 32 bit GCC 4.3.2 and it succeeded
>
> Thanks,
> -Xiaobin
>
>
>
More information about the hotspot-dev
mailing list