allocation.scm 800 B

1234567891011121314151617181920212223
  1. ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Interface to the VM for allocation
  3. ;; Everything else is defined via bibop-gc-external
  4. ;; For allocation done outside the VM.
  5. (define (s48-allocate-stob type size)
  6. (let* ((traced? (< type least-b-vector-type))
  7. (length-in-bytes (if traced?
  8. (cells->bytes size)
  9. size))
  10. (needed (+ length-in-bytes (cells->bytes stob-overhead)))
  11. (thing (if traced?
  12. (s48-allocate-traced+gc needed)
  13. (s48-allocate-untraced+gc needed))))
  14. (if (null-address? thing)
  15. (error "insufficient heap space for external allocation"))
  16. (store! thing (make-header type length-in-bytes))
  17. (address->stob-descriptor (address+ thing
  18. (cells->bytes stob-overhead)))))