On Thu, Jun 21, 2012 at 07:59:06AM +0200, Philipp Marek wrote: > Just out of curiosity, could you show the disassembler output of the > OutputWrite() function for gcc-4.6, and gcc-4.7 with -O1 and -O2? > > # objdump -Sgd <name-of-obj-file> > > and pasting only this function might be a good way. Sure, attached files for those combinations. Cheers, -- James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@debian.org>
0000000000001b2a <OutputWrite>:
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
1b2a: 55 push %rbp
1b2b: 53 push %rbx
1b2c: 48 83 ec 18 sub $0x18,%rsp
1b30: 48 89 f0 mov %rsi,%rax
int len;
char *str = NULL;
1b33: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
1b3a: 00
int error = ((OutputObject *)(self))->error;
1b3b: 8b 5f 18 mov 0x18(%rdi),%ebx
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
1b3e: 4c 8d 44 24 0c lea 0xc(%rsp),%r8
1b43: 48 89 e1 mov %rsp,%rcx
1b46: 48 8b 15 00 00 00 00 mov 0x0(%rip),%rdx # 1b4d <OutputWrite+0x23>
1b4d: be 00 00 00 00 mov $0x0,%esi
1b52: 48 89 c7 mov %rax,%rdi
1b55: b8 00 00 00 00 mov $0x0,%eax
1b5a: e8 00 00 00 00 callq 1b5f <OutputWrite+0x35>
1b5f: 85 c0 test %eax,%eax
1b61: 74 4d je 1bb0 <OutputWrite+0x86>
return NULL;
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
1b63: 48 83 3c 24 00 cmpq $0x0,(%rsp)
1b68: 74 4d je 1bb7 <OutputWrite+0x8d>
return NULL;
Py_BEGIN_ALLOW_THREADS
1b6a: e8 00 00 00 00 callq 1b6f <OutputWrite+0x45>
1b6f: 48 89 c5 mov %rax,%rbp
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
1b72: 48 63 54 24 0c movslq 0xc(%rsp),%rdx
1b77: 85 db test %ebx,%ebx
1b79: b8 00 00 00 00 mov $0x0,%eax
1b7e: bf 00 00 00 00 mov $0x0,%edi
1b83: 48 0f 45 f8 cmovne %rax,%rdi
1b87: 48 8b 34 24 mov (%rsp),%rsi
1b8b: e8 e2 fc ff ff callq 1872 <writer>
Python_Release_Vim();
Py_END_ALLOW_THREADS
1b90: 48 89 ef mov %rbp,%rdi
1b93: e8 00 00 00 00 callq 1b98 <OutputWrite+0x6e>
PyMem_Free(str);
1b98: 48 8b 3c 24 mov (%rsp),%rdi
1b9c: e8 00 00 00 00 callq 1ba1 <OutputWrite+0x77>
Py_INCREF(Py_None);
1ba1: 48 83 05 00 00 00 00 addq $0x1,0x0(%rip) # 1ba9 <OutputWrite+0x7f>
1ba8: 01
return Py_None;
1ba9: b8 00 00 00 00 mov $0x0,%eax
1bae: eb 0c jmp 1bbc <OutputWrite+0x92>
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
return NULL;
1bb0: b8 00 00 00 00 mov $0x0,%eax
1bb5: eb 05 jmp 1bbc <OutputWrite+0x92>
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
return NULL;
1bb7: b8 00 00 00 00 mov $0x0,%eax
Py_END_ALLOW_THREADS
PyMem_Free(str);
Py_INCREF(Py_None);
return Py_None;
}
1bbc: 48 83 c4 18 add $0x18,%rsp
1bc0: 5b pop %rbx
1bc1: 5d pop %rbp
1bc2: c3 retq
0000000000000500 <OutputWrite>:
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
500: 55 push %rbp
501: 48 89 f0 mov %rsi,%rax
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
504: be 00 00 00 00 mov $0x0,%esi
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
509: 53 push %rbx
50a: 48 83 ec 18 sub $0x18,%rsp
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
50e: 48 8b 15 00 00 00 00 mov 0x0(%rip),%rdx # 515 <OutputWrite+0x15>
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
515: 8b 5f 18 mov 0x18(%rdi),%ebx
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
518: 4c 8d 44 24 04 lea 0x4(%rsp),%r8
51d: 48 8d 4c 24 08 lea 0x8(%rsp),%rcx
522: 48 89 c7 mov %rax,%rdi
525: 31 c0 xor %eax,%eax
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
int len;
char *str = NULL;
527: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp)
52e: 00 00
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
530: e8 00 00 00 00 callq 535 <OutputWrite+0x35>
535: 85 c0 test %eax,%eax
537: 74 57 je 590 <OutputWrite+0x90>
return NULL;
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
539: 48 83 7c 24 08 00 cmpq $0x0,0x8(%rsp)
53f: 74 4f je 590 <OutputWrite+0x90>
return NULL;
Py_BEGIN_ALLOW_THREADS
541: e8 00 00 00 00 callq 546 <OutputWrite+0x46>
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
546: 48 63 54 24 04 movslq 0x4(%rsp),%rdx
54b: 48 8b 74 24 08 mov 0x8(%rsp),%rsi
550: 85 db test %ebx,%ebx
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
return NULL;
Py_BEGIN_ALLOW_THREADS
552: 48 89 c5 mov %rax,%rbp
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
555: bf 00 00 00 00 mov $0x0,%edi
55a: b8 00 00 00 00 mov $0x0,%eax
55f: 48 0f 44 f8 cmove %rax,%rdi
563: e8 28 fd ff ff callq 290 <writer>
Python_Release_Vim();
Py_END_ALLOW_THREADS
568: 48 89 ef mov %rbp,%rdi
56b: e8 00 00 00 00 callq 570 <OutputWrite+0x70>
PyMem_Free(str);
570: 48 8b 7c 24 08 mov 0x8(%rsp),%rdi
575: e8 00 00 00 00 callq 57a <OutputWrite+0x7a>
Py_INCREF(Py_None);
57a: 48 83 05 00 00 00 00 addq $0x1,0x0(%rip) # 582 <OutputWrite+0x82>
581: 01
return Py_None;
}
582: 48 83 c4 18 add $0x18,%rsp
Python_Release_Vim();
Py_END_ALLOW_THREADS
PyMem_Free(str);
Py_INCREF(Py_None);
return Py_None;
586: b8 00 00 00 00 mov $0x0,%eax
}
58b: 5b pop %rbx
58c: 5d pop %rbp
58d: c3 retq
58e: 66 90 xchg %ax,%ax
590: 48 83 c4 18 add $0x18,%rsp
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
return NULL;
594: 31 c0 xor %eax,%eax
Py_END_ALLOW_THREADS
PyMem_Free(str);
Py_INCREF(Py_None);
return Py_None;
}
596: 5b pop %rbx
597: 5d pop %rbp
598: c3 retq
599: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
0000000000001ade <OutputWrite>:
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
1ade: 55 push %rbp
1adf: 53 push %rbx
1ae0: 48 83 ec 18 sub $0x18,%rsp
1ae4: 48 89 f0 mov %rsi,%rax
int len;
char *str = NULL;
1ae7: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
1aee: 00
int error = ((OutputObject *)(self))->error;
1aef: 48 8b 5f 18 mov 0x18(%rdi),%rbx
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
1af3: 4c 8d 44 24 0c lea 0xc(%rsp),%r8
1af8: 48 89 e1 mov %rsp,%rcx
1afb: 48 8b 15 00 00 00 00 mov 0x0(%rip),%rdx # 1b02 <OutputWrite+0x24>
1b02: be 00 00 00 00 mov $0x0,%esi
1b07: 48 89 c7 mov %rax,%rdi
1b0a: b8 00 00 00 00 mov $0x0,%eax
1b0f: e8 00 00 00 00 callq 1b14 <OutputWrite+0x36>
return NULL;
1b14: ba 00 00 00 00 mov $0x0,%edx
{
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
1b19: 85 c0 test %eax,%eax
1b1b: 74 4b je 1b68 <OutputWrite+0x8a>
return NULL;
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
1b1d: 48 83 3c 24 00 cmpq $0x0,(%rsp)
1b22: 74 44 je 1b68 <OutputWrite+0x8a>
return NULL;
Py_BEGIN_ALLOW_THREADS
1b24: e8 00 00 00 00 callq 1b29 <OutputWrite+0x4b>
1b29: 48 89 c5 mov %rax,%rbp
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
1b2c: 48 63 54 24 0c movslq 0xc(%rsp),%rdx
1b31: 85 db test %ebx,%ebx
1b33: b8 00 00 00 00 mov $0x0,%eax
1b38: bf 00 00 00 00 mov $0x0,%edi
1b3d: 48 0f 45 f8 cmovne %rax,%rdi
1b41: 48 8b 34 24 mov (%rsp),%rsi
1b45: e8 d9 fc ff ff callq 1823 <writer>
Python_Release_Vim();
Py_END_ALLOW_THREADS
1b4a: 48 89 ef mov %rbp,%rdi
1b4d: e8 00 00 00 00 callq 1b52 <OutputWrite+0x74>
PyMem_Free(str);
1b52: 48 8b 3c 24 mov (%rsp),%rdi
1b56: e8 00 00 00 00 callq 1b5b <OutputWrite+0x7d>
Py_INCREF(Py_None);
1b5b: 48 83 05 00 00 00 00 addq $0x1,0x0(%rip) # 1b63 <OutputWrite+0x85>
1b62: 01
return Py_None;
1b63: ba 00 00 00 00 mov $0x0,%edx
}
1b68: 48 89 d0 mov %rdx,%rax
1b6b: 48 83 c4 18 add $0x18,%rsp
1b6f: 5b pop %rbx
1b70: 5d pop %rbp
1b71: c3 retq
00000000000005d0 <OutputWrite>:
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
5d0: 55 push %rbp
5d1: 48 89 f0 mov %rsi,%rax
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
5d4: be 00 00 00 00 mov $0x0,%esi
/* Output buffer management
*/
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
5d9: 53 push %rbx
5da: 48 83 ec 18 sub $0x18,%rsp
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
5de: 48 8b 15 00 00 00 00 mov 0x0(%rip),%rdx # 5e5 <OutputWrite+0x15>
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
5e5: 48 8b 5f 18 mov 0x18(%rdi),%rbx
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
5e9: 4c 8d 44 24 0c lea 0xc(%rsp),%r8
5ee: 48 89 c7 mov %rax,%rdi
5f1: 48 89 e1 mov %rsp,%rcx
5f4: 31 c0 xor %eax,%eax
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
int len;
char *str = NULL;
5f6: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
5fd: 00
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
5fe: e8 00 00 00 00 callq 603 <OutputWrite+0x33>
return NULL;
603: 31 d2 xor %edx,%edx
{
int len;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
605: 85 c0 test %eax,%eax
607: 74 4b je 654 <OutputWrite+0x84>
return NULL;
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
609: 48 83 3c 24 00 cmpq $0x0,(%rsp)
60e: 74 44 je 654 <OutputWrite+0x84>
return NULL;
Py_BEGIN_ALLOW_THREADS
610: e8 00 00 00 00 callq 615 <OutputWrite+0x45>
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
615: 48 63 54 24 0c movslq 0xc(%rsp),%rdx
61a: 48 8b 34 24 mov (%rsp),%rsi
61e: 85 db test %ebx,%ebx
/* TODO: This works around a gcc optimizer problem and avoids Vim
* from crashing. Should find a real solution. */
if (str == NULL)
return NULL;
Py_BEGIN_ALLOW_THREADS
620: 48 89 c5 mov %rax,%rbp
Python_Lock_Vim();
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
623: bf 00 00 00 00 mov $0x0,%edi
628: b8 00 00 00 00 mov $0x0,%eax
62d: 48 0f 44 f8 cmove %rax,%rdi
631: e8 da fc ff ff callq 310 <writer>
Python_Release_Vim();
Py_END_ALLOW_THREADS
636: 48 89 ef mov %rbp,%rdi
639: e8 00 00 00 00 callq 63e <OutputWrite+0x6e>
PyMem_Free(str);
63e: 48 8b 3c 24 mov (%rsp),%rdi
642: e8 00 00 00 00 callq 647 <OutputWrite+0x77>
Py_INCREF(Py_None);
647: 48 83 05 00 00 00 00 addq $0x1,0x0(%rip) # 64f <OutputWrite+0x7f>
64e: 01
return Py_None;
64f: ba 00 00 00 00 mov $0x0,%edx
}
654: 48 83 c4 18 add $0x18,%rsp
658: 48 89 d0 mov %rdx,%rax
65b: 5b pop %rbx
65c: 5d pop %rbp
65d: c3 retq
65e: 66 90 xchg %ax,%ax
Attachment:
signature.asc
Description: Digital signature