Implement select-on-bytes-per-word for gnerating word-length-specific code.
authorChris Hanson <org/chris-hanson/cph>
Thu, 13 Apr 2017 05:24:20 +0000 (22:24 -0700)
committerChris Hanson <org/chris-hanson/cph>
Thu, 13 Apr 2017 05:24:20 +0000 (22:24 -0700)
src/runtime/host-adapter.scm
src/runtime/runtime.pkg
src/runtime/sysmac.scm

index a27224d75575b90e25b403867840a1319efab88d..94e38aadcbb96cebcb725eb16d987cc9c28f57bc 100644 (file)
@@ -107,4 +107,16 @@ USA.
                        (guarantee-binding source-environment source-name)
                        (link-variables environment (vector-ref binding 0)
                                        source-environment source-name)))))))))
-       (->environment '(package)))))
\ No newline at end of file
+       (->environment '(package)))
+      (eval
+       '(define-syntax select-on-bytes-per-word
+         (er-macro-transformer
+          (lambda (form rename compare)
+            rename compare
+            (syntax-check '(KEYWORD EXPRESSION EXPRESSION) form)
+            (let ((bpo (bytes-per-object)))
+              (case bpo
+                ((4) (cadr form))
+                ((8) (caddr form))
+                (else (error "Unsupported bytes-per-object:" bpo)))))))
+       (->environment '(runtime)))))
\ No newline at end of file
index f31af4396e443e6a6b9ddcd6f260b7afc07703c2..4b1a24121e14eb7792ee2330ff71a2fe342c59b1 100644 (file)
@@ -4702,6 +4702,7 @@ USA.
   (export (runtime)
          define-deferred
          define-primitives
+         select-on-bytes-per-word
          ucode-primitive
          ucode-return-address
          ucode-type))
index d1d661d9b5bc706b6fd4c2cbc9525fa930e63dad..cd0d0e929cd6f624db286e73cd6e8d2865c75ca3 100644 (file)
@@ -73,7 +73,7 @@ USA.
    (lambda (form environment)
      environment
      (make-return-address (apply microcode-return (cdr form))))))
-
+\f
 (define-syntax define-guarantee
   (sc-macro-transformer
    (lambda (form environment)
@@ -104,4 +104,15 @@ USA.
          (,(rename 'ADD-BOOT-INIT!)
           (,(rename 'LAMBDA) ()
             (,(rename 'SET!) ,name ,value)
-            ,(rename 'UNSPECIFIC))))))))
\ No newline at end of file
+            ,(rename 'UNSPECIFIC))))))))
+
+(define-syntax select-on-bytes-per-word
+  (er-macro-transformer
+   (lambda (form rename compare)
+     rename compare
+     (syntax-check '(KEYWORD EXPRESSION EXPRESSION) form)
+     (let ((bpo (bytes-per-object)))
+       (case bpo
+        ((4) (cadr form))
+        ((8) (caddr form))
+        (else (error "Unsupported bytes-per-object:" bpo)))))))
\ No newline at end of file