annotate.scm 929 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Derived from
  3. ; (lambda (x y) (vector (car x) (cdr x) y))
  4. (define annotate-procedure
  5. (lap annotate-procedure ()
  6. (protocol 2 (push template))
  7. (stack-ref 2)
  8. (stored-object-ref closure 0)
  9. (push)
  10. (stack-ref 3)
  11. (stored-object-ref closure 1)
  12. (push+stack-ref 3)
  13. (make-stored-object 3 closure)
  14. (return)))
  15. ; Derived from
  16. ; (lambda (x) (if (< 2 (vector-length x)) (vector-ref x 2) #f))
  17. (define procedure-annotation
  18. (lap procedure-anotation ()
  19. (protocol 1 (push template))
  20. (literal 2)
  21. (push)
  22. (stack-ref 2)
  23. (stored-object-length closure)
  24. (<)
  25. (jump-if-false (=> no-annotation))
  26. (stack-ref+push 1)
  27. (literal 2)
  28. (stored-object-indexed-ref closure 0)
  29. (return)
  30. no-annotation
  31. (false)
  32. (return)))