You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Kari Whitcomb <wh...@zk3.dec.com> on 2001/07/30 18:46:17 UTC
Unaligned Access warnings in IDOM samples
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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Kari Whitcomb" <wh...@zk3.dec.com> writes:
> After some debugging I've found the culprit behind my unaligned access
> warnings. The problem lies in the file idom/IDDocumentImpl.cpp in the
> implementation of the allocate function. The first issue is that the size
> of a pointer is hard coded to be 4 bytes. This may not be directly
> responsible for my problems but should be changed anyway. This is simple
> enough to fix with:
>
> *** IDDocumentImpl.cpp Wed Aug 1 15:19:13 2001
> --- IDDocumentImpl.cpp.new Wed Aug 1 15:49:29 2001
> ***************
> *** 884,890 ****
> fFreePtr = 0;
> fFreeBytesRemaining = 0;
> }
> ! void *retPtr = (char *)newBlock + 4;
> return retPtr;
> }
>
> --- 884,890 ----
> fFreePtr = 0;
> fFreeBytesRemaining = 0;
> }
> ! void *retPtr = (char *)newBlock + sizeof(void *);
> return retPtr;
> }
This code generates the following message under g++ 2.95.4:
IDDocumentImpl.cpp: In method `void IDDocumentImpl::deleteHeap()':
IDDocumentImpl.cpp:926: warning: `void *' is not a pointer-to-object type
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c: In method `void RefHashTableOf<void>::removeBucketElem(const void *, unsigned int &)':
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:184: instantiated from `RefHashTableOf<void>::removeKey(const void *)'
IDDocumentImpl.cpp:761: instantiated from here
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:346: warning: `void *' is not a pointer-to-object type
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c: In method `void RefHashTableOf<void>::put(void *, void *)':
IDDocumentImpl.cpp:763: instantiated from here
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:257: warning: `void *' is not a pointer-to-object type
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
As I've been looking at my diffs for IDDocumentImpl.cpp a little more, I've
realized I forgot two things. One is that I need to decrement the
fFreeBytesRemaining value if offsetting the pointer. And the other is that
this should be done before seeing if there is enough room in our current
block for the new allocation.
So the new diffs would be:
*** IDDocumentImpl.cpp Wed Aug 1 15:19:13 2001
--- IDDocumentImpl.cpp.new Wed Aug 1 17:04:58 2001
***************
*** 884,893 ****
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + 4;
return retPtr;
}
// It's a normal (sub-allocatable) request.
if (amount > fFreeBytesRemaining)
--- 884,900 ----
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + sizeof(void *);
return retPtr;
}
+ #ifdef TRU64
+ int ptrOffset = ((unsigned long)fFreePtr)%sizeof(void *);
+ if ( ptrOffset != 0 )
+ { fFreePtr = fFreePtr + sizeof(void *) - ptrOffset;
+ fFreeBytesRemaining = fFreeBytesRemaining + ptrOffset -
sizeof(void *);
+ }
+ #endif
// It's a normal (sub-allocatable) request.
if (amount > fFreeBytesRemaining)
Thanks again,
Kari
>
> ----- Original Message -----
> From: "Martin Kalen" <ma...@todaysystems.com.au>
> To: <xe...@xml.apache.org>
> Sent: Tuesday, July 31, 2001 12:26 AM
> Subject: Re: Unaligned Access warnings in IDOM samples
>
>
> > ----- Original Message -----
> > From: "Tinny Ng" <tn...@ca.ibm.com>
> > Sent: Tuesday, July 31, 2001 5:28 AM
> >
> > > Ring some bells, but before going further, may be can you first
explain
> > to me
> > > what does "-assume noaligned-objects" do? I am not familiar to TRU64
> > Unix....
> >
> > It has to do with the Alpha 64bit architecture: correct aligned data (a
> > "quadword" of 64bit) will be fetched directly from the MMU but
misaligned
> > data generates a fetch + mask + shift (eg. the CPU has to do some work
as
> > well).
> >
> > See
> > http://csa.compaq.com/Dev_Tips/unalign.htm
> > for some tips about why this happens and instructions on pinpointing
what
> > code that is generating the warnings.
> >
> > It's not neccessary any big downside of turning the warnings off with
"uac
> > p 0", but it's probably best to find out where in Xerces this is
happening
> > and see if it can easily be fixed. If it can, then other 64bit
> > architectures such as HP-PA might also run faster.
> >
> > Regards,
> > Martin.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
After some debugging I've found the culprit behind my unaligned access
warnings. The problem lies in the file idom/IDDocumentImpl.cpp in the
implementation of the allocate function. The first issue is that the size
of a pointer is hard coded to be 4 bytes. This may not be directly
responsible for my problems but should be changed anyway. This is simple
enough to fix with:
*** IDDocumentImpl.cpp Wed Aug 1 15:19:13 2001
--- IDDocumentImpl.cpp.new Wed Aug 1 15:49:29 2001
***************
*** 884,890 ****
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + 4;
return retPtr;
}
--- 884,890 ----
fFreePtr = 0;
fFreeBytesRemaining = 0;
}
! void *retPtr = (char *)newBlock + sizeof(void *);
return retPtr;
}
The second issue is more general, and while I've found a work around, there
may be a better solution. The way this function is written it assumes that
the natural alignment of a char is adequate for all other types, which may
be true on 32-bit systems but not on 64-bit. For instance both longs and
pointers require 8 byte alignment whereas char uses 4 byte alignment. The
way I have worked around it is to check to make sure that a given address is
divisible by 8 before using that as the base for a allocation. This only
seems to be necessary when using an existing block. When creating a new
char array it seems that it starts on an 8 byte aligned address. This
change successfully eliminates all the unaligned access messages when
running the idom samples provided in the distribution.
*** IDDocumentImpl.cpp Wed Aug 1 15:19:13 2001
--- IDDocumentImpl.cpp.new Wed Aug 1 16:01:45 2001
***************
*** 910,915 ****
--- 910,920 ----
fFreeBytesRemaining = kHeapAllocSize - sizeof(void *);
}
+ #ifdef TRU64
+ int ptrOffset = ((unsigned long)fFreePtr)%sizeof(void *);
+ if ( ptrOffset != 0 )
+ fFreePtr = fFreePtr + sizeof(void *) - ptrOffset;
+ #endif
void *retPtr = fFreePtr;
fFreePtr += amount;
fFreeBytesRemaining -= amount;
Does someone have a better suggestion on how to handle this problem?
Thanks,
Kari Whitcomb
----- Original Message -----
From: "Martin Kalen" <ma...@todaysystems.com.au>
To: <xe...@xml.apache.org>
Sent: Tuesday, July 31, 2001 12:26 AM
Subject: Re: Unaligned Access warnings in IDOM samples
> ----- Original Message -----
> From: "Tinny Ng" <tn...@ca.ibm.com>
> Sent: Tuesday, July 31, 2001 5:28 AM
>
> > Ring some bells, but before going further, may be can you first explain
> to me
> > what does "-assume noaligned-objects" do? I am not familiar to TRU64
> Unix....
>
> It has to do with the Alpha 64bit architecture: correct aligned data (a
> "quadword" of 64bit) will be fetched directly from the MMU but misaligned
> data generates a fetch + mask + shift (eg. the CPU has to do some work as
> well).
>
> See
> http://csa.compaq.com/Dev_Tips/unalign.htm
> for some tips about why this happens and instructions on pinpointing what
> code that is generating the warnings.
>
> It's not neccessary any big downside of turning the warnings off with "uac
> p 0", but it's probably best to find out where in Xerces this is happening
> and see if it can easily be fixed. If it can, then other 64bit
> architectures such as HP-PA might also run faster.
>
> Regards,
> Martin.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Martin Kalen <ma...@todaysystems.com.au>.
----- Original Message -----
From: "Tinny Ng" <tn...@ca.ibm.com>
Sent: Tuesday, July 31, 2001 5:28 AM
> Ring some bells, but before going further, may be can you first explain
to me
> what does "-assume noaligned-objects" do? I am not familiar to TRU64
Unix....
It has to do with the Alpha 64bit architecture: correct aligned data (a
"quadword" of 64bit) will be fetched directly from the MMU but misaligned
data generates a fetch + mask + shift (eg. the CPU has to do some work as
well).
See
http://csa.compaq.com/Dev_Tips/unalign.htm
for some tips about why this happens and instructions on pinpointing what
code that is generating the warnings.
It's not neccessary any big downside of turning the warnings off with "uac
p 0", but it's probably best to find out where in Xerces this is happening
and see if it can easily be fixed. If it can, then other 64bit
architectures such as HP-PA might also run faster.
Regards,
Martin.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
Tinny,
My understanding is that the '-assume noaligned-objects' option makes the
compiler produce more code to avoid running into these alignment faults.
Using this flag is a viable work-around but ideally it would be good if it
wasn't needed. Following is a quote from the cxx man page about the option.
Hopefully that answers your question.
-Kari
"-assume [no]aligned_objects
The aligned_objects option causes the compiler to assume that a
dereferenced object's alignment matches or exceeds the alignment
indicated by the pointer to the object. This is the default. On
Alpha systems, dereferencing a pointer to a longword- or
quadword-aligned object is more efficient than dereferencing a
pointer to a byte- or word-aligned object. Therefore, when the
compiler assumes that a pointer object of an aligned pointer
type
does point to an aligned object, it can generate better code for
pointer dereferences of aligned pointer types.
The noaligned_objects option flag causes the compiler to
generate
longer code sequences to perform indirect load and store opera-
tions in order to avoid hardware alignment faults for
arbitrarily
aligned addresses. Although this flag may generate less effi-
cient code than the aligned_objects option, by avoiding hardware
alignment faults, it speeds the execution of programs that
refer-
ence unaligned data."
----- Original Message -----
From: "Tinny Ng" <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>
Sent: Monday, July 30, 2001 3:28 PM
Subject: Re: Unaligned Access warnings in IDOM samples
> Kari,
>
> Ring some bells, but before going further, may be can you first explain to
me
> what does "-assume noaligned-objects" do? I am not familiar to TRU64
Unix....
>
> Thanks!
>
> 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: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Tinny Ng <tn...@ca.ibm.com>.
Kari,
Ring some bells, but before going further, may be can you first explain to me
what does "-assume noaligned-objects" do? I am not familiar to TRU64 Unix....
Thanks!
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: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
The change in IDStringPool.cpp did not get rid of the unaligned access
errors.
-Kari
----- Original Message -----
From: "Tinny Ng" <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>
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: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Kari Whitcomb" <wh...@zk3.dec.com> writes:
> 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
After looking more carefully at the gcc warning, I realized that it's
coming from deleteHeap() and not allocate(), so it wasn't caused by
your changes at all.
The line it complains about is the delete []:
IDDocumentImpl.cpp:927: warning: `void *' is not a pointer-to-object type
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c: In method `void RefHashTableOf<void>::removeBucketElem(const void *, unsigned int &)':
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:184: instantiated from `RefHashTableOf<void>::removeKey(const void *)'
IDDocumentImpl.cpp:761: instantiated from here
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:346: warning: `void *' is not a pointer-to-object type
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c: In method `void RefHashTableOf<void>::put(void *, void *)':
IDDocumentImpl.cpp:763: instantiated from here
/home/jasons/work/xml-xerces/c/include/util/RefHashTableOf.c:257: warning: `void *' is not a pointer-to-object type
void IDDocumentImpl::deleteHeap()
{
void *block = fCurrentBlock;
while (fCurrentBlock != 0)
{
void *nextBlock = *(void **)fCurrentBlock;
delete [] fCurrentBlock;
fCurrentBlock = nextBlock;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
The fix worked fine... no more unaligned access errors. Thank you for
getting that in to the sources. I did run into a problem compiling xerces
though. When linking the shared lib together I got an unresolved symbol
warning for 'pow'. By adding in the '-lm' option to the ALLLIBS variable
defined in src/Makefile.incl, the problem was fixed. Here are the diffs:
# diff Makefile.incl.orig Makefile.incl
376c376
< ALLLIBS =
${LIBS} -L/usr/lib -L/usr/local/lib -L/usr/ccs/lib -lc -lrt
---
> ALLLIBS =
${LIBS} -L/usr/lib -L/usr/local/lib -L/usr/ccs/lib -lc -lrt -lm
It should probably be included on line 374 also (when using ICU) but I do
not have ICU so I cannot try it. And maybe also in the TRU64/g++ section
(again I don't have a g++ compiler on my machine to try it).
Thanks!
Kari
----- Original Message -----
From: "Tinny Ng" <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, August 07, 2001 11:39 AM
Subject: Re: Unaligned Access warnings in IDOM samples
> I tried it on a number of platforms and seem to be ok. Your fix is now in
CVS.
> Please verify (the nightly build package will be available tomorrow).
>
> Thanks!
>
> Tinny
>
> Kari Whitcomb wrote:
>
> > I just wanted to bring this discussion back to the surface since it has
been
> > silent for a few days. I would really like to see this issue resolved
as
> > soon as possible. There has not been a real response to my suggestion
of
> > the following change. It eliminates the unaligned access warnings on
TRU64
> > but I do not know if it is appropriate for other platforms. Should I
file a
> > bug report, or is there someone willing to work with me to find a
solution
> > and submit the change to the code pool?
> >
> > Thanks
> > Kari
> >
> > ----- Original Message -----
> > From: "Kari Whitcomb" <wh...@zk3.dec.com>
> > To: <xe...@xml.apache.org>
> > Sent: Thursday, August 02, 2001 10:41 AM
> > Subject: Re: Unaligned Access warnings in IDOM samples
> >
> > > 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;
> > > }
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Tinny Ng <tn...@ca.ibm.com>.
I tried it on a number of platforms and seem to be ok. Your fix is now in CVS.
Please verify (the nightly build package will be available tomorrow).
Thanks!
Tinny
Kari Whitcomb wrote:
> I just wanted to bring this discussion back to the surface since it has been
> silent for a few days. I would really like to see this issue resolved as
> soon as possible. There has not been a real response to my suggestion of
> the following change. It eliminates the unaligned access warnings on TRU64
> but I do not know if it is appropriate for other platforms. Should I file a
> bug report, or is there someone willing to work with me to find a solution
> and submit the change to the code pool?
>
> Thanks
> Kari
>
> ----- Original Message -----
> From: "Kari Whitcomb" <wh...@zk3.dec.com>
> To: <xe...@xml.apache.org>
> Sent: Thursday, August 02, 2001 10:41 AM
> Subject: Re: Unaligned Access warnings in IDOM samples
>
> > 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;
> > }
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
I just wanted to bring this discussion back to the surface since it has been
silent for a few days. I would really like to see this issue resolved as
soon as possible. There has not been a real response to my suggestion of
the following change. It eliminates the unaligned access warnings on TRU64
but I do not know if it is appropriate for other platforms. Should I file a
bug report, or is there someone willing to work with me to find a solution
and submit the change to the code pool?
Thanks
Kari
----- Original Message -----
From: "Kari Whitcomb" <wh...@zk3.dec.com>
To: <xe...@xml.apache.org>
Sent: Thursday, August 02, 2001 10:41 AM
Subject: Re: Unaligned Access warnings in IDOM samples
> 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;
> }
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Kari Whitcomb <wh...@zk3.dec.com>.
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" <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>
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: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Tinny Ng <tn...@ca.ibm.com>.
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: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Unaligned Access warnings in IDOM samples
Posted by Tinny Ng <tn...@ca.ibm.com>.
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: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org