GithubHelp home page GithubHelp logo

rocky / elisp-bytecode Goto Github PK

View Code? Open in Web Editor NEW
178.0 178.0 11.0 508 KB

Let's document Emacs Lisp Bytecode (Lisp Assembly Program) instructions

Makefile 6.60% Emacs Lisp 93.40%
bytecode decompiler elisp gnu-emacs

elisp-bytecode's Issues

`goto` has no stack effects

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;

Are/were the relative goto instructions ever emitted?

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.

switch instruction doesn't jump to an offset

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.

Page numbers

Any chance of adding page numbers on the ready-made PDF?

Thanks.

`call` opcode documentation incorrect?

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

Typos

"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.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.