From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 012_subtransactions.pl vs clang -fsanitize=undefined |
Date: | 2022-07-24 22:18:03 |
Message-ID: | 1787180.1658701083@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> I think what's happening is just that this build configuration
> eats stack extravagantly.
That's definitely it, but I don't entirely see why. Here are a
couple of major offenders though:
(gdb) x/8i ExecInterpExpr
0x11a5530 <ExecInterpExpr>: push %rbp
0x11a5531 <ExecInterpExpr+1>: mov %rsp,%rbp
0x11a5534 <ExecInterpExpr+4>: sub $0x2f40,%rsp
0x11a553b <ExecInterpExpr+11>: mov %rdi,-0x10(%rbp)
0x11a553f <ExecInterpExpr+15>: mov %rsi,-0x18(%rbp)
0x11a5543 <ExecInterpExpr+19>: mov %rdx,-0x20(%rbp)
0x11a5547 <ExecInterpExpr+23>: jmpq 0x11a554c <ExecInterpExpr+28>
0x11a554c <ExecInterpExpr+28>: cmpq $0x0,-0x10(%rbp)
(gdb) p 0x2f40
$51 = 12096
(gdb) x/8i ExecInitExprRec
0x11672e0 <ExecInitExprRec>: push %rbp
0x11672e1 <ExecInitExprRec+1>: mov %rsp,%rbp
0x11672e4 <ExecInitExprRec+4>: sub $0x3c80,%rsp
0x11672eb <ExecInitExprRec+11>: mov %rdi,-0x8(%rbp)
0x11672ef <ExecInitExprRec+15>: mov %rsi,-0x10(%rbp)
0x11672f3 <ExecInitExprRec+19>: mov %rdx,-0x18(%rbp)
0x11672f7 <ExecInitExprRec+23>: mov %rcx,-0x20(%rbp)
0x11672fb <ExecInitExprRec+27>: lea -0x60(%rbp),%rdi
(gdb) p 0x3c80
$52 = 15488
It looks like this build eats about 24K of stack per plpgsql recursion
level, of which ExecInterpExpr alone accounts for half. Why is that?
It has no large local variables, mostly just ints and pointers.
There are a lot of them, but even if you presume that each one gets
its own dedicated bit of the stack frame, it's hard to arrive at 12K.
I'd almost call this a compiler bug.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2022-07-24 22:39:25 | Re: 012_subtransactions.pl vs clang -fsanitize=undefined |
Previous Message | Alexander Korotkov | 2022-07-24 21:52:49 | Re: Custom tuplesorts for extensions |