Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 3/3] core: remove excess assertion inside memprof
Date: Wed, 30 Dec 2020 14:06:03 +0300	[thread overview]
Message-ID: <20201230110603.GS14702@root> (raw)
In-Reply-To: <2B46045C-1624-431A-AC2A-0BA583A45990@tarantool.org>

Hi!

Thanks for the review!

On 30.12.20, Sergey Ostanevich wrote:
> Hi!
> 
> Thanks for the patch!
> Just one nit in comments.
> 
> LGTM.
> Sergos
> 
> > 
> > Reworded. See the iterative patch below. Branch is force-pushed.
> > 
> > | core: remove excess assertion inside memprof
> > |
> > | There are the cases when the memory profiler attempts to attribute
> 	      ^^^ remove, just 'there are cases'

Thanks! Fixed in the commit message and the comment. Branch is
force-pushed. See the iterative diff below.

> 		
> > | allocations triggered by JIT engine recording phase with a Lua function
> > | to be recorded. At this case lj_debug_frameline() may return BC_NOPOS
> > | (i.e. a negative value) so the assertion in the Lua writer
> > | memprof_write_lfunc() is violated.
> > |
> > | This patch removes this assertion. For negative returned line value
> > | profiler is reported zero frameline.
> > |
> > | Follows up tarantool/tarantool#5442
> > 
> >> 
> >>>   ** -DLUAJIT_DISABLE_DEBUGINFO flag.
> >>>   */
> >>> -  lua_assert(line >= 0);
> >>> -  lj_wbuf_addbyte(out, aevent | ASOURCE_LFUNC);
> >>> -  lj_wbuf_addu64(out, (uintptr_t)funcproto(fn));
> >>> -  lj_wbuf_addu64(out, (uint64_t)line);
> >>> +  lj_wbuf_addu64(out, line >= 0 ? (uint64_t)line : 0);
> >>> }
> >>> 
> >>> static void memprof_write_cfunc(struct lj_wbuf *out, uint8_t aevent,
> >>> -- 
> >>> 2.28.0
> >>> 
> >> 
> >> -- 
> >> Best regards,
> >> IM
> > 
> > ===================================================================
> > diff --git a/src/lj_memprof.c b/src/lj_memprof.c
> > index 0568049..37ec4c9 100644
> > --- a/src/lj_memprof.c
> > +++ b/src/lj_memprof.c
> > @@ -94,7 +94,10 @@ static void memprof_write_lfunc(struct lj_wbuf *out, uint8_t aevent,
> >   lj_wbuf_addu64(out, (uintptr_t)funcproto(fn));
> >   /*
> >   ** Line is >= 0 if we are inside a Lua function.
> > -  ** An exception may be when the Lua function is on top.
> > +  ** There are the cases when the memory profiler attempts
> > +  ** to attribute allocations triggered by JIT engine recording
> > +  ** phase with a Lua function to be recorded. At this case
> > +  ** lj_debug_frameline() may return BC_NOPOS (i.e. a negative value).
> >   ** Equals to zero when LuaJIT is built with the
> >   ** -DLUAJIT_DISABLE_DEBUGINFO flag.
> >   */
> > ===================================================================
> > 
> > -- 
> > Best regards,
> > Sergey Kaplun
> 

===================================================================
diff --git a/src/lj_memprof.c b/src/lj_memprof.c
index 37ec4c9..2c1ef3b 100644
--- a/src/lj_memprof.c
+++ b/src/lj_memprof.c
@@ -94,7 +94,7 @@ static void memprof_write_lfunc(struct lj_wbuf *out, uint8_t aevent,
   lj_wbuf_addu64(out, (uintptr_t)funcproto(fn));
   /*
   ** Line is >= 0 if we are inside a Lua function.
-  ** There are the cases when the memory profiler attempts
+  ** There are cases when the memory profiler attempts
   ** to attribute allocations triggered by JIT engine recording
   ** phase with a Lua function to be recorded. At this case
   ** lj_debug_frameline() may return BC_NOPOS (i.e. a negative value).
===================================================================

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2020-12-30 11:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29 22:22 [Tarantool-patches] [PATCH luajit 0/3] LuaJIT memory profiler bug fixes Sergey Kaplun
2020-12-29 22:22 ` [Tarantool-patches] [PATCH luajit 1/3] misc: fix build with disabled memory profiler Sergey Kaplun
2020-12-30  8:49   ` Igor Munkin
2020-12-30  8:52     ` Sergey Kaplun
2020-12-30  9:42       ` Sergey Ostanevich
2020-12-29 22:22 ` [Tarantool-patches] [PATCH luajit 2/3] core: fix resources leak in " Sergey Kaplun
2020-12-30  9:06   ` Igor Munkin
2020-12-30  9:31     ` Sergey Ostanevich
2020-12-30  9:33       ` Sergey Kaplun
2020-12-30  9:32     ` Sergey Kaplun
2020-12-30  9:53       ` Sergey Ostanevich
2020-12-29 22:22 ` [Tarantool-patches] [PATCH luajit 3/3] core: remove excess assertion inside memprof Sergey Kaplun
2020-12-30  9:39   ` Igor Munkin
2020-12-30  9:50     ` Sergey Kaplun
2020-12-30 10:50       ` Sergey Ostanevich
2020-12-30 11:06         ` Sergey Kaplun [this message]
2020-12-30  8:24 ` [Tarantool-patches] [PATCH luajit 0/3] LuaJIT memory profiler bug fixes Alexander V. Tikhonov
2020-12-30 11:20 ` Igor Munkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201230110603.GS14702@root \
    --to=skaplun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 3/3] core: remove excess assertion inside memprof' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox