From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Bug int rtl.scm in wip-rtl Date: Sat, 24 Nov 2012 16:09:18 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bdc1a3a94319004cf3f15e2 X-Trace: ger.gmane.org 1353769765 6174 80.91.229.3 (24 Nov 2012 15:09:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Nov 2012 15:09:25 +0000 (UTC) To: guile-devel , Noah Lavine , Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Nov 24 16:09:37 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TcHMN-0006Cd-FE for guile-devel@m.gmane.org; Sat, 24 Nov 2012 16:09:35 +0100 Original-Received: from localhost ([::1]:47716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcHMC-00023j-HL for guile-devel@m.gmane.org; Sat, 24 Nov 2012 10:09:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcHM9-00023N-0g for guile-devel@gnu.org; Sat, 24 Nov 2012 10:09:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcHM7-0005kf-W3 for guile-devel@gnu.org; Sat, 24 Nov 2012 10:09:20 -0500 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:41167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcHM7-0005iz-Q1 for guile-devel@gnu.org; Sat, 24 Nov 2012 10:09:19 -0500 Original-Received: by mail-qa0-f48.google.com with SMTP id s11so2411683qaa.0 for ; Sat, 24 Nov 2012 07:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=q5lDAlPI5RK9FfnK0Zs/zwvqmTGT01ICf/OR/k5tNqw=; b=gmTcCDdz0StaoTqWBJDiZbvfjqDD0EvV+pqCrKqbmYEqNBSkD1Z1prh7JOGqd1Ya02 GFM4Fe3PykLpGUQRrmVqbWMNZfDiOkLvDY/CAgaNtusFD1A0tzMdL2iqR5nLVbpMK8yr dQ2e7fGIgXbmJPp7breMaViDCjlfenfXQZ5GmSOtBBfT4qKOufjnjSBEXrY6I05KBbrj q9GOPKfaq3TtExtu9ceCF5udp69U/IO2i4FIghzyMrNqe89BpKJSl8giEYwn+4IUGo9V nJ+ulQGd9xBkaompv6AN1ZE3luNNCAuMNvPRU44Tp8uA+9tfBjkdC3DhUsfvjzXjXwI/ D2DQ== Original-Received: by 10.49.63.104 with SMTP id f8mr7922067qes.29.1353769758765; Sat, 24 Nov 2012 07:09:18 -0800 (PST) Original-Received: by 10.49.28.135 with HTTP; Sat, 24 Nov 2012 07:09:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.48 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15244 Archived-At: --047d7bdc1a3a94319004cf3f15e2 Content-Type: text/plain; charset=ISO-8859-1 Hi, I just found a bug in rtl.scm, it's triggere by compiling larger rtl codes. In rtl.scm, we have the function (define (link-text-object asm) (let ((buf (make-u32vector (asm-pos asm)))) (let lp ((pos 0) (prev (reverse (asm-prev asm)))) (if (null? prev) (let ((byte-size (* (asm-idx asm) 4))) (bytevector-copy! (asm-cur asm) 0 buf pos byte-size) (unless (eq? (asm-endianness asm) (native-endianness)) (swap-bytes! buf)) (make-object asm '.rtl-text buf (process-relocs buf (asm-relocs asm) (asm-labels asm)) (process-labels (asm-labels asm)))) (let ((len (* *block-size* 4))) (bytevector-copy! (car prev) 0 buf pos len) (lp (+ pos len) (cdr prev))))))) In thh lp loop I had added reverse in order for the code to emmit the chunks in the right order (the bug was no reverse and we got code emitted in the wrong order) as you can see for smaller codees prev is null and this bug is not triggered. Have fun with rtl, /Stefan --047d7bdc1a3a94319004cf3f15e2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, I just found a bug in rtl.scm, it's triggere by compiling larger rt= l codes.

In rtl.scm, we have the function

(define (link-text-= object asm)
=A0 (let ((buf (make-u32vector (asm-pos asm))))
=A0=A0=A0= (let lp ((pos 0) (prev (reverse (asm-prev asm))))
=A0=A0=A0=A0=A0 (if (null? prev)
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (let ((byte= -size (* (asm-idx asm) 4)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (bytevecto= r-copy! (asm-cur asm) 0 buf pos byte-size)
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 (unless (eq? (asm-endianness asm) (native-endianness))
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (swap-bytes! buf))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (make-object asm '.rtl-text
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 buf
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (p= rocess-relocs buf (asm-relocs asm)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 (asm-labels asm))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (process-labels (asm-labels asm))))
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (let ((len (* *block-size* 4)))
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 (bytevector-copy! (car prev) 0 buf pos len)
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (lp (+ pos len) (cdr prev)))))))

In thh = lp loop I had added reverse in order for the code to emmit the chunks in th= e right order (the bug was no reverse and we got code emitted in the wrong = order) as you can see for smaller codees prev is null and this bug is not t= riggered.

Have fun with rtl,
/Stefan
--047d7bdc1a3a94319004cf3f15e2--