Commit b9598260 authored by Stefan Monnier's avatar Stefan Monnier

New branch for lexbind, losing all history.

This initial patch is based on 2002-06-27T22:39:10Z!storm@cua.dk of the original
lexbind branch.
parent a6e8d97c
......@@ -248,7 +248,7 @@ Programming Types
* Macro Type:: A method of expanding an expression into another
expression, more fundamental but less pretty.
* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Funvec Type:: A vector type callable as a function.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
......@@ -463,10 +463,11 @@ Functions
* Inline Functions:: Defining functions that the compiler
will open code.
* Declaring Functions:: Telling the compiler that a function is defined.
* Function Currying:: Making wrapper functions that pre-specify
some arguments.
* Function Safety:: Determining whether a function is safe to call.
* Related Topics:: Cross-references to specific Lisp primitives
that have a special bearing on how
functions work.
that have a special bearing on how functions work.
Lambda Expressions
......
......@@ -22,7 +22,9 @@ define them.
* Function Cells:: Accessing or setting the function definition
of a symbol.
* Obsolete Functions:: Declaring functions obsolete.
* Inline Functions:: Defining functions that the compiler will open code.
* Inline Functions:: Defining functions that the compiler will open code.
* Function Currying:: Making wrapper functions that pre-specify
some arguments.
* Declaring Functions:: Telling the compiler that a function is defined.
* Function Safety:: Determining whether a function is safe to call.
* Related Topics:: Cross-references to specific Lisp primitives
......@@ -111,7 +113,25 @@ editors; for Lisp programs, the distinction is normally unimportant.
@item byte-code function
A @dfn{byte-code function} is a function that has been compiled by the
byte compiler. @xref{Byte-Code Type}.
byte compiler. A byte-code function is actually a special case of a
@dfn{funvec} object (see below).
@item function vector
A @dfn{function vector}, or @dfn{funvec} is a vector-like object whose
purpose is to define special kinds of functions. @xref{Funvec Type}.
The exact meaning of the vector elements is determined by the type of
funvec: the most common use is byte-code functions, which have a
list---the argument list---as the first element. Further types of
funvec object are:
@table @code
@item curry
A curried function. Remaining arguments in the funvec are function to
call, and arguments to prepend to user arguments at the time of the
call; @xref{Function Currying}.
@end table
@end table
@defun functionp object
......@@ -152,6 +172,11 @@ function. For example:
@end example
@end defun
@defun funvecp object
@code{funvecp} returns @code{t} if @var{object} is a function vector
object (including byte-code objects), and @code{nil} otherwise.
@end defun
@defun subr-arity subr
This function provides information about the argument list of a
primitive, @var{subr}. The returned value is a pair
......@@ -1277,6 +1302,49 @@ do for macros. (@xref{Argument Evaluation}.)
Inline functions can be used and open-coded later on in the same file,
following the definition, just like macros.
@node Function Currying
@section Function Currying
@cindex function currying
@cindex currying
@cindex partial-application
Function currying is a way to make a new function that calls an
existing function with a partially pre-determined argument list.
@defun curry function &rest args
Return a function-like object that will append any arguments it is
called with to @var{args}, and call @var{function} with the resulting
list of arguments.
For example, @code{(curry 'concat "The ")} returns a function that
concatenates @code{"The "} and its arguments. Calling this function
on @code{"end"} returns @code{"The end"}:
@example
(funcall (curry 'concat "The ") "end")
@result{} "The end"
@end example
The @dfn{curried function} is useful as an argument to @code{mapcar}:
@example
(mapcar (curry 'concat "The ") '("big" "red" "balloon"))
@result{} ("The big" "The red" "The balloon")
@end example
@end defun
Function currying may be implemented in any Lisp by constructing a
@code{lambda} expression, for instance:
@example
(defun curry (function &rest args)
`(lambda (&rest call-args)
(apply #',function ,@@args call-args)))
@end example
However in Emacs Lisp, a special curried function object is used for
efficiency. @xref{Funvec Type}.
@node Declaring Functions
@section Telling the Compiler that a Function is Defined
@cindex function declaration
......
......@@ -157,7 +157,7 @@ latter are unique to Emacs Lisp.
* Macro Type:: A method of expanding an expression into another
expression, more fundamental but less pretty.
* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Funvec Type:: A vector type callable as a function.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
@end menu
......@@ -1315,18 +1315,55 @@ with the name of the subroutine.
@end group
@end example
@node Byte-Code Type
@subsection Byte-Code Function Type
@node Funvec Type
@subsection ``Function Vector' Type
@cindex function vector
@cindex funvec
The byte compiler produces @dfn{byte-code function objects}.
Internally, a byte-code function object is much like a vector; however,
the evaluator handles this data type specially when it appears as a
function to be called. @xref{Byte Compilation}, for information about
the byte compiler.
A @dfn{function vector}, or @dfn{funvec} is a vector-like object whose
purpose is to define special kinds of functions. You can examine or
modify the contents of a funvec like a normal vector, using the
@code{aref} and @code{aset} functions.
The printed representation and read syntax for a byte-code function
object is like that for a vector, with an additional @samp{#} before the
opening @samp{[}.
The behavior of a funvec when called is dependent on the kind of
funvec it is, and that is determined by its first element (a
zero-length funvec will signal an error if called):
@table @asis
@item A list
A funvec with a list as its first element is a byte-compiled function,
produced by the byte compiler; such funvecs are known as
@dfn{byte-code function objects}. @xref{Byte Compilation}, for
information about the byte compiler.
@item The symbol @code{curry}
A funvec with @code{curry} as its first element is a ``curried function''.
The second element in such a funvec is the function which is
being curried, and the remaining elements are a list of arguments.
Calling such a funvec operates by calling the embedded function with
an argument list composed of the arguments in the funvec followed by
the arguments the funvec was called with. @xref{Function Currying}.
@end table
The printed representation and read syntax for a funvec object is like
that for a vector, with an additional @samp{#} before the opening
@samp{[}.
@defun funvecp object
@code{funvecp} returns @code{t} if @var{object} is a function vector
object (including byte-code objects), and @code{nil} otherwise.
@end defun
@defun funvec kind &rest params
@code{funvec} returns a new function vector containing @var{kind} and
@var{params}. @var{kind} determines the type of funvec; it should be
one of the choices listed in the table above.
Typically you should use the @code{make-byte-code} function to create
byte-code objects, though they are a type of funvec.
@end defun
@node Autoload Type
@subsection Autoload Type
......@@ -1773,7 +1810,7 @@ with references to further information.
@xref{Buffer Basics, bufferp}.
@item byte-code-function-p
@xref{Byte-Code Type, byte-code-function-p}.
@xref{Funvec Type, byte-code-function-p}.
@item case-table-p
@xref{Case Tables, case-table-p}.
......
......@@ -268,7 +268,7 @@ Programming Types
* Macro Type:: A method of expanding an expression into another
expression, more fundamental but less pretty.
* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Funvec Type:: A vector type callable as a function.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
......
......@@ -267,7 +267,7 @@ Programming Types
* Macro Type:: A method of expanding an expression into another
expression, more fundamental but less pretty.
* Primitive Function Type:: A function written in C, callable from Lisp.
* Byte-Code Type:: A function written in Lisp, then compiled.
* Funvec Type:: A vector type callable as a function.
* Autoload Type:: A type used for automatically loading seldom-used
functions.
......
GNU Emacs NEWS -- history of user-visible changes.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
See the end of the file for license conditions.
Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
If possible, use M-x report-emacs-bug.
This file is about changes in the Emacs "lexbind" branch.
* Lisp changes in Emacs 23.1
** New `function vector' type, including function currying
The `function vector', or `funvec' type extends the old
byte-compiled-function vector type to have other uses as well, and
includes existing byte-compiled functions as a special case. The kind
of funvec is determined by the first element: a list is a byte-compiled
function, and a non-nil atom is one of the new extended uses, currently
`curry' for curried functions. See the node `Funvec Type' in the Emacs
Lisp Reference Manual for more information.
*** New function curry allows constructing `curried functions'
(see the node `Function Currying' in the Emacs Lisp Reference Manual).
*** New functions funvec and funvecp allow primitive access to funvecs
----------------------------------------------------------------------
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
Local variables:
mode: outline
paragraph-separate: "[ ]*$"
end:
arch-tag: d5ab31ab-2041-4b15-a1a9-e7c42693060c
2004-05-20 Miles Bader <miles@gnu.org>
* subr.el (functionp): Use `funvecp' instead of
`byte-compiled-function-p'.
* help-fns.el (describe-function-1): Describe curried functions
and other funvecs as such.
(help-highlight-arguments): Only format things that look like a
function.
;; arch-tag: 87f75aac-de53-40d7-96c7-3befaa771cb1
2006-12-04 Miles Bader <miles@gnu.org>
* Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
(compile, compile-always): Use it.
2005-10-24 Miles Bader <miles@gnu.org>
* subr.el (functionp): Re-remove.
* emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
(byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
instead of adding lambda ourselves.
2004-08-09 Miles Bader <miles@gnu.org>
Changes from merging the funvec patch:
* emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
instead of `vector' to create compiled closures.
Merge funvec patch.
2004-04-29 Miles Bader <miles@gnu.org>
* emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
to `byte-compile-lexical-environment' at the start, not end.
(byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
* emacs-lisp/byte-opt.el (byte-opt-update-stack-params): Don't
crash on no-op lapcode entries (car is nil).
* emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
Push a lexvar onto lexenv, not a vinfo!
2004-04-11 Miles Bader <miles@gnu.org>
* emacs-lisp/bytecomp.el (byte-compile-top-level): Correctly
analyze lexically-bound arguments.
* emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
Use `append' instead of `nconc'.
* emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo): Don't
use backquote to make a mutable data-structure.
(byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
Renamed to use `num-' instead of `num'.
(byte-compile-make-lambda-lexenv): Adjusted accordingly.
2004-04-10 Miles Bader <miles@gnu.org>
* emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
Look at variable's global specialp state too.
2004-04-09 Miles Bader <miles@gnu.org>
* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Default
initial-stack-depth to 0.
(byte-optimize-lapcode): Discard the right number of values in
the stack-set+discard-->discard optimization.
2004-04-02 Miles Bader <miles@gnu.org>
* emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
environment if lexical-binding is enabled.
2003-10-14 Miles Bader <miles@gnu.org>
* emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
`backquote-list*' to avoid stack overflows.
2003-04-04 Miles Bader <miles@gnu.org>
* help-fns.el (help-function-arglist): Handle interpreted closures.
2002-11-20 Miles Bader <miles@gnu.org>
* emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
Correctly handle discardN* operators.
* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
tracking errors.
2002-08-26 Miles Bader <miles@gnu.org>
* international/mule.el (make-char): Macroexpand call to
charset-id constructed by `byte-compile' hook.
* emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
* emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
(byte-optimize-lapcode): Keep track of stack-depth in final pass too.
Add more optimizations for lexical binding.
(byte-compile-inline-expand): Macroexpand result of inlining.
* emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
byte-compile-closure-initial-lexenv-p.
(byte-discardN-preserve-tos): Alias to byte-discardN.
(byte-compile-push-binding-init): Don't push unused variables on
init-lexenv.
(byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
(byte-compile-lambda): Don't look at lexical environment unless
we're using lexical binding.
(byte-compile-defmacro): Correctly generate macros.
* emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
dynamic-bindings-only case.
(byte-compile-bind): Don't special-case unused lexical variables.
* emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
2002-08-19 Miles Bader <miles@gnu.org>
* emacs-lisp/byte-opt.el (byte-decompile-bytecode-1): Handle
`byte-discardN-preserve-tos' pseudo-op.
(byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
(byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
(byte-optimize-lapcode): Add some cases for stack-set/ref ops.
Add tracking of stack-depth. Unfinished code to collapse
lexical-unbinding sequences.
* emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle
`byte-discardN-preserve-tos' pseudo-op.
(byte-compile-top-level): If there are lexical args, output a TAG
op to record the initial stack-depth for the optimizer.
2002-08-17 Miles Bader <miles@gnu.org>
* emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
(byte-compile-lapcode): Include byte-discardN.
(byte-compile-lambda): Fixup closure detection.
(byte-compile-top-level): Handle arguments for a lexical lambda.
(byte-compile-lexical-variable-ref, byte-compile-variable-ref)
(byte-compile-variable-set): Use byte-compile-stack-set/ref.
(byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
(byte-compile-stack-ref, byte-compile-stack-set): New functions.
(byte-compile-push-binding-init): Get the variable list properly
from LFORMINFO.
* emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
Ignore setq'd variables we're not interested in.
(byte-compile-make-lambda-lexenv): Add assertion that closed-over
variables be heap allocated.
(byte-compile-closure-initial-lexenv-p): Renamed from
byte-compile-closure-lexenv-p.
(byte-compile-non-stack-bindings-p): Get the variable list
properly from LFORMINFO.
(byte-compile-maybe-push-heap-environment): Handle the
no-closed-over-variables case correctly.
(byte-compile-bind): Use byte-compile-stack-set/ref.
Don't bother modifying INIT-LEXENV as no one will see the changes.
(byte-compile-unbind): Call `byte-compile-discard' to handle
unbinding lexical bindings.
* emacs-lisp/disass.el (disassemble-internal): Handle closures.
(disassemble-1): Handle new bytecodes.
* emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
2002-06-16 Miles Bader <miles@gnu.org>
* emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
(macroexpand-all-forms, macroexpand-all-clauses): Use it.
* Makefile.in (compile): Undo previous change.
2002-06-14 Miles Bader <miles@gnu.org>
* Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
(compile): Add a special case that compiles `emacs-lisp/macroexp.el'
with an increased max-lisp-eval-depth.
* emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
beginning of the file. Require `byte-lexbind' at compile time.
Add a few doc string.
(byte-compile-push-bytecodes)
(byte-compile-push-bytecode-const2): New macros.
(byte-compile-lapcode): Use them. Do general code cleanup.
(byte-compile-initial-macro-environment): Expand macros in
byte-compile-eval before passing to byte-compile-top-level.
(byte-compile): Use the `byte-compile-initial-macro-environment'.
* emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
`bytecomp'.
(byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
dynamic variables.
(byte-compile-maybe-push-heap-environment): Fix function name typo.
2002-06-13 Miles Bader <miles@gnu.org>
Byte compiler lexical binding support (not finished yet):
* emacs-lisp/bytecomp.el: Require `macroexp'.
(byte-compile-lexical-environment)
(byte-compile-current-heap-environment)
(byte-compile-current-num-closures): New variables.
(0, 178, 179, 180, 181): New byte-opcodes.
(byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
error if a delay-output placeholder is not filled in yet.
(byte-compile-file-form, byte-compile): Expand all macros with
`macroexpand-all'.
(byte-compile-file-form-defsubst, byte-compile-form): Don't expand
macros here.
(byte-compile-make-lambda-lexenv): Autoload.
(byte-compile-lambda): Initial code for handling lexically-bound
arguments and closures; doesn't work yet.
(byte-compile-closure-code-p, byte-compile-make-closure)
(byte-compile-closure): New functions.
(byte-compile-check-variable, byte-compile-dynamic-variable-op)
(byte-compile-dynamic-variable-bind)
(byte-compile-lexical-variable-ref, byte-compile-variable-set):
New functions.
(byte-compile-variable-ref): Remove second argument. Now only
handles real variable references (not setting or binding).
(byte-compile-push-unknown-constant)
(byte-compile-resolve-unknown-constant): New functions.
(byte-compile-funarg, byte-compile-funarg-2): Functions removed.
(byte-compile-function-form): Use either `byte-compile-constant'
or `byte-compile-closure'.
(byte-compile-setq): Use `byte-compile-variable-set' instead of
`byte-compile-variable-ref'.
(apply, mapcar, mapatoms, mapconcat, mapc, sort):
`byte-defop-compiler-1's removed.
(byte-compile-while): Make sure lexically-bound variables inside
the loop don't get stored in an environment outside the loop.
(byte-compile-compute-lforminfo): Autoload.
(byte-compile-push-binding-init): New function.
(byte-compile-let, byte-compile-let*): Handle lexical binding.
(byte-compile-defun): Use `byte-compile-closure' to do the work.
(byte-compile-defmacro): Use `byte-compile-make-closure'.
(byte-compile-defvar): Expand the generated call to `push' since
we're past macroexpansion already.
(byte-compile-stack-adjustment): New function.
(byte-compile-out): Make second arg optional. Rewrite for clarity.
(byte-compile-delay-out, byte-compile-delayed-out): New functions.
* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't
expand macros here.
* emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
* emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
(byte-compile-lforminfo-add-var)
(byte-compile-lforminfo-note-closure)
(byte-compile-compute-lforminfo)
(byte-compile-lforminfo-from-lambda)
(byte-compile-lforminfo-analyze)
(byte-compile-heapenv-add-accessible-env)
(byte-compile-heapenv-ensure-access)
(byte-compile-rearrange-let-clauses, byte-compile-bind)
(byte-compile-unbind): Fix a bunch of typos.
2002-06-12 Miles Bader <miles@gnu.org>
* emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
* subr.el (functionp): Function removed (now a subr).
* help-fns.el (describe-function-1): Handle interpreted closures.
;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70
......@@ -71,6 +71,13 @@ AUTOGENEL = loaddefs.el \
cedet/ede/loaddefs.el \
cedet/srecode/loaddefs.el
# Value of max-lisp-eval-depth when compiling initially.
# During bootstrapping the byte-compiler is run interpreted when compiling
# itself, and uses more stack than usual.
#
BIG_STACK_DEPTH = 1000
BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))"
# Files to compile before others during a bootstrap. This is done to
# speed up the bootstrap process.
......@@ -195,7 +202,7 @@ compile-onefile:
@echo Compiling $(THEFILE)
@# Use byte-compile-refresh-preloaded to try and work around some of
@# the most common bootstrapping problems.
@$(emacs) -l bytecomp -f byte-compile-refresh-preloaded $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(THEFILE)
@$(emacs) -l bytecomp.el -f byte-compile-refresh-preloaded $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(THEFILE)
# Files MUST be compiled one by one. If we compile several files in a
# row (i.e., in the same instance of Emacs) we can't make sure that
......
This diff is collapsed.
......@@ -186,8 +186,8 @@
(eval-when-compile (require 'cl))
(defun byte-compile-log-lap-1 (format &rest args)
(if (aref byte-code-vector 0)
(error "The old version of the disassembler is loaded. Reload new-bytecomp as well"))
;; (if (aref byte-code-vector 0)
;; (error "The old version of the disassembler is loaded. Reload new-bytecomp as well"))
(byte-compile-log-1
(apply 'format format
(let (c a)
......@@ -281,7 +281,8 @@
(byte-code ,string ,(aref fn 2) ,(aref fn 3)))
(cdr form)))
(if (eq (car-safe fn) 'lambda)
(cons fn (cdr form))
(macroexpand-all (cons fn (cdr form))
byte-compile-macro-environment)
;; Give up on inlining.
form))))))
......@@ -1332,14 +1333,15 @@
((>= op byte-constant)
(prog1 (- op byte-constant) ;offset in opcode
(setq op byte-constant)))
((and (>= op byte-constant2)
(<= op byte-goto-if-not-nil-else-pop))
((or (and (>= op byte-constant2)
(<= op byte-goto-if-not-nil-else-pop))
(= op byte-stack-set2))
(setq ptr (1+ ptr)) ;offset in next 2 bytes
(+ (aref bytes ptr)
(progn (setq ptr (1+ ptr))
(lsh (aref bytes ptr) 8))))
((and (>= op byte-listN)
(<= op byte-insertN))
(<= op byte-discardN))
(setq ptr (1+ ptr)) ;offset in next byte
(aref bytes ptr))))
......@@ -1400,7 +1402,16 @@
(if (= ptr (1- length))
(setq op nil)
(setq offset (or endtag (setq endtag (byte-compile-make-tag)))
op 'byte-goto))))
op 'byte-goto)))
((eq op 'byte-stack-set2)
(setq op 'byte-stack-set))
((and (eq op 'byte-discardN) (>= offset #x80))
;; The top bit of the operand for byte-discardN is a flag,
;; saying whether the top-of-stack is preserved. In
;; lapcode, we represent this by using a different opcode
;; (with the flag removed from the operand).
(setq op 'byte-discardN-preserve-tos)
(setq offset (- offset #x80))))
;; lap = ( [ (pc . (op . arg)) ]* )
(setq lap (cons (cons optr (cons op (or offset 0)))
lap))
......@@ -1456,7 +1467,7 @@
byte-cdr-safe byte-cons byte-list1 byte-list2 byte-point byte-point-max
byte-point-min byte-following-char byte-preceding-char
byte-current-column byte-eolp byte-eobp byte-bolp byte-bobp
byte-current-buffer byte-interactive-p))
byte-current-buffer byte-interactive-p byte-stack-ref))
(defconst byte-compile-side-effect-free-ops
(nconc
......@@ -1465,7 +1476,7 @@
byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate
byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax
byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt
byte-member byte-assq byte-quo byte-rem)
byte-member byte-assq byte-quo byte-rem byte-vec-ref)
byte-compile-side-effect-and-error-free-ops))
;; This crock is because of the way DEFVAR_BOOL variables work.
......@@ -1498,12 +1509,50 @@
;; The variable `byte-boolean-vars' is now primitive and updated
;; automatically by DEFVAR_BOOL.
(defmacro byte-opt-update-stack-params (stack-adjust stack-depth lap0 rest lap)
"...macro used by byte-optimize-lapcode..."
`(progn
(byte-compile-log-lap "Before %s [depth = %s]" ,lap0 ,stack-depth)
(cond ((eq (car ,lap0) 'TAG)
;; A tag can encode the expected stack depth.
(when (cddr ,lap0)
;; First, check to see if our notion of the current stack
;; depth agrees with this tag. We don't check at the
;; beginning of the function, because the presence of
;; lexical arguments means the first tag will have a