Instead of padding the size that we want to allocate before calling the
allocate function, perhaps this should happen within
IDDocumentImpl::allocate(). Maybe something like the following? I don't
know if this will still cause the compiler errors reported yesterday with
g++ 2.95.4. Could someone try it out?
Thanks,
Kari
*** IDDocumentImpl.cpp Wed Aug 1 15:19:13 2001
--- xml/xerces-c-src1_5_1/src/idom/IDDocumentImpl.cpp Thu Aug 2 10:43:07
2001
***************
*** 858,863 ****
--- 858,867 ----
void * IDDocumentImpl::allocate(size_t amount)
{
+ size_t sizeOfPointer = sizeof(void *);
+ if (amount%sizeOfPointer!=0)
+ amount = amount + (sizeOfPointer - (amount % sizeOfPointer));
+
// If the request is for a largish block, hand it off to the system
// allocator. The block still must be linked into the list of
// allocated blocks so that it will be deleted when the time comes.
***************
*** 884,890 ****
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + 4;
return retPtr;
}
--- 888,894 ----
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + sizeOfPointer;
return retPtr;
}
----- Original Message -----
From: "Tinny Ng" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 02, 2001 8:27 AM
Subject: Re: Unaligned Access warnings in IDOM samples
> Or this should be better:
>
> Index: IDStringPool.cpp
> ===================================================================
> RCS file: /home/cvs/xml-xerces/c/src/idom/IDStringPool.cpp,v
> retrieving revision 1.9
> diff -r1.9 IDStringPool.cpp
> 126c126
> < sizeToAllocate = (sizeToAllocate % 4) + sizeToAllocate;
> ---
> > sizeToAllocate = sizeToAllocate + (8 - (sizeToAllocate % 8));
>
> *****CVS exited normally with code 1*****
>
> Tinny
>
>
> Tinny Ng wrote:
>
> > Kari,
> >
> > Can you try the following change see if that removes those messages?
Thanks!
> >
> > Index: IDStringPool.cpp
> > ===================================================================
> > RCS file: /home/cvs/xml-xerces/c/src/idom/IDStringPool.cpp,v
> > retrieving revision 1.9
> > diff -r1.9 IDStringPool.cpp
> > 126c126,127
> > < sizeToAllocate = (sizeToAllocate % 4) + sizeToAllocate;
> > ---
> > > while ((sizeToAllocate % 8) != 0)
> > > sizeToAllocate = (sizeToAllocate % 8) + sizeToAllocate;
> >
> > *****CVS exited normally with code 1*****
> >
> > Tinny
> >
> > Kari Whitcomb wrote:
> >
> > > Hello all,
> > >
> > > I am trying to use Xerces-C v1.5.1 on TRU64 Unix. It all compiles and
> > > builds without error using cxx and all the samples run correctly with
the
> > > exception of the IDOM samples. With these two samples, IDOMCount and
> > > IDOMPrint, I get hundreds of unaligned access errors. The correct
output is
> > > eventually printed but I am worried about all of the errors. If I
compile
> > > both Xerces itself and the samples using the '-assume
noaligned-objects'
> > > switch, the errors go away, but this will have performance side
effects
> > > which I would like to avoid.
> > >
> > > Before I go and try to debug in detail what is causing these errors,
is
> > > there someone more familiar with the code who might have an idea of
where to
> > > start looking or what the possible causes/solutions might be?
> > >
> > > Thanks,
> > > Kari Whitcomb
> > >
> > > PS Here are a few of the lines of errors generated when I run the
IDOMPrint
> > > sample:
> > > Unaligned access pid=31615 <IDOMPrint> va=0x140022aa4 pc=0x120004dac
> > > ra=0x120004d98 inst=0xa5ef0000
> > > Unaligned access pid=31615 <IDOMPrint> va=0x140022aa4 pc=0x120004e10
> > > ra=0x120004e10 inst=0xa56d0000
> > > Unaligned access pid=31615 <IDOMPrint> va=0x140022be4 pc=0x1200049ac
> > > ra=0x120004e10 inst=0xa4630000
> > > Unaligned access pid=31615 <IDOMPrint> va=0x140022be4 pc=0x1200049d8
> > > ra=0x1200049c8 inst=0xa4210000
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]