[Patches] [ python-Patches-601369 ] obmalloc,structmodule: 64bit, big endian

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Aug 2002 08:24:37 -0700


Patches item #601369, was opened at 2002-08-28 18:24
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=601369&group_id=5470

Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Christos Georgiou (tzot)
Assigned to: Nobody/Anonymous (nobody)
Summary: obmalloc,structmodule: 64bit, big endian

Initial Comment:
Issue 1: in Objects/obmalloc.c, SYSTEM_PAGE_SIZE 
is assumed to be 4K.  I corrected (#if _MIPS_ABI>=4) 
the page size at least for 64bit SGI Irix machines.

Issue 2: in Modules/structmodule.c, most of the 
un/packing functions assumed that the char *p 
argument (destination or source for un/packing) is 
correctly aligned for the concerned type.  It is no 
problem for x86 processors (2 cycle access instead of 1 
if unaligned), but it is a problem for 64bit MIPS 
processors (where an int is 64bit and it must be at least 
on a 4-byte boundary).
All the functions handling types larger than 1 byte use 
memcpy now, taking care of endianess with an 
intermediate variable y wherever needed.
The sparse comments stating "p may not be properly 
aligned" are removed, and a more thorough comment is 
inserted before the definitions of the un/packing 
functions.
The patched module passes test_struct fine in 64-bit 
and 32-bit builds on an SGI Octane with MIPS cc; so it 
does on a Pentium Linux with gcc.  I have no way to 
make a Windows build.  Pack formats prefixed with '!' 
or '>' produce the same sizes everywhere.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=601369&group_id=5470