From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#58905: Vector initialization loop remains even when allocation is elided Date: Sun, 30 Oct 2022 22:38:51 +0100 Message-ID: <87bkptyot0.fsf@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31377"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) To: 58905@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun Oct 30 22:39:42 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opG1u-00082T-MA for guile-bugs@m.gmane-mx.org; Sun, 30 Oct 2022 22:39:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opG1H-0002Dz-SE; Sun, 30 Oct 2022 17:39:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opG1G-0002Dn-Cx for bug-guile@gnu.org; Sun, 30 Oct 2022 17:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opG1G-00018f-4y for bug-guile@gnu.org; Sun, 30 Oct 2022 17:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opG1F-0000Xd-Ts for bug-guile@gnu.org; Sun, 30 Oct 2022 17:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 30 Oct 2022 21:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58905 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16671659372069 (code B ref -1); Sun, 30 Oct 2022 21:39:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 21:38:57 +0000 Original-Received: from localhost ([127.0.0.1]:39100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opG1A-0000XJ-VV for submit@debbugs.gnu.org; Sun, 30 Oct 2022 17:38:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opG18-0000XA-NM for submit@debbugs.gnu.org; Sun, 30 Oct 2022 17:38:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opG18-0002DV-G0 for bug-guile@gnu.org; Sun, 30 Oct 2022 17:38:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opG18-00018M-8d for bug-guile@gnu.org; Sun, 30 Oct 2022 17:38:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=NZ5IHeH86aYBp/5nce44lqW5RxdzUfMWRHnWbcPqlvo=; b=SNINI1tiL3PpCF VrH4xEZQrInG+MlY9w/XHUTjl/6fnttdnSp5cbt0Cw3275jc6D9sOcqo7bEmp3g5OsyS5WZGTEu9A +nm5S9QIP5e56ptfCUmb1cbSbcMRfN6yv5wIe4W+iduR6JAkS4EhugoYYp+sWxgEK9Q5/Da4cK5kj AWyiaJ6Nom5YUwYGUQS+6o9B3StqfrUBmh35tISwltheERWLVTWX6s7g6AV1uuuxb8aLS7blXN5Kn LO2FmmHpGAXf8bVXJ/AyMgmAmvKgDr/EtbIvFaXgci699nby/ByBRio9Wu+bw1+UjPlmSBBicqnxl msEAVaJD6m6fbX4ztMsg==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opG17-0002g1-Ls for bug-guile@gnu.org; Sun, 30 Oct 2022 17:38:53 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Nonidi 9 Brumaire an 231 de la =?UTF-8?Q?R=C3=A9volution, ?= jour de l'Alisier X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-guile" Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10409 Archived-At: Spot the issue in the code below? --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (version) $28 =3D "3.0.8" scheme@(guile-user)> ,c (let () (make-vector 12345 #\x) 42) Disassembly of at #xe8: 0 (instrument-entry 42) at (unknown f= ile):5009:35 2 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) 3 (load-u64 1 0 12346) at (unknown f= ile):5009:11 6 (load-u64 0 0 1)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 9 (uadd/immediate 0 0 1)=20=20=20=20=20=20=20=20=20=20 10 (u64 L2 L1: 12 (instrument-loop 30)=20=20=20=20=20=20=20=20=20=20=20=20 14 (handle-interrupts)=20=20=20=20=20=20=20=20=20=20=20=20=20 15 (uadd/immediate 0 0 1)=20=20=20=20=20=20=20=20=20=20 16 (u64 L1 L2: 18 (make-immediate 1 170) ;; 42 at (unknown f= ile):5009:35 19 (reset-frame 1) ;; 1 slot 20 (handle-interrupts)=20=20=20=20=20=20=20=20=20=20=20=20=20 21 (return-values)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 --8<---------------cut here---------------end--------------->8--- Vector allocation is elided (no =E2=80=98allocate-words=E2=80=99 instructio= n), rightfully so (assuming we neglect the possibility of an out-of-memory effect), but we still have the skeleton of the vector initialization loop with its 12345 iterations. Vector allocation is removed by the =E2=80=98eliminate-dead-code=E2=80=99 p= ass, which happens on the VM instruction stream, so it explains why the loop remains. Still kinda surprising! Also weird is the fact that =E2=80=98make-vector=E2=80=99 is kept by =E2=80= =98peval=E2=80=99, on the grounds that it might throw, but down the road it=E2=80=99s removed anyway. Thoughts? Ludo=E2=80=99.