Klimi's new dotfiles with stow.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

67 рядки
2.9 KiB

4 роки тому
  1. ;;; swank-sbcl-exts.lisp --- Misc extensions for SBCL
  2. ;;
  3. ;; Authors: Tobias C. Rittweiler <tcr@freebits.de>
  4. ;;
  5. ;; License: Public Domain
  6. ;;
  7. (in-package :swank)
  8. (eval-when (:compile-toplevel :load-toplevel :execute)
  9. (swank-require :swank-arglists))
  10. ;; We need to do this so users can place `slime-sbcl-exts' into their
  11. ;; ~/.emacs, and still use any implementation they want.
  12. #+sbcl
  13. (progn
  14. ;;; Display arglist of instructions.
  15. ;;;
  16. (defmethod compute-enriched-decoded-arglist ((operator-form (eql 'sb-assem:inst))
  17. argument-forms)
  18. (flet ((decode-instruction-arglist (instr-name instr-arglist)
  19. (let ((decoded-arglist (decode-arglist instr-arglist)))
  20. ;; The arglist of INST is (instruction ...INSTR-ARGLIST...).
  21. (push 'sb-assem::instruction (arglist.required-args decoded-arglist))
  22. (values decoded-arglist
  23. (list instr-name)
  24. t))))
  25. (if (null argument-forms)
  26. (call-next-method)
  27. (destructuring-bind (instruction &rest args) argument-forms
  28. (declare (ignore args))
  29. (let* ((instr-name
  30. (typecase instruction
  31. (arglist-dummy
  32. (string-upcase (arglist-dummy.string-representation instruction)))
  33. (symbol
  34. (string-downcase instruction))))
  35. (instr-fn
  36. #+#.(swank/backend:with-symbol 'op-encoder-name 'sb-assem)
  37. (or (sb-assem::op-encoder-name instr-name)
  38. (sb-assem::op-encoder-name (string-upcase instr-name)))
  39. #+#.(swank/backend:with-symbol 'inst-emitter-symbol 'sb-assem)
  40. (sb-assem::inst-emitter-symbol instr-name)
  41. #+(and
  42. (not #.(swank/backend:with-symbol 'inst-emitter-symbol 'sb-assem))
  43. #.(swank/backend:with-symbol '*assem-instructions* 'sb-assem))
  44. (gethash instr-name sb-assem:*assem-instructions*)))
  45. (cond ((functionp instr-fn)
  46. (with-available-arglist (arglist) (arglist instr-fn)
  47. (decode-instruction-arglist instr-name arglist)))
  48. ((fboundp instr-fn)
  49. (with-available-arglist (arglist) (arglist instr-fn)
  50. ;; SB-ASSEM:INST invokes a symbolic INSTR-FN with
  51. ;; current segment and current vop implicitly.
  52. (decode-instruction-arglist instr-name
  53. (if (or (get instr-fn :macro)
  54. (macro-function instr-fn))
  55. arglist
  56. (cddr arglist)))))
  57. (t
  58. (call-next-method))))))))
  59. ) ; PROGN
  60. (provide :swank-sbcl-exts)