palloc.txt

text/plain

Filename: palloc.txt
Type: text/plain
Part: 1
Message: Re: Avoid stack frame setup in performance critical routines using tail calls
 Percent |	Source code & Disassembly of postgres for cycles (81 samples, percent: local period)
----------------------------------------------------------------------------------------------------
         :
         :
         :
         :            Disassembly of section .text:
         :
         :            0000000000571220 <palloc>:
         :            palloc():
         :            MemoryContextStatsDetail(TopMemoryContext, 100, false);
         :            }
         :
         :            void *
         :            palloc(Size size)
         :            {
   13.44 :   571220: endbr64
    2.45 :   571224: mov    %rdi,%rsi
         :            /* duplicates MemoryContextAlloc to avoid increased overhead */
         :            void       *ret;
         :            MemoryContext context = CurrentMemoryContext;
    2.44 :   571227: mov    0x2be9b2(%rip),%rdi        # 82fbe0 <CurrentMemoryContext>
         :
         :            AssertArg(MemoryContextIsValid(context));
         :            AssertNotInCriticalSection(context);
         :            context->isReset = false;
         :
         :            ret = context->methods->alloc(context, size, 0);
   11.11 :   57122e: xor    %edx,%edx
    1.21 :   571230: mov    0x10(%rdi),%rax
         :            context->isReset = false;
   31.08 :   571234: movb   $0x0,0x4(%rdi)
         :            ret = context->methods->alloc(context, size, 0);
    3.67 :   571238: mov    (%rax),%rax
   34.59 :   57123b: jmp    *%rax