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 6872A5D6F1C; Mon, 4 Sep 2023 18:55:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6872A5D6F1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1693842943; bh=gN44td8HEEOrdDdoFw6vUcLt7n4Wuxc3u7KkK8giITA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=kvJox8Go5a7umfXDPXiS7GLwB2tM04rXRioszJ+D5XB4dZxHjvAz3fOk8sXxjyEaY unPznDKNz9+bIYakg7uG+pX7vsJp6AmtmrDKWpXJDDlodq2YgchjoL4tutNuymla4z n7FGROE0Syf/UsbNcv/k9+VI0XkvZj88iAmDZJVM= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [95.163.41.96]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5D5F55D6F17 for ; Mon, 4 Sep 2023 18:55:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D5F55D6F17 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1qdBux-009M3J-04; Mon, 04 Sep 2023 18:55:11 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 4 Sep 2023 18:50:24 +0300 Message-ID: <8e1c4acd3c622a3f4b851fe999ef337422b9e351.1693840653.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD96E142CFC92DB15CD90AAA51E9363FBE6A21DF977184D824F182A05F53808504032A6B21B450D11EEFF51D6F63EAD3C383B0680A32C4EC19A7A074F37354CA563 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F1942E6D70B4A2F0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CF58BB58AE3180708638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8159C95F34005B0F4ECFB029598938777117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCC0EC8C44E4C1BEE2A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B1C9461EB66F04EBFD8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3A5ED62E35AC703CC6E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637021B7B85925F8E35EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A57793F7C13D9CA32F139A782FEC73E38DCBDB9E86D3B0545BF87CCE6106E1FC07E67D4AC08A07B9B0AD0E433DBF1FBFA39C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF405E72081311653F36252EEFC6445048F2725268AF060181571CAAC1458034E638B8486FBA2B5E2DEA61C66FA002EE27F41A167D4E91E1545A88ED19070EDB5EA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojNmsqR+t6vc8X7C503q8z4g== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769FE096F8923DDB9D7FF51D6F63EAD3C38816609AA8FC7A761DEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 1/3] MIPS: Fix "bad FP FLOAD" assertion. 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Mike Pall Reported by Sergey Kaplun. (cherry-picked from commit 72efc42ef2258086a9cb797c676e2916b0a9e7e1) This patch is the follow-up for the commit 786dbb2ebdde16eadd7464cd5cbeb5d95a5e46f0 ("Add IR_FLOAD with REF_NIL for field loads from GG_State."). This commit allows `FLOAD` to be used for fields loading from `GG_State`. Nevertheless, the aforementioned assertion hasn't been moved to the `else` branch related to the default use case. This leads to assertion failure in the case when `FLOAD` is used for loading some field and has the `num` type. This patch moves the assertion to the right place. Sergey Kaplun: * added the description and the test for the problem Part of tarantool/tarantool#8825 --- src/lj_asm_mips.h | 2 +- .../lj-1043-asm-fload.test.lua | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/tarantool-tests/lj-1043-asm-fload.test.lua diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index ea108aab..ac9090f2 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h @@ -1285,8 +1285,8 @@ static void asm_fload(ASMState *as, IRIns *ir) } } ofs = field_ofs[ir->op2]; + lj_assertA(!irt_isfp(ir->t), "bad FP FLOAD"); } - lj_assertA(!irt_isfp(ir->t), "bad FP FLOAD"); emit_tsi(as, mi, dest, idx, ofs); } diff --git a/test/tarantool-tests/lj-1043-asm-fload.test.lua b/test/tarantool-tests/lj-1043-asm-fload.test.lua new file mode 100644 index 00000000..2f381560 --- /dev/null +++ b/test/tarantool-tests/lj-1043-asm-fload.test.lua @@ -0,0 +1,24 @@ +local tap = require('tap') + +-- Test file to demonstrate LuaJIT's misbehaviour during the +-- assembling of the `FLOAD` on MIPS. +-- See also: https://github.com/LuaJIT/LuaJIT/issues/1043. +local test = tap.test('lj-1043-asm-fload'):skipcond({ + ['Test requires JIT enabled'] = not jit.status(), +}) + +test:plan(1) + +local math_abs = math.abs + +local results = {nil, nil, nil, nil} + +-- Disable optimizations to be sure that we assemble `FLOAD`. +jit.opt.start(0, 'hotloop=1') +for i = 1, 4 do + results[i] = math_abs(i - 10) +end + +test:is_deeply(results, {9, 8, 7, 6}, 'correct assembling of the FLOAD') + +test:done(true) -- 2.42.0