harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: [classlib][build][freebsd] Fix Classlib build for FreeBSD 6.3 x86
Date Thu, 04 Sep 2008 10:02:11 GMT

In message <48BFAB84.2090000@gmail.com>, Tim Ellison writes:
>
> Mark Hindess wrote:
> > After seeing your change adding the md5sum for freebsd I tried a build on
> > freebsd 7.0-RELEASE on x86_64.
> 
> Apologies if I applied Ilya's patch too hastily, I didn't know you were
> also looking at it.

No problem.  Sooner they are in svn the better ... fixing minor things later
is not a big deal.

> > I don't see the jlong/void* problems as they are both 64-bit on my machine.
> > However, it is common in classlib to fix this by doing a double cast althou
> gh
> > it is more common to use the classlib defines (IDATA) or (UDATA) than size_
> t.
> 
> I can go back and change those again.

The individual files are self-consistent and they work so it probably
isn't a priority.  Some code was using the macros jlong2addr and
addr2jlong from modules/portlib/src/main/native/include/shared/hycomp.h
and these are possibly an even better solution in the long term.

> > I also needed the following changes which I assume are freebsd6/7
> > differences.  I'm sure the second is fine but can you check to see
> > if these cause problems on your 6.3 system?
> > 
> > Index: modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
> > ===================================================================
> > --- modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c    (revision 691923)
> > +++ modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c    (working copy)
> > @@ -95,14 +95,20 @@
> >           jboolean result = 0;
> >           IDATA m_addr = (IDATA)addr;
> >           int page_size = getPageSize();
> > -         char* vec = NULL;
> > +#if defined(FREEBSD)
> > +#define HY_VEC_T char
> > +#else
> > +#define HY_VEC_T unsigned char
> > +#endif
> > +         HY_VEC_T* vec = NULL;
> 
> Am I misreading this?  It used to be char* on non-FREEBSD systems, and
> you needed to change it to be unsigned char* ?

Not exactly.  But your confusion is understandable.  I should have explained
this change.  I'm fixing two things:

   a) vec was a char* but the only place it was used as char* was in the
      cast from the void* returned by hymem_allocate_memory.  It was then
      forced to unsigned char*.  Logically it made more sense to just
      change vec to unsigned char* and fix the cast.

   b) The type of the third parameter to mincore on freebsd needs to be char*.

That should make more sense now?  (Of course, if I'd committed it I would
have explained that in the commit message.)

-Mark.

> >           int page_count = 0;
> >           int align_offset = m_addr%page_size;//addr should align with the 
> boundary of a page.
> >           m_addr -= align_offset;
> >           size   += align_offset;
> >           page_count = (size+page_size-1)/page_size;
> > -         vec = (char *) hymem_allocate_memory(page_count*sizeof(char));
> > -         if(mincore((void *)m_addr, size , (unsigned char *)vec)==0) //or 
> else there is error about the mincore and return false;
> > +         vec = (HY_VEC_T *) hymem_allocate_memory(page_count*sizeof(char))
> ;
> > +         if(mincore((void *)m_addr, size, vec)==0) //or else there is erro
> r about the mincore and return false;
> > +#undef HY_VEC_T
> >           {
> >                   int i;
> >                   for(i=0 ;i<page_count;i++)
> > Index: modules/luni/src/main/native/luni/unix/freebsd/OSResourcesMonitor.c
> > ===================================================================
> > --- modules/luni/src/main/native/luni/unix/freebsd/OSResourcesMonitor.c (re
> vision 691923)
> > +++ modules/luni/src/main/native/luni/unix/freebsd/OSResourcesMonitor.c (wo
> rking copy)
> > @@ -37,7 +37,7 @@
> >  {
> >    unsigned long free;
> >    unsigned long total;
> > -  int len = sizeof(free);
> > +  size_t len = sizeof(free);
> >    
> >    if (sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0) ==
-1
> ) {
> >      return FALSE;
> > 
> > Additionally, I needed to compile new versions of the icu dependencies for
> > freebsd7 that will conflict with the 6.3 versions.  I think we can handle
> > the conflict by using the hy.platform defines used to handle the
> > libstdc++5/libstdc++6 conflict on linux.
> > 
> > I have a few vm fixes too.  I'll try to commit these later today.
> > 
> > After building, when I try to run HelloWorld, I have significant problems
> > with pthread related code.  Using libthr.so I get a hang early in the
> > startup.  If I force the use of libkse.so with /etc/libmap.conf then I
> > get further but it hangs during shutdown.  I'll post more details of these
> > when I get some spare time to look at them again.
> > 
> > I assume you'll see similar problems.
> > 
> > Regards,
> >  Mark.
> > 
> > In message <5ce835490809030854x30fc1502i27f5c3e1df2cc584@mail.gmail.com>,
> > "Ilya Berezhniuk" writes:
> >> Hi all,
> >>
> >> I prepared a patch to fix Harmony build on my FreeBSD 6.3 machine.
> >>
> >> Could anyone of classlib gurus review and approve Classlib part of
> >> this patch [1], as I'm not familiar with Classlib coding rules?
> >>
> >> Most of the problems were caused by casting jlong to void*, because
> >> sizes of these types are different, and -Werror was specified.
> >> In the patch I used double casting like (void*)(size_t)(jlong value).
> >>
> >> [1] https://issues.apache.org/jira/browse/HARMONY-5967
> >>
> >> -- 
> >> Ilya.
> >>
> > 
> > 
> 


Mime
View raw message