Changeset 8439
- Timestamp:
- Feb 7, 2008, 12:44:29 PM (17 years ago)
- Location:
- branches/working-0711/ccl
- Files:
-
- 5 edited
-
compiler/X86/x86-disassemble.lisp (modified) (2 diffs)
-
compiler/X86/x862.lisp (modified) (2 diffs)
-
compiler/nx0.lisp (modified) (7 diffs)
-
level-1/l1-reader.lisp (modified) (1 diff)
-
lib/nfcomp.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/working-0711/ccl/compiler/X86/x86-disassemble.lisp
r8435 r8439 2706 2706 usual))) 2707 2707 2708 2709 2708 (defun string-sans-most-whitespace (string &optional (max-length (length string))) 2710 2709 (with-output-to-string (sans-whitespace) … … 2729 2728 (let* ((source-note (getf (%lfun-info function) 'function-source-note)) 2730 2729 (source-info (find-source-at-pc function pc)) 2731 (text (if source-info 2730 (text (if (and source-info 2731 (plusp (car (getf source-info :source-text-range))) 2732 (plusp (cdr (getf source-info :source-text-range)))) 2732 2733 (string-sans-most-whitespace 2733 2734 (subseq (%fast-uncompact (getf source-note :%text)) -
branches/working-0711/ccl/compiler/X86/x862.lisp
r8435 r8439 611 611 (when (and *compiler-record-source* *definition-source-note*) 612 612 (list 'function-source-note 613 (source-note- to-list*definition-source-note* :form nil :children nil)))613 (source-note-for-%lfun-info *definition-source-note* :form nil :children nil))) 614 614 (when *x862-recorded-symbols* 615 615 (list 'function-symbol-map (x862-digest-symbols))) … … 685 685 686 686 (defun generate-pc-source-mapping (pc-start pc-end text-start text-end) 687 (if (every #'small-positive-integer-p 688 (list pc-start pc-end text-start text-end)) 689 (let ((mapping 0)) 690 (setf (ldb (byte 15 0) mapping) pc-start 691 (ldb (byte 15 15) mapping) pc-end 692 (ldb (byte 15 30) mapping) text-start 693 (ldb (byte 15 45) mapping) text-end) 694 mapping) 695 (vector pc-start pc-end text-start text-end))) 696 697 (defstruct (pc-source-mapping (:type vector)) 698 pc-start 699 pc-end 700 text-start 701 text-end) 687 (cond 688 ((every #'small-positive-integer-p (list pc-start pc-end text-start text-end)) 689 (let ((mapping 0)) 690 (setf (ldb (byte 15 0) mapping) pc-start 691 (ldb (byte 15 15) mapping) pc-end 692 (ldb (byte 15 30) mapping) text-start 693 (ldb (byte 15 45) mapping) text-end) 694 mapping)) 695 ((every #'plusp (list pc-start pc-end text-start text-end)) 696 (vector pc-start pc-end text-start text-end)) 697 (t nil))) 702 698 703 699 (defun x862-generate-pc-source-map (definition-source-note emitted-source-notes) 704 700 (when *compiler-record-source* 705 701 (let ((def-start (source-note-start definition-source-note)) 706 (vec (make-array (length emitted-source-notes)))) 707 (flet ((pc-start (note) (aref note )))) 708 (map-into vec 709 (lambda (start) 710 (make-pc-source-mapping :pc-start (x862-vinsn-note-label-address 711 start 712 t) 713 :pc-end (x862-vinsn-note-label-address 702 (vec (make-array (length emitted-source-notes) :fill-pointer 0))) 703 (loop 704 for start in emitted-source-notes 705 for mapping = (generate-pc-source-mapping (x862-vinsn-note-label-address 706 start 707 t) 708 (x862-vinsn-note-label-address 714 709 (vinsn-note-peer start) 715 nil) 716 :text-start (- (source-note-start (aref (vinsn-note-info start) 0)) 717 def-start) 718 :text-end (- (source-note-end (aref (vinsn-note-info start) 0)) 719 def-start))) 720 emitted-source-notes) 721 vec))) 710 nil) 711 (- (source-note-start (aref (vinsn-note-info start) 0)) 712 def-start) 713 (- (source-note-end (aref (vinsn-note-info start) 0)) 714 def-start)) 715 when mapping 716 do (vector-push-extend mapping vec)) 717 (let ((simple-vec (make-array (length vec)))) 718 (map-into simple-vec #'identity vec) 719 simple-vec)))) 722 720 723 721 (defun x862-vinsn-note-label-address (note &optional start-p sym) -
branches/working-0711/ccl/compiler/nx0.lisp
r8435 r8439 1569 1569 (defvar *compile-file-original-buffer-offset* nil) 1570 1570 1571 (defun substream (stream start &optionalend)1571 (defun substream (stream start end) 1572 1572 "like subseq, but on streams that support file-position. Leaves stream positioned where it was 1573 1573 before calling substream." … … 1579 1579 ((not (open-stream-p stream)) 1580 1580 (if (typep stream 'file-stream) 1581 (if (probe-file (stream-pathname stream))1582 (with-open-file (f (stream-pathname stream)) ; I should really understand how this happens.1583 (substream f start end))1584 "")1585 ""))1581 (if (probe-file (stream-pathname stream)) 1582 (with-open-file (f (stream-pathname stream)) ; I should really understand how this happens. 1583 (substream f start end)) 1584 "") 1585 "")) 1586 1586 (t 1587 1587 (let ((now (file-position stream))) … … 1630 1630 :start (+ start (or *compile-file-original-buffer-offset* 0)) 1631 1631 :end (+ end (or *compile-file-original-buffer-offset* 0)) 1632 :%text (%fast-compact (or text (substream stream start end)))1632 :%text text 1633 1633 :form form 1634 1634 :children children))) … … 1643 1643 ;;; the struct. 1644 1644 1645 (defun source-note- to-list(note &key (start t) (end t) (text t) (form t) (children t) (file-name t))1645 (defun source-note-for-%lfun-info (note &key (start t) (end t) (text t) (form t) (children t) (file-name t)) 1646 1646 (append (when start (list :start (source-note-start note))) 1647 (when end (list :end (source-note-end note)))1648 (when text (list :%text (source-note-%text note)))1649 (when form (list :form (source-note-form note)))1647 (when end (list :end (source-note-end note))) 1648 (when text (list :%text (%fast-compact (source-note-%text note)))) 1649 (when form (list :form (source-note-form note))) 1650 1650 (when children (list :children (source-note-children note))) 1651 1651 (when file-name (list :file-name (source-note-file-name note))))) … … 1675 1675 map)) 1676 1676 1677 (defun compute-children-text (source-note stream) 1678 (unless (source-note-%text source-note) 1679 (setf (source-note-%text source-note) 1680 (substream stream (source-note-start source-note) (source-note-end source-note)))) 1681 (dolist (nested (source-note-children source-note)) 1682 (when nested 1683 (unless (source-note-%text nested) 1684 (setf (source-note-%text nested) 1685 (make-array (- (source-note-end nested) (source-note-start nested)) 1686 :displaced-to (source-note-%text source-note) 1687 :displaced-index-offset (- (source-note-start nested) 1688 (source-note-start source-note))))) 1689 (compute-children-text nested nil))) 1690 source-note) 1691 1677 1692 (defun nx1-source-note (nx1-code) 1678 1693 "Return the source-note for the form which generated NX1-CODE." … … 1694 1709 (loop 1695 1710 for pc-map across pc-source-map 1696 for pc-start = ( aref pc-map 0)1697 for pc-end = ( aref pc-map 1)1711 for pc-start = (pc-source-map-pc-start pc-map) 1712 for pc-end = (pc-source-map-pc-end pc-map) 1698 1713 do (when (and (<= pc-start pc pc-end) 1699 1714 (or (null best-guess) … … 1702 1717 best-length (- pc-end pc-start)))) 1703 1718 (when best-guess 1704 (list :pc-range (cons ( aref best-guess 0)1705 ( aref best-guess 1))1706 :source-text-range (cons ( aref best-guess 2)1707 ( aref best-guess 3))1719 (list :pc-range (cons (pc-source-map-pc-start best-guess) 1720 (pc-source-map-pc-end best-guess)) 1721 :source-text-range (cons (pc-source-map-text-start best-guess) 1722 (pc-source-map-text-end best-guess)) 1708 1723 :file-name (getf function-source-note :file-name) 1709 1724 :text (getf function-source-note :text))))))) -
branches/working-0711/ccl/level-1/l1-reader.lisp
r8424 r8439 2503 2503 (values form 2504 2504 t 2505 (when (and (consp form) (record-source-location-on-stream-p stream)) 2505 (when (and (not (eql t nested-source-notes)) 2506 (consp form) 2507 (record-source-location-on-stream-p stream)) 2508 ;; mb 2008-02-07: sometime the nested-source-notes end with t, don't know 2509 ;; why. don't really care here. 2510 2511 (let ((last (last nested-source-notes))) 2512 (when (atom (cdr last)) 2513 ;; dotted list. 2514 (setf (cdr last) (list (cdr last))))) 2506 2515 (make-source-note :stream stream 2507 2516 :start (1- start) 2508 2517 :end end 2509 2518 :form (car vals) 2510 :children (labels ((rec (note) 2511 ;; use this recursive function to 2512 ;; remove nils since 2513 ;; nested-source-notes can be a 2514 ;; dotted list or an atom 2515 (cond 2516 ((consp note) 2517 (if (null (car note)) 2518 (rec (cdr note)) 2519 (cons (car note) (rec (cdr note))))) 2520 ((source-note-p note) 2521 note) 2522 #| ((null note) '()) 2523 (t (error "Don't know how to deal with a source note like ~S." 2524 nested-source-notes)) |# ))) 2525 (rec nested-source-notes))))))))))) 2519 :children nested-source-notes))))))))) 2526 2520 2527 2521 #| 2528 2522 (defun %parse-expression-test (string) 2529 (let* ((stream (make-string-input-stream string)))2530 (%parse-expression stream (read-char stream t) nil)))2523 (let* ((stream (make-string-input-stream string))) 2524 (%parse-expression stream (read-char stream t) nil))) 2531 2525 2532 2526 (%parse-expression-test ";hello") -
branches/working-0711/ccl/lib/nfcomp.lisp
r8421 r8439 425 425 (return)) 426 426 (setf form -form 427 *definition-source-note* source-note428 *form-source-note-map* (make-source-note-form-map source-note427 *definition-source-note* (compute-children-text source-note *fcomp-stream*) 428 *form-source-note-map* (make-source-note-form-map *definition-source-note* 429 429 *form-source-note-map*)))))) 430 430 (fcomp-form form env processing-mode) … … 497 497 (record-form-source-equivalent/list form body) 498 498 (fcomp-macrolet body env processing-mode)) 499 ;; special case for passing around source-location info500 (%source-note (fcomp-form (list 'quote (source-note-to-list *definition-source-note*))501 env processing-mode))502 499 ((%include include) (fcomp-include form env processing-mode)) 503 500 (t
Note:
See TracChangeset
for help on using the changeset viewer.
