[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-24 Thread STINNER Victor

STINNER Victor added the comment:

2014-03-24 0:30 GMT+01:00 Antoine Pitrou rep...@bugs.python.org:
 What is the size of the PyASCIIObject on x86/x64 with and without the
 patch?

 Haven't tried on x86, but on x86-64 it's the same. If it changes it will
 probably get detected by the sys.getsizeof() tests.

test_sys has been modified:

-asciifields = nnbP
+asciifields = nn4bP

It would like to know if objects are bigger with the change or not.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Look at the commits, not the patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-24 Thread STINNER Victor

STINNER Victor added the comment:

 Look at the commits, not the patch.

Ah! You wrote Ok, I've committed the patch. Ok, your commit is fine. I would 
prefered a named field (called padding), but it's fine ;-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-24 Thread Mark Lawrence

Mark Lawrence added the comment:

Martin, Larry msg214639 states Fix PyUnicode_DATA() alignment under m68k., 
your comments please.

--
nosy: +BreamoreBoy, larry, loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-24 Thread Stefan Krah

Stefan Krah added the comment:

Mark Lawrence, stop playing off committers against each other. This is
outright trolling.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Andreas Schwab

Andreas Schwab added the comment:

The attached patch has been tested on 
{i586,x86_64,ppc,ppc64,ppc64le,armv6hl,armv7hl,aarch64,m68k}-suse-linux.

--
keywords: +patch
Added file: http://bugs.python.org/file34589/pyasciiobject-align.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Andreas Schwab

Changes by Andreas Schwab sch...@linux-m68k.org:


Removed file: http://bugs.python.org/file32554/xx

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Are unnamed struct fields actually valid C?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Stefan Krah

Stefan Krah added the comment:

Yes, ยง6.7.2.1:

A bit-field declaration with no declarator, but only a colon and a width, 
indicates an unnamed bit-field.

With a footnote:

105) An unnamed bit-field structure member is useful for padding to conform to 
externally imposed layouts.


Unnamed struct members are valid, too:

There may be unnamed padding at the end of a structure or union.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 004ae1472a43 by Antoine Pitrou in branch '3.4':
Issue #19537: Fix PyUnicode_DATA() alignment under m68k.  Patch by Andreas 
Schwab.
http://hg.python.org/cpython/rev/004ae1472a43

New changeset 0128b25068de by Antoine Pitrou in branch 'default':
Issue #19537: Fix PyUnicode_DATA() alignment under m68k.  Patch by Andreas 
Schwab.
http://hg.python.org/cpython/rev/0128b25068de

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I've committed the patch, then. Thank you, Andreas.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread STINNER Victor

STINNER Victor added the comment:

What is the size of the PyASCIIObject on x86/x64 with and without the
patch? GCC and Visual Studio provide attributes to align structures.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2014-03-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 What is the size of the PyASCIIObject on x86/x64 with and without the
 patch?

Haven't tried on x86, but on x86-64 it's the same. If it changes it will
probably get detected by the sys.getsizeof() tests.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-16 Thread STINNER Victor

STINNER Victor added the comment:

If you compile Python with GCC, we can maybe try something with __attribute__ 
((aligned (sizeof(void * attribute. The attribute can be used on a 
structure field. The problem is that we don't care of the alignment of header 
attributes, only of data, but data is not a field but the data just after the 
structure.

Or is it possible to GCC to get a structure size aligned on 4 bytes?

For the explicit padding: how do you compute the size of the padding?

How about disabling the fast-path in FASTSEARCH if data is not aligned?

(You might get non-aligned if even if structure is correctly aligned, it may 
happen if the memory allocator does not align memory blocks. I don't know if 
Python may get unaligned memory blocks.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that adding __attribute__ ((aligned (sizeof(void * to the PyObject 
type (or to the ob_base field) is enough.

If first byte of structure is aligned, then first byte past the structure 
should be aligned too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Antoine, if sizeof(PyUnicodeObject) is 38, the start of UCS4 unicode string is 
not aligned. This should be fixed.

--
stage: patch review - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Antoine, if sizeof(PyUnicodeObject) is 38, the start of UCS4 unicode
 string is not aligned. This should be fixed.

Probably. Does anyone want to propose a patch?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-15 Thread Andreas Schwab

Andreas Schwab added the comment:

How about adding explicit padding to the bitfield in PyASCIIObject?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-12-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 How about adding explicit padding to the bitfield in PyASCIIObject?

That sounds ok to me, but it must be explicitly for 68k (or use a
sufficiently smart scheme not to affect already aligned architectures).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-25 Thread Stefan Krah

Stefan Krah added the comment:

 (gdb) p sizeof(PyASCIIObject)
 $1 = 22

If the only issue is that the size should be 24 instead of 22,
could we perhaps add an unused uint16_t to the struct just
for this architecture?

--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is sizeof(PyUnicodeObject)?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-25 Thread Andreas Schwab

Andreas Schwab added the comment:

(gdb) p sizeof(PyUnicodeObject)
$1 = 38

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-11 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Current code assumes that PyUnicode_DATA() is aligned to PyUnicode_KIND() 
bytes. If this is not true on some platform it will be easer to add a padding 
than rewrite a code. A lot of code depends on this assumption. See also 
issue14422.

I afraid that proposed patch may slow down a search.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't understand in which concrete situation the current code could be wrong. 
The start of the unicode string should always be aligned, due to how unicode 
objects are allocated.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Andreas Schwab

Andreas Schwab added the comment:

(gdb) p sizeof(PyASCIIObject)
$1 = 22

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Stefan Krah

Stefan Krah added the comment:

Andreas Schwab rep...@bugs.python.org wrote:
 (gdb) p sizeof(PyASCIIObject)
 $1 = 22

m68k again? ;)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-10 Thread Andreas Schwab

Andreas Schwab added the comment:

There is nothing wrong with that.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-09 Thread Andreas Schwab

New submission from Andreas Schwab:

sizeof(foo) is never a good approximation for the alignment of foo

--
components: Interpreter Core
files: xx
messages: 202487
nosy: schwab
priority: normal
severity: normal
status: open
title: Fix misalignment in fastsearch_memchr_1char
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file32554/xx

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka
stage:  - patch review
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com