Can`t access pthread API
Jorn Vernee
jbvernee at xs4all.nl
Mon Jun 17 10:18:20 UTC 2019
It looks like a clang error. See the
Cannot write source file unix.pthread.bits.thread_shared_types_h, cause:
jdk.internal.clang.TypeLayoutError: InvalidFieldName. type: Type{
spelling=struct __pthread_cond_s, kind=Record }, fieldName: __low
Tree causing above exception is: __pthread_cond_s
And then later on during compilation that type is missing:
error: cannot find symbol
public unix.pthread.bits.thread_shared_types_h.__pthread_cond_s
__data$get();
^
symbol: class __pthread_cond_s
Definition of the struct per [1] is:
struct __pthread_cond_s
{
__extension__ union
{
__extension__ unsigned long long int __wseq;
struct
{
unsigned int __low;
unsigned int __high;
} __wseq32;
};
__extension__ union
{
__extension__ unsigned long long int __g1_start;
struct
{
unsigned int __low;
unsigned int __high;
} __g1_start32;
};
unsigned int __g_refs[2] __LOCK_ALIGNMENT;
unsigned int __g_size[2];
unsigned int __g1_orig_size;
unsigned int __wrefs;
unsigned int __g_signals[2];
};
So, I'm guessing the __low field is incorrectly being flattened into
__pthread_cond_s.
This looks suspiciously like the LLVM8 problem where the behavior of
isAnonymous was changed. And trying to jextract just this struct locally
with an LLVM7 build seems to work fine. So, at this point it's
reasonable to ask: which LLVM version is being used? Note that only
LLVM7 is currently officially supported, 8-9 are known to cause
problems. (if this is from a Shipilev nightly, those seem to be using
LLVM7, so that shouldn't be a problem).
Jorn
[1] :
https://code.woboq.org/qt5/include/bits/thread-shared-types.h.html#__pthread_cond_s
On 2019-06-17 02:05, Maurizio Cimadamore wrote:
> Thanks for the report - Sundar, can you take a look? Seems like a
> regression with the new compile-from-source strategy - the jextract
> command line is here:
>
> https://pastebin.com/5RrEwNGU
>
> Cheers
> Maurizio
>
> On 16/06/2019 17:45, Thiago Moura wrote:
>> Hi,
>>
>> I'm interested on experiment the early builds of Panama to interact
>> with
>> the IoTivity lib (https://github.com/iotivity/iotivity-lite). But
>> first,
>> I'm trying to access the pthread API to get familiar with the Foreign
>> APIs.
>>
>> Unfortunately, I`m unable to do that. More details on what I've tried
>> so
>> far is on my SO post:
>> https://stackoverflow.com/questions/56517514/how-to-access-pthread-api-with-project-panama
>>
>> Regards
More information about the panama-dev
mailing list