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

noreply@sourceforge.net noreply@sourceforge.net
Tue, 03 Sep 2002 11:43:16 -0700


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

Category: Modules
>Group: Python 2.2.x
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Christos Georgiou (tzot)
>Assigned to: Guido van Rossum (gvanrossum)
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.

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-03 14:43

Message:
Logged In: YES 
user_id=6380

Tim sez, the obmalloc.c patch should not go in unless
supported by measurements.

I do like the structmodule.c patch, and have check it in.
Thanks!

PS the structmodule patch might apply to Python 2.2.x too.
Somebody should backport it.

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

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