From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2E6606EC5D; Wed, 7 Apr 2021 00:37:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2E6606EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617745067; bh=TOuUSgGt+5Sk5CuKlV8rqhyvLYtmXASgpNXgpr56qh4=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=bcxg8tBTmdg/iIcm0BYma3Yy63xVHQ053XMUGcwo1lqSq+QFuG8CA23HWUMgxJt/d zSlcRP4/kfNOH2CuoycSArm9IHOr3yiCFyJ11gsYEpIa4bszgScqKC3dQ703+y16Jv M/dBF9eBnHD0AJMECJb5QYqlj2SoSOZRUUXh2wO8= Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 60F0D6EC5D for ; Wed, 7 Apr 2021 00:37:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 60F0D6EC5D Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1lTtO3-0001fd-Fy; Wed, 07 Apr 2021 00:37:27 +0300 Date: Wed, 7 Apr 2021 00:37:16 +0300 To: Sergey Kaplun Message-ID: <20210406213716.GM29703@tarantool.org> References: <20210331192350.GK29703@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD912A3E3D5D4B49FC12DF659087DAACB92BFBA00DE2463A66B00894C459B0CD1B90A5D2CA79781128023A455BAA022F83FBBABD01366BE3380A39B5B018D1B5ADE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7227E4400968B082FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063721BEEAF38C6AE0B78638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC1C8CC3B5DA0D001D622B386216A5286178136349FC3003A5389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B652D31B9D28593E51CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7BEA0E1DB66A6FB7C731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A57E846A259875A2D9530EE18D6465FB478DFFDB2C89BE8FEAD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FD9114F69CA58D1E91E4134D1EB40826C2A26744B2C3E7C8A8506F2592222BF17D9D1CF7B6120D851D7E09C32AA3244CED46C54D64F2B6460C38FADEC2012B9AD08D48398F32B4A6927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojAX27rRizpLlu/KlSCPSCaQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822B9DB3DF3913870AFAF1642F831300A62A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 23/30] test: disable PUC Lua test for fast function name X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, On 02.04.21, Sergey Kaplun wrote: > Igor, > > Thanks for the review! > > On 31.03.21, Igor Munkin wrote: > > Sergey, > > > > Thanks for the patch! Please consider the comments below. > > > > On 26.03.21, Sergey Kaplun wrote: > > > LuaJIT can't determine bytecode position for non Lua functions > > > (in particular for fast functions) and, therefore, detect built-in > > > function names for errors in tail calls. > > > > Side note: here is the inconsistency in your usage of possessive nouns. > > Fixed. No, it's not, but this doesn't bother me anymore. > > > > diff --git a/test/PUC-Lua-5.1-tests/errors.lua b/test/PUC-Lua-5.1-tests/errors.lua > > > index cf24e40..af776a7 100644 > > > --- a/test/PUC-Lua-5.1-tests/errors.lua > > > +++ b/test/PUC-Lua-5.1-tests/errors.lua > > > @@ -105,9 +105,13 @@ while 1 do > > > insert(prefix, a) > > > end]], "global 'insert'") > > > > > > -checkmessage([[ -- tail call > > > - return math.sin("a") > > > -]], "'sin'") > > > +-- LuaJIT: Can't determine bytecode position for non Lua functions > > > +-- (in particular for fast functions) and, therefore, detect fast > > > +-- function names for errors in tail calls. > > > > This is kinda gibberish. I've tried the following snippets and can't > > understand what do you mean by this comment. > > > > | $ luajit -e 'function q(a) return math.sin(a) end q("a")' > > | luajit: (command line):1: bad argument #1 to 'q' (number expected, got string) > > | stack traceback: > > | [C]: in function 'q' > > | (command line):1: in main chunk > > | [C]: at 0x5610e8497eb0 > > | $ luajit -e 'loadstring("return math.sin([[a]])")()' > > | luajit: (command line):1: bad argument #1 to '?' (number expected, got string) > > | stack traceback: > > | [builtin#43]: at 0x7fc0f807ad10 > > | (command line):1: in main chunk > > | [C]: at 0x55c1e85c7eb0 > > > > I understand the first result. The second result surprised me, but I've > > never investigated how loadstring call works (it looks like specifics of > > VARG frame, but this is a wild guess). But neither of them fits your > > explanation. The root cause is the same: callee uses caller frame, since > > caller doesn't need it anymore. Could you please clarify yours? > > This is not about `loadstring()` at all: > > | luajit -e 'return math.sin"a"' > | luajit: bad argument #1 to '?' (number expected, got string) > | stack traceback: > | [builtin#43]: at 0x7f7c2ca6dbe0 > | [C]: at 0x558b0cd4cec0 > > The guest frame is looked like the following (when the error thrown): > | 0x40001938 [ ] VALUE: string "number expected, got string" @ 0x40008380 > | 0x40001930 [ B ] VALUE: string "a" @ 0x40008250 > | 0x40001928 [ ] FRAME: [CP] delta=3, fast function #44 > > When LuaJIT tries to detect function's name it determines bytecode > position first, via `debug_framepc()`. But it can't determine bytecode > position for non-Lua functions: What? Both luajit-gdb.py and LuaJIT itself reports the fast function ID and this is its name. > > | if (!isluafunc(fn)) { /* Cannot derive a PC for non-Lua functions. */ > | return NO_BCPOS; > > > > > > +-- The test is disabled for LuaJIT. > > > +-- checkmessage([[ -- tail call > > > +-- return math.sin("a") > > > +-- ]], "'sin'") > > > > > > checkmessage([[collectgarbage("nooption")]], "invalid option") > > > > > > -- > > > 2.31.0 > > > > > > > -- > > Best regards, > > IM > > -- > Best regards, > Sergey Kaplun -- Best regards, IM