RFR (XS) 8059904: libjvm_db.c warnings in solaris/sparc build with SS

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Thu Oct 9 08:30:24 UTC 2014


David,

Thank you for review!
I've applied the same fix to the bsd version as it exists (see the patch 
below).
However, I do not think the libjvm_db.so is currently used by the pstack 
utility on bsd or Mac OSX.
The pstack utility must be updated to get use of it.

One more observation is that the libjvm_db.c has a minor difference on bsd:

% diff  bsd/dtrace/libjvm_db.c solaris/dtrace/libjvm_db.c
29c29
< // not available on macosx #include <gelf.h>
---
 > #include <gelf.h>
493c493
<   err = find_symbol(J, "__1cNMethodG__vtbl_", &J->Method_vtbl);
---
 >   err = find_symbol(J, "__1cGMethodG__vtbl_", &J->Method_vtbl);

This difference came with the fix of 6964458.
It looks like the mangling rules are different on bsd vs on solaris.

Thanks,
Serguei

% hg diff
diff -r 795fc0cef7c9 src/os/bsd/dtrace/libjvm_db.c
--- a/src/os/bsd/dtrace/libjvm_db.c     Fri Oct 03 13:56:18 2014 -0700
+++ b/src/os/bsd/dtrace/libjvm_db.c     Thu Oct 09 00:55:34 2014 -0700
@@ -347,10 +347,10 @@
                   &J->Number_of_heaps, sizeof(J->Number_of_heaps));

    /* Allocate memory for heap configurations */
-  J->Heap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
-  J->Heap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
-  J->Heap_segmap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
-  J->Heap_segmap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_low         = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_high        = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_segmap_low  = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));

    /* Read code heap configurations */
    for (i = 0; i < J->Number_of_heaps; ++i) {
diff -r 795fc0cef7c9 src/os/solaris/dtrace/libjvm_db.c
--- a/src/os/solaris/dtrace/libjvm_db.c Fri Oct 03 13:56:18 2014 -0700
+++ b/src/os/solaris/dtrace/libjvm_db.c Thu Oct 09 00:55:34 2014 -0700
@@ -347,10 +347,10 @@
                   &J->Number_of_heaps, sizeof(J->Number_of_heaps));

    /* Allocate memory for heap configurations */
-  J->Heap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, sizeof(uint64_t));
-  J->Heap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
-  J->Heap_segmap_low = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
-  J->Heap_segmap_high = (jvm_agent_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_low         = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_high        = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_segmap_low  = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));
+  J->Heap_segmap_high = (uint64_t*)calloc(J->Number_of_heaps, 
sizeof(uint64_t));

    /* Read code heap configurations */
    for (i = 0; i < J->Number_of_heaps; ++i) {



On 10/8/14 9:18 PM, David Holmes wrote:
> On 9/10/2014 10:47 AM, serguei.spitsyn at oracle.com wrote:
>> Please, review the fix for:
>>    https://bugs.openjdk.java.net/browse/JDK-8059904
>
> Shouldn't the same fix be applied to the bsd version?
>
> Otherwise looks okay.
>
> Thanks,
> David
>
>>
>> Open webrev:
>> http://cr.openjdk.java.net/~sspitsyn/webrevs/2014/hotspot/8059904-jvmdb-warn.1/ 
>>
>>
>>
>>
>> Summary:
>>
>>    Several warnings started to appear at compilation of the libjvm_db.c
>>    after the switch from Sun C++ 5.10 to 5.12.
>>    The fix is to cast the result of calloc() to the correct type.
>>
>>
>> Testing:
>>    Running the adhoc pstack tests on Solaris sparcv9 and amd64
>>
>>
>> Thanks,
>> Serguei



More information about the serviceability-dev mailing list