annotate.scm 958 B

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