On Thu, Mar 19, 2020 at 1:56 PM Andrea Corallo wrote: > Stefan Monnier writes: > > > It should be easy (much smaller than a summer project) to change the > > C code so that a bytecode offset can be extracted from the backtrace. > > > > The harder and more interesting part is how to propagate source > > information (line numbers and/or lexical variable names and location) to > > byte-code. There are many parts to this, so it's definitely possible to > > get some summer project(s) out of it. E.g. one such project is to change > > the reader so it outputs "fat cons cells" (i.e. cons-cells with line-num > > info), then arrange for that info to survive `macroexpand-all` and > > `cconv.el`. That could already be used to give more precise line > > numbers in bytecompiler warnings. > > > > Another is to devise a way to annotate bytecode objects with a map from > > byte-offsets to information about the lexical vars in-scope at that point > > and their location (i.e. position in the stack or in the closure). > > And then teach Emacs's debugger to use that info. > > > >> But enough about me. What is most in need of help in GNU Emacs that a > >> summer student might reasonably make progress on? > > > > I'm sure there are lots of desires. One I'd suggest is to introduce an > > "object description" that can be used both by the GC and pdump code (and > > maybe also by `equal` and `print--preprocess`?), so that when changing > > the representation of objects or introducing new types we don't have to > > make corresponding changes in so many different places. XEmacs had such > > a thing, so there's previous experience on which we can build. > > It could also be a step towards replacing our GC with one that's > > incremental such the one in XEmacs (or even better: concurrent, unlike > > that of XEmacs). > > > > > > Stefan > > It's probably definitely early to discuss but can't resist. > > Do we really need some dedicated low level object? This should be all > overhead that disappears with compilation anyway. > > Also wanted to ask, am I wrong or something has been attempted in this > field? > In the bit that I have come across looking over byteocde work and history e,g. see http://rocky.github.io/elisp-bytecode.pdf it has become extremely clear that there are precious few who understand how the bytecode and runtime system work. And the people who wrote this initially, e.g. rms, and later jwz, no longer do so. No slight to Stefan, Jim Blandy, Paul Eggert or Tom Tromey, but if nothing else we need a new generation of people to pick up the torch and carry on. > > I'm quite curious on this because the day we get source locations > crossing byte-code we could use the native compiler also as a diagnostic > tool. > > Andrea > > -- > akrl@sdf.org >