From unknown Sat Jul 26 15:31:14 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58905 <58905@debbugs.gnu.org> To: bug#58905 <58905@debbugs.gnu.org> Subject: Status: Vector initialization loop remains even when allocation is elided Reply-To: bug#58905 <58905@debbugs.gnu.org> Date: Sat, 26 Jul 2025 22:31:14 +0000 retitle 58905 Vector initialization loop remains even when allocation is el= ided reassign 58905 guile submitter 58905 Ludovic Court=C3=A8s severity 58905 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 30 17:38:57 2022 Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 21:38:57 +0000 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 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 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 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==; 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 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: bug-guile@gnu.org Subject: Vector initialization loop remains even when allocation is elided X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Nonidi 9 Brumaire an 231 de la =?utf-8?Q?R=C3=A9volu?= =?utf-8?Q?tion=2C?= 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 Date: Sun, 30 Oct 2022 22:38:51 +0100 Message-ID: <87bkptyot0.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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.