rocky / elisp-bytecode Goto Github PK
View Code? Open in Web Editor NEWLet's document Emacs Lisp Bytecode (Lisp Assembly Program) instructions
Let's document Emacs Lisp Bytecode (Lisp Assembly Program) instructions
Will probably require building older versions of Emacs
Are BRgoto etc. ever emitted? If no, were they, and in which versions?
I can't find any live code that would emit them, and I don't think they're disassembled properly. On the other hand, bytecode.c does seem to handle them.
Many opcodes are Emacs Lisp functions. Perhaps we should link back into the texinfo for those.
This is great! Thank you for doing it.
It would be even better if it was part of the documentation distributed with Emacs, no?
Is that the plan?
Any chance of adding page numbers on the ready-made PDF?
Thanks.
In the document:
1 byte for call[0] .. call[4]; 2 bytes for call[5], 8-bit operand; 3 bytes for call[6], 16-bit operand.
Apparently call[0]
to call[5]
should be 1 byte, call[6]
is 2 bytes and call[7]
is 3 byte
Hi,
switch-like jump table. Top of stack is a variable reference. Below that is ahash table mapping compared values to instructions offsets.
The hash table values aren't offsets, they're pc values.
So it's not:
pc = pc + ht.lookup(TOS);
It's:
pc = ht.lookup(TOS);
This is seen in bytecode.c
:
op_branch:
op -= pc - bytestr_data;
op_relative_branch:
pc += op;
NEXT;
Inlining the computation we get pc = pc + op - pc - byte_strdata == op - byte_strdata
.
"Stephan Monier" should be "Stefan Monnier". One 'f', Two 'n's.
(Assuming there aren't two people with extraordinarily-similar names with sufficient knowledge to have contributed to this particular project.)
The byte-code manual lists goto
as having a stack effect of -1+0
. However looking at the source this doesn't seem to correct. It does not pop at all. Unless I am missing something?
CASE (Bgoto):
op = FETCH2;
op_branch:
op -= pc - bytestr_data;
op_relative_branch:
if (BYTE_CODE_SAFE
&& ! (bytestr_data - pc <= op
&& op < bytestr_data + bytestr_length - pc))
emacs_abort ();
quitcounter += op < 0;
if (!quitcounter)
{
quitcounter = 1;
maybe_gc ();
maybe_quit ();
}
pc += op;
NEXT;
I think the attribution for the quote found lisp/emacs-lisp/byte-opt.el to Eric Naggum isn't correct. The bit about racehorses and pigs is from East of Eden but more significantly, I think Jamie Zawinski may be the one who added it and the bit about turbocharged VW bugs below it (in Lucid Emacs, presumably) since it's present in the initial checkin of the file by Jim Blandy circa Emacs 18/19.
What kinds of optimization are performed? When were they introduced? Examples of optimizations.
It doesn't appear to do anything, and it's not actually emitted...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.