source: trunk/source/level-1/level-1.lisp @ 11373

Last change on this file since 11373 was 11373, checked in by gz, 11 years ago

Finish source location and pc -> source mapping support, from working-0711 but with some modifications.


Source location are recorded in CCL:SOURCE-NOTE's, which are objects with accessors CCL:SOURCE-NOTE-FILENAME, CCL:SOURCE-NOTE-START-POS, CCL:SOURCE-NOTE-END-POS and CCL:SOURCE-NOTE-TEXT. The start and end positions are file positions (not character positions). The text will be NIL unless text recording was on at read-time. If the original file is still available, you can force missing source text to be read from the file at runtime via CCL:ENSURE-SOURCE-NOTE-TEXT.

Source-note's are associated with definitions (via record-source-file) and also stored in function objects (including anonymous and nested functions). The former can be retrieved via CCL:FIND-DEFINITION-SOURCES, the latter via CCL:FUNCTION-SOURCE-NOTE.

The recording behavior is controlled by the new variable CCL:*SAVE-SOURCE-LOCATIONS*:

If NIL, don't store source-notes in function objects, and store only the filename for definitions (the latter only if *record-source-file* is true).
If T, store source-notes, including a copy of the original source text, for function objects and definitions (the latter only if *record-source-file* is true).
If :NO-TEXT, store source-notes, but without saved text, for function objects and defintions (the latter only if *record-source-file* is true). This is the default.

PC to source mapping is controlled by the new variable CCL:*RECORD-PC-MAPPING*. If true (the default), functions store a compressed table mapping pc offsets to corresponding source locations. This can be retrieved by (CCL:FIND-SOURCE-NOTE-AT-PC function pc) which returns a source-note for the source at offset pc in the function.

Currently the only thing that makes use of any of this is the disassembler. ILISP and current version of Slime still use backward-compatible functions that deal with filenames only. The plan is to make Slime, and our IDE, use this eventually.

Known bug: most of this only works through the file compiler. Still need to make it work with loading from source (not hard, just haven't gotten to it yet).

This checkin incidentally includes bits and pieces of support for code coverage, which is still
incomplete and untested. Ignore it.

The PPC version is untested. I need to check it in so I can move to a PPC for testing.


18387152 Nov 16 10:00 lx86cl64.image-no-loc-no-pc
19296464 Nov 16 10:11 lx86cl64.image-loc-no-text-no-pc
20517072 Nov 16 09:58 lx86cl64.image-loc-no-text-with-pc [default]
25514192 Nov 16 09:55 lx86cl64.image-loc-with-text-with-pc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
1;;-*-Mode: LISP; Package: CCL -*-
3;;;   Copyright (C) 1994-2001 Digitool, Inc
4;;;   This file is part of OpenMCL. 
6;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with OpenMCL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
12;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
14;;;   The LLGPL is also available online at
17; Level-1.lisp
19(in-package "CCL")
21(macrolet ((l1-load (name)
22             (let* ((namestring
23                     (concatenate 'simple-base-string
24                                  "./l1-fasls/"
25                                  (string name)
26                                  (namestring (backend-target-fasl-pathname
27                                               *target-backend*)))))
28               `(%fasload ,namestring)))
29           (bin-load (name)
30             (let* ((namestring
31                     (concatenate 'simple-base-string
32                                  "./bin/"
33                                  (string name)
34                                  (namestring (backend-target-fasl-pathname
35                                               *target-backend*)))))
36               `(%fasload ,namestring))))
38  (l1-load "l1-cl-package")
39  (l1-load "l1-utils")
40  (l1-load "l1-init")
41  (l1-load "l1-symhash")
42  (l1-load "l1-numbers")
43  (l1-load "l1-aprims")
44  #+ppc-target
45  (l1-load "ppc-callback-support")
46  #+x86-target
47  (l1-load "x86-callback-support")
48  (l1-load "l1-callbacks")
49  (l1-load "l1-sort")
50  (bin-load "lists")
51  (bin-load "sequences")
52  (l1-load "l1-dcode")
53  (l1-load "l1-clos-boot")
54  (bin-load "hash")
55  (l1-load "l1-clos")
56  (bin-load "defstruct")
57  (bin-load "dll-node")
58  (l1-load "l1-unicode")
59  (l1-load "l1-streams")
60  (l1-load "linux-files")
61  (bin-load "chars")
62  (l1-load "l1-files")
63  (provide "SEQUENCES")
64  (provide "DEFSTRUCT")
65  (provide "CHARS")
66  (provide "LISTS")
67  (provide "DLL-NODE")
68  (l1-load "l1-typesys")
69  (l1-load "sysutils")
70  #+ppc-target
71  (l1-load "ppc-threads-utils")
72  #+x86-target
73  (l1-load "x86-threads-utils")
74  (l1-load "l1-lisp-threads")
75  (l1-load "l1-application")
76  (l1-load "l1-processes")
77  (l1-load "l1-io")
78  (l1-load "l1-reader")
79  (l1-load "l1-readloop")
80  (l1-load "l1-readloop-lds")
81  (l1-load "l1-error-system")
83  (l1-load "l1-events")
84  #+ppc-target
85  (l1-load "ppc-trap-support")
86  #+x86-target
87  (l1-load "x86-trap-support")
88  (l1-load "l1-format")
89  (l1-load "l1-sysio")
90  (l1-load "l1-pathnames")
91  (l1-load "l1-boot-lds")
93  (l1-load "l1-boot-1")
94  (l1-load "l1-boot-2")
95  (l1-load "l1-boot-3")
97  ;; Without this, forms from the -e command line parameter would run with
98  ;; *loading-file-source-file* set to "l1-boot-3".
99  (setq *loading-file-source-file* nil)
100  (setq *loading-toplevel-location* nil)
101  )
105  (%set-toplevel #'toplevel-loop)
106  (set-user-environment t)
107  (toplevel))
Note: See TracBrowser for help on using the repository browser.