Ticket #1136: move-memory.patch

File move-memory.patch, 2.4 KB (added by sjamaan, 10 years ago)
  • lolevel.scm

    diff --git a/lolevel.scm b/lolevel.scm
    index 86ae299..f847917 100644
    a b  
    4040# include <sys/mman.h>
    4141#endif
    4242
    43 #define C_w2b(x)                   C_fix(C_wordstobytes(C_unfix(x)))
    4443#define C_memmove_o(to, from, n, toff, foff) C_memmove((char *)(to) + (toff), (char *)(from) + (foff), (n))
    4544EOF
    4645) )
    EOF 
    424423        [(##core#inline "C_byteblockp" x)
    425424         (##sys#size x)]
    426425        [else
    427          (##core#inline "C_w2b" (##sys#size x))] ) )
     426         (##core#inline "C_bytes" (##sys#size x))] ) )
    428427
    429428
    430429;;; Record objects:
  • tests/lolevel-tests.scm

    diff --git a/tests/lolevel-tests.scm b/tests/lolevel-tests.scm
    index 886a07a..d0398fa 100644
    a b  
    1212(let ((s "..."))
    1313  (assert-error (move-memory! "abc" s 3 -1)))
    1414
     15; overlapping src and dest, moving "right" (from SRFI-13 tests)
     16(assert (string=?
     17         "aabce"
     18         (let ((str (string-copy "abcde")))
     19           (move-memory! str str 3 0 1) str)))
     20;; Specialisation rewrite from types.db
     21(assert (string=?
     22         "aabce"
     23         (let ((str (string-copy "abcde")))
     24           (move-memory! (make-locative str) (make-locative str) 3 0 1) str)))
     25
     26; overlapping src and dest, moving "left" (from SRFI-13 tests)
     27(assert (string=?
     28         "bcdde"
     29         (let ((str (string-copy "abcde")))
     30           (move-memory! str str 3 1) str)))
     31;; Specialisation rewrite from types.db
     32(assert (string=?
     33         "bcdde"
     34         (let ((str (string-copy "abcde")))
     35           (move-memory! (make-locative str) (make-locative str) 3 1) str)))
     36
    1537; object-copy
    1638
    1739; allocate
  • tests/runtests.sh

    diff --git a/tests/runtests.sh b/tests/runtests.sh
    index 5007f8a..4acb2e3 100755
    a b echo "*** Skipping \"feeley-dynwind\" for now ***" 
    165165
    166166echo "======================================== lolevel tests ..."
    167167$interpret -s lolevel-tests.scm
    168 $compile lolevel-tests.scm
     168$compile -O3 lolevel-tests.scm
    169169./a.out
    170170
    171171echo "======================================== arithmetic tests ..."
  • types.db

    diff --git a/types.db b/types.db
    index a66f044..d5fc4fb 100644
    a b  
    15011501                 (((or port procedure symbol pair vector locative float pointer-vector))
    15021502                  ;; would be applicable to all structure types, but we can't specify
    15031503                  ;; "(struct *)" (yet)
    1504                   (##core#inline "C_w2b" (##sys#size #(1)))))
     1504                  (##core#inline "C_bytes" (##sys#size #(1)))))
    15051505
    15061506(number-of-slots (#(procedure #:clean) number-of-slots (*) fixnum)
    15071507                 (((or vector symbol pair)) (##sys#size #(1))))