guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-8-79-g5af


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-8-79-g5af3378
Date: Sun, 07 Mar 2010 22:58:58 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=5af3378aab5b32bd82bd93d9a789c97e553a1356

The branch, master has been updated
       via  5af3378aab5b32bd82bd93d9a789c97e553a1356 (commit)
       via  ba7e7139b3adbf4cf7683edc31097535d3cd7e56 (commit)
       via  1caa6341b0832ebe2173ba16d6132fa79b042d9e (commit)
      from  bd5a75dcd8436ebe077c9ce52300d013e9519d94 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5af3378aab5b32bd82bd93d9a789c97e553a1356
Author: Ludovic Courtès <address@hidden>
Date:   Sun Mar 7 23:53:22 2010 +0100

    Don't export `write-bytecode' from `(language assembly compile-bytecode)'.
    
    * module/language/assembly/compile-bytecode.scm: Don't export
      `write-bytecode'.
    
    * test-suite/tests/asm-to-bytecode.test (write-bytecode): New global
      variable.

commit ba7e7139b3adbf4cf7683edc31097535d3cd7e56
Author: Ludovic Courtès <address@hidden>
Date:   Sun Mar 7 23:51:40 2010 +0100

    Add wide-string compilation test.
    
    * test-suite/tests/asm-to-bytecode.test ("compiler")[load-wide-string
      "λ"]: New test.

commit 1caa6341b0832ebe2173ba16d6132fa79b042d9e
Author: Ludovic Courtès <address@hidden>
Date:   Sun Mar 7 23:45:14 2010 +0100

    Fix miscompilation of non-ASCII Latin-1 strings.
    
    The bug was introduced dad6817f ("Use the R6RS I/O API in
    `write-bytecode'.").
    
    * module/language/assembly/compile-bytecode.scm
      (write-bytecode)[write-string]: Rename to...
      [write-latin1-string]: ... this.  Add the `write-loader-len' call.
      Write each character individually instead of using `string->utf8'.
      [write-loader]: Remove.
    
    * test-suite/tests/asm-to-bytecode.test ("compiler")[load-string "æ"]:
      New test.

-----------------------------------------------------------------------

Summary of changes:
 module/language/assembly/compile-bytecode.scm |   16 +++++++---------
 test-suite/tests/asm-to-bytecode.test         |   16 ++++++++++++++--
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/module/language/assembly/compile-bytecode.scm 
b/module/language/assembly/compile-bytecode.scm
index 5c0e115..8a4c5cd 100644
--- a/module/language/assembly/compile-bytecode.scm
+++ b/module/language/assembly/compile-bytecode.scm
@@ -27,7 +27,7 @@
   #:use-module (rnrs io ports)
   #:use-module ((srfi srfi-1) #:select (fold))
   #:use-module ((srfi srfi-26) #:select (cut))
-  #:export (compile-bytecode write-bytecode))
+  #:export (compile-bytecode))
 
 (define (compile-bytecode assembly env . opts)
   (pmatch assembly
@@ -50,8 +50,9 @@
     (let ((start (port-position port)))
       (lambda ()
         (+ address (- (port-position port) start)))))
-  (define (write-string s)
-    (put-bytevector port (string->utf8 s)))
+  (define (write-latin1-string s)
+    (write-loader-len (string-length s))
+    (string-for-each (lambda (c) (write-byte (char->integer c))) s))
   (define (write-int24-be x)
     (bytevector-s32-set! u32-bv 0 x (endianness big))
     (put-bytevector port u32-bv 1 3))
@@ -68,9 +69,6 @@
     (write-byte (ash len -16))
     (write-byte (logand (ash len -8) 255))
     (write-byte (logand len 255)))
-  (define (write-loader str)
-    (write-loader-len (string-length str))
-    (write-string str))
   (define (write-bytevector bv)
     (write-loader-len (bytevector-length bv))
     (put-bytevector port bv))
@@ -103,10 +101,10 @@
              ;; assembly)'.
              (write-bytecode meta port '() 0 #f)))
         ((make-char32 ,x) (write-uint32-be x))
-        ((load-number ,str) (write-loader str))
-        ((load-string ,str) (write-loader str))
+        ((load-number ,str) (write-latin1-string str))
+        ((load-string ,str) (write-latin1-string str))
         ((load-wide-string ,str) (write-wide-string str))
-        ((load-symbol ,str) (write-loader str))
+        ((load-symbol ,str) (write-latin1-string str))
         ((load-array ,bv) (write-bytevector bv))
         ((br ,l) (write-break l))
         ((br-if ,l) (write-break l))
diff --git a/test-suite/tests/asm-to-bytecode.test 
b/test-suite/tests/asm-to-bytecode.test
index 6e89d86..29505a8 100644
--- a/test-suite/tests/asm-to-bytecode.test
+++ b/test-suite/tests/asm-to-bytecode.test
@@ -1,4 +1,4 @@
-;;;; test assembly to bytecode compilation -*- scheme -*-
+;;;; Assembly to bytecode compilation -*- mode: scheme; coding: utf-8; -*-
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,9 @@
   #:use-module (system vm instruction)
   #:use-module (language assembly compile-bytecode))
 
+(define write-bytecode
+  (@@ (language assembly compile-bytecode) write-bytecode))
+
 (define (->u8-list sym val)
   (let ((entry (assq-ref `((uint16 2 ,bytevector-u16-native-set!)
                            (uint32 4 ,bytevector-u32-native-set!))
@@ -78,7 +81,16 @@
     (comp-test '(load-symbol "foo")
                (vector 'load-symbol 0 0 3 (char->integer #\f) (char->integer 
#\o)
                        (char->integer #\o)))
-    
+
+    (comp-test '(load-string "æ") ;; a non-ASCII Latin-1 string
+               (vector 'load-string 0 0 1 230))
+
+    (comp-test '(load-wide-string "λ")
+               (apply vector 'load-wide-string 0 0 4
+                      (if (eq? (native-endianness) (endianness little))
+                          '(187 3 0 0)
+                          '(0 0 3 187))))
+
     (comp-test '(load-program () 3 #f (make-int8 3) (return))
                #(load-program
                  (uint32 3)     ;; len


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]