The “byte-code” is a special representation that is executed by Emacs VM. The Emacs VM is a simple stack-machine interpreter. This page collects informations for byte-code and Emacs VM.


The byte-code is translated by the Emacs Lisp compiler. See the documentation for byte compiling: CompiledFile and Info (Elisp, Section 16, Byte Compilation).


See the emacs lisp and C sources for byte-code spec and VM details: bytecomp.el, disass.el and bytecode.c.

Instruction Table

Here is the Emacs VM instruction table for 23.3. (Collected from bytecomp.el and bytecode.c)

OPCODEInstructionOperandsStack INStack OutNote
0stack_ref stack_ref+0 → dup.
+N: stack_ref+0..5var
+6: stack_ref+6index8var
+7: stack_ref+7index16var
+N: varref+0..5var
+6: varref+6index8var
+7: varref+7index16var
+N: varset+0..5var
+6: varset+6index8var
+7: varset+7index16var
030varbind let, specbind
+N: varbind+0..5var
+6: varbind+6index8var
+7: varbind+7index16var
+N: call+0..5func,args..retval
+6: call+6num8func,args..retval
+7: call+7num16func,args..retval
050unbind unbind_to
+N: unbind+0..5
+6: unbind+6num8
+7: unbind+7num16
070nth num, list val
071symbolp val result
072consp val result
073stringp val result
074listp val result
075eq val1, val2result
076memq list, elm result
077not val result
0100car cell car
0101cdr cell cdr
0102cons cdr,car cons
0103list1elm list
0107length list length
0110aref array, num val
0111aset array,num,val val
0112symbol_value sym val
0113symbol_function sym val
0114set val, sym val
0115fset val, sym val
0116get prop, sym val
0117substring to,from,str result
0123sub1num result
0124add1num result
0125eqlsign num2,num1result
0126gtr right,left result
0127lss right,left result
0130leq right,left result
0131geq right,left result
0132diff right,left result
0133negate num result
0134plus right,left result
0135max num1,num2result
0136min num1,num2result
0137mult right,left result
0140point point Was Bmark in v17.
0141save_current_buffer Obsolete.
0142goto_char point point
0143insert string string
0144point_max point
0145point_min point
0146char_after point result
0147following_char result
0150preceding_char result
0151current_column result
0152indent_to num result
0153scan_buffer (error)No longer generated as of v18
0154eolp result
0155eobp result
0156bolp result
0157bobp result
0160current_buffer buf
0161set_buffer buf buf
0162save_current_buffer_1Replacing Bsave_current_buffer. record_unwind_protect
0162read_char No longer generated as of v19
0163set_mark (error)this loser is no longer generated as of v18
0164interactive_p result Obsolete.
0165forward_char num nil
0166forward_word num result
0167skip_chars_forward limit,string result
0170skip_chars_backward limit,string result
0171forward_line num result
0172char_syntax char result
0173buffer_substring end,start result
0174delete_region end,start nil
0175narrow_to_region end,start nil
0176widen nil
0177end_of_line num nil
0202goto dst16quit
0203gotoifnil dst16val
0204gotoifnonnil dst16val
0205gotoifnilelsepop dst16val
0206gotoifnonnilelsepop dst16val
0207return result goto exit
0210discard discard
0211dup val val1,val2
0212save_excursion record_unwind_protect
0213save_window_excursion result Obsolete. record_unwind_protect / progn
0214save_restriction record_unwind_protect / save_restriction_save
0215catch tag result internal_catch / eval_sub
0216unwind_protect finally record_unwind_protect / progn
0217condition_case handlers,body result
0220temp_output_buffer_setup bufname buf Obsolete.
0221temp_output_buffer_show val,buf val Obsolete. unbind_to
0222unbind_all Obsolete. unbind_to → count
0223set_marker buf,pos,marker marker
0224match_beginning subexp result
0225match_end subexp result
0226upcase obj result
0227downcase obj result
0230stringeqlsign str2,str1result
0231stringlss str2,str1result
0232equal obj2,obj1result
0233nthcdr list,num result
0234elt num,seq result
0235member list,elt result
0236assq list,key result
0237nreverse list result
0240setcar val,cell result
0241setcdr val,cell result
0242car_safe obj result
0243cdr_safe obj result
0244nconc list2,list1result
0245quo right,left result /
0246rem right,left result %
0247numberp obj result
0250integerp obj result
0252Rgoto raddr8relative jump : raddr - 127
0253Rgotoifnil raddr8var relative jump : raddr - 127
0254Rgotoifnonnil raddr8var relative jump : raddr - 127
0255Rgotoifnilelsepop raddr8var relative jump : raddr - 127
0256Rgotoifnonnilelsepop raddr8var relative jump : raddr - 127
0257listN num8values list
0260concatN num8values result
0261insertN num8values nil
0262stack_set num8value stack_ref is code 0
0266discardN num8
+N: constant value


-Assembler for Emacs' bytecode interpreter