From: Taylor R Campbell Date: Wed, 29 May 2019 00:53:14 +0000 (+0000) Subject: Integrate some subroutines that turn up hot in profiles. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e17d95fadd66d663ec13f2370d5afd785c24543e;p=mit-scheme.git Integrate some subroutines that turn up hot in profiles. (cherry picked from commit 8f4e491fd35266b0c052866a1476c57d4a292a68) --- diff --git a/src/runtime/string.scm b/src/runtime/string.scm index c2fc9a9da..a2c4f0912 100644 --- a/src/runtime/string.scm +++ b/src/runtime/string.scm @@ -285,6 +285,7 @@ USA. ;;;; String slices +(declare (integrate-operator slice?)) (define (slice? object) (and (%record? object) (fix:= 4 (%record-length object)) @@ -300,17 +301,20 @@ USA. (define-integrable (slice-start slice) (%record-ref slice 2)) (define-integrable (slice-length slice) (%record-ref slice 3)) +(declare (integrate-operator slice-end)) (define (slice-end slice) (fix:+ (slice-start slice) (slice-length slice))) (define (slice-mutable? slice) (ustring-mutable? (slice-string slice))) +(declare (integrate-operator unpack-slice)) (define (unpack-slice string k) (if (slice? string) (k (slice-string string) (slice-start string) (slice-end string)) (k string 0 (ustring-length string)))) +(declare (integrate-operator translate-slice)) (define (translate-slice string start end k) (if (slice? string) (k (slice-string string)