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 085306ECE6; Wed, 30 Mar 2022 02:50:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 085306ECE6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1648597803; bh=1kktX7AOQPBrcgFp+pJ0T+Kmg2V2Ba6BnPNmaHo+C6E=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=P6XU2krS8l0cTtgx9M0fc6w2LtYOGcQ1PXzc2lGXb6XZEBkvxdaX4jN7GIbGodkJe s0SFMhZk+Foo4yDafVLJ40T5vkgXyJ8quC1KDaN1qTT7rwcABbaHMJdlDey4olpQDg jpuDNZoZ/KcIn9pJz1oTfCNQdjlfzayDi8aqid8o= Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 9B88D6ECE6 for ; Wed, 30 Mar 2022 02:49:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9B88D6ECE6 Received: by mail-lj1-f181.google.com with SMTP id b43so21004819ljr.10 for ; Tue, 29 Mar 2022 16:49:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/Yi9coxPKe8Av8q3KYBzX99OavPv0ecA/Vc2jUKKD78=; b=T/GaXB+FLaV0941U2v2Yc0d+uRBeOuYKBwCBn/deBktwF5lHznocPSBMyYH/GVhckz uyNoxq8EMfH4s0yzNU6RVTaXZFfTWWsK74ul7bTXpPfGCS/00E3XMXeJ5egzSOiJtnXy 9Z2WeSSbyOyAQ5bVsg5AIzIYol8JeRNqM3aaPpc9xTsJ7yzs3JaaETIxBetgHDNlZjuK KkwVqohiXxB8gHw14GQcnb3iFIb5NqtfgZnX7zTWESJnGK4tza1sHHSFBSZcVTnsq1Zl yXcyiNHD/uVZhBDDI+iMkbvS4c/fp9FhllwxjhJMqCfdPMJpE/Kg8Y7gnjmms1Xz9C9s YPtg== X-Gm-Message-State: AOAM531YATsFUGGy0bR/iLAtzNqSBP75eaVeaM0Ydqj8Lp33IF8musbQ aGFfmOhRQa9yMgAItird4W3L9t4AgloJBw== X-Google-Smtp-Source: ABdhPJymd0j3cRitAKUQMLB95fzM9GYioQk+pEBNtR5++og/4drZmrzbB6ndLDY32mxtONYKspJ2Gg== X-Received: by 2002:a2e:9990:0:b0:249:88f6:f637 with SMTP id w16-20020a2e9990000000b0024988f6f637mr4622754lji.14.1648597750877; Tue, 29 Mar 2022 16:49:10 -0700 (PDT) Received: from localhost.localdomain ([93.175.11.199]) by smtp.gmail.com with ESMTPSA id k10-20020a2eb74a000000b0024965dbf2d8sm2236021ljo.82.2022.03.29.16.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Mar 2022 16:49:10 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Wed, 30 Mar 2022 02:48:55 +0300 Message-Id: <316197b3f4c529a0a5249e69e8f352fef25e0ab8.1648597663.git.m.kokryashkin@tarantool.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit v4 2/3] Don't compile math.modf() anymore. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Mike Pall This commit disables compilation for the `math.modf` function since it's rarely used and properly compiling it would be difficult. Part of tarantool/tarantool#6163 --- src/lib_math.c | 2 +- src/lj_ffrecord.c | 16 ------------- .../gh-6163-jit-min-max.test.lua | 23 +++++++++++++++---- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/lib_math.c b/src/lib_math.c index ef9dda2d..4e6d2458 100644 --- a/src/lib_math.c +++ b/src/lib_math.c @@ -45,7 +45,7 @@ LJLIB_ASM_(math_sinh) LJLIB_REC(math_htrig IRCALL_sinh) LJLIB_ASM_(math_cosh) LJLIB_REC(math_htrig IRCALL_cosh) LJLIB_ASM_(math_tanh) LJLIB_REC(math_htrig IRCALL_tanh) LJLIB_ASM_(math_frexp) -LJLIB_ASM_(math_modf) LJLIB_REC(.) +LJLIB_ASM_(math_modf) LJLIB_ASM(math_log) LJLIB_REC(math_log) { diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index be890a93..ac9c9ba1 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -601,22 +601,6 @@ static void LJ_FASTCALL recff_math_htrig(jit_State *J, RecordFFData *rd) J->base[0] = emitir(IRTN(IR_CALLN), tr, rd->data); } -static void LJ_FASTCALL recff_math_modf(jit_State *J, RecordFFData *rd) -{ - TRef tr = J->base[0]; - if (tref_isinteger(tr)) { - J->base[0] = tr; - J->base[1] = lj_ir_kint(J, 0); - } else { - TRef trt; - tr = lj_ir_tonum(J, tr); - trt = emitir(IRTN(IR_FPMATH), tr, IRFPM_TRUNC); - J->base[0] = trt; - J->base[1] = emitir(IRTN(IR_SUB), tr, trt); - } - rd->nres = 2; -} - static void LJ_FASTCALL recff_math_pow(jit_State *J, RecordFFData *rd) { J->base[0] = lj_opt_narrow_pow(J, J->base[0], J->base[1], diff --git a/test/tarantool-tests/gh-6163-jit-min-max.test.lua b/test/tarantool-tests/gh-6163-jit-min-max.test.lua index d6eb3f3b..4594b968 100644 --- a/test/tarantool-tests/gh-6163-jit-min-max.test.lua +++ b/test/tarantool-tests/gh-6163-jit-min-max.test.lua @@ -1,12 +1,12 @@ local tap = require('tap') +local jutil = require('jit.util') jit.off() jit.flush() local test = tap.test("gh-6163-jit-min-max") -test:plan(2) --- --- gh-6163: math.min/math.max success with no args --- +test:plan(6) + +-- `math.min`/`math.max` success with no args. local pcall = pcall jit.opt.start(0, 'hotloop=1') @@ -17,4 +17,19 @@ test:ok(false == r) r, _ = pcall(function() math.min() end) test:ok(false == r) +jit.off() +jit.flush() +jit.on() + +-- `math.modf` shouldn't be compiled. +for _ = 1, 3 do math.modf(5.32) end + +local tr1_info = jutil.traceinfo(1) +local tr2_info = jutil.traceinfo(2) + +test:ok(tr1_info ~= nil) +test:ok(tr2_info ~= nil) +test:ok(tr1_info.link == 2) +test:ok(tr1_info.linktype == "stitch") + os.exit(test:check() and 0 or 1) -- 2.35.1