bytecode.c 33.9 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1
/* Execution of byte code produced by bytecomp.el.
Paul Eggert's avatar
Paul Eggert committed
2
   Copyright (C) 1985-1988, 1993, 2000-2019 Free Software Foundation,
3
   Inc.
Jim Blandy's avatar
Jim Blandy committed
4 5 6

This file is part of GNU Emacs.

7
GNU Emacs is free software: you can redistribute it and/or modify
Jim Blandy's avatar
Jim Blandy committed
8
it under the terms of the GNU General Public License as published by
9 10
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
Jim Blandy's avatar
Jim Blandy committed
11 12 13 14 15 16 17

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
18
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
Jim Blandy's avatar
Jim Blandy committed
19

20
#include <config.h>
21

Jim Blandy's avatar
Jim Blandy committed
22
#include "lisp.h"
Paul Eggert's avatar
Paul Eggert committed
23
#include "blockinput.h"
24
#include "character.h"
25
#include "buffer.h"
Paul Eggert's avatar
Paul Eggert committed
26
#include "keyboard.h"
27
#include "ptr-bounds.h"
Jim Blandy's avatar
Jim Blandy committed
28
#include "syntax.h"
Stefan Monnier's avatar
Stefan Monnier committed
29
#include "window.h"
Jim Blandy's avatar
Jim Blandy committed
30

31 32 33 34 35
/* Work around GCC bug 54561.  */
#if GNUC_PREREQ (4, 3, 0)
# pragma GCC diagnostic ignored "-Wclobbered"
#endif

36 37 38 39 40 41 42 43
/* Define BYTE_CODE_SAFE true to enable some minor sanity checking,
   useful for debugging the byte compiler.  It defaults to false.  */

#ifndef BYTE_CODE_SAFE
# define BYTE_CODE_SAFE false
#endif

/* Define BYTE_CODE_METER to generate a byte-op usage histogram.  */
44
/* #define BYTE_CODE_METER */
Jim Blandy's avatar
Jim Blandy committed
45

Tom Tromey's avatar
Tom Tromey committed
46 47 48 49
/* If BYTE_CODE_THREADED is defined, then the interpreter will be
   indirect threaded, using GCC's computed goto extension.  This code,
   as currently implemented, is incompatible with BYTE_CODE_SAFE and
   BYTE_CODE_METER.  */
50
#if (defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __CHKP__ \
51
     && !BYTE_CODE_SAFE && !defined BYTE_CODE_METER)
Tom Tromey's avatar
Tom Tromey committed
52 53 54
#define BYTE_CODE_THREADED
#endif

Jim Blandy's avatar
Jim Blandy committed
55 56 57

#ifdef BYTE_CODE_METER

58 59
#define METER_2(code1, code2) \
  (*aref_addr (AREF (Vbyte_code_meter, code1), code2))
60
#define METER_1(code) METER_2 (0, code)
61

62 63 64 65
#define METER_CODE(last_code, this_code)				\
{									\
  if (byte_metering_on)							\
    {									\
Tom Tromey's avatar
Tom Tromey committed
66
      if (XFIXNAT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM)	\
67
        XSETFASTINT (METER_1 (this_code),				\
Tom Tromey's avatar
Tom Tromey committed
68
		     XFIXNAT (METER_1 (this_code)) + 1);		\
69
      if (last_code							\
Tom Tromey's avatar
Tom Tromey committed
70
	  && (XFIXNAT (METER_2 (last_code, this_code))			\
71 72
	      < MOST_POSITIVE_FIXNUM))					\
        XSETFASTINT (METER_2 (last_code, this_code),			\
Tom Tromey's avatar
Tom Tromey committed
73
		     XFIXNAT (METER_2 (last_code, this_code)) + 1);	\
74
    }									\
75
}
Jim Blandy's avatar
Jim Blandy committed
76

77
#endif /* BYTE_CODE_METER */
Jim Blandy's avatar
Jim Blandy committed
78 79 80 81


/*  Byte codes: */

Tom Tromey's avatar
Tom Tromey committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
#define BYTE_CODES							\
DEFINE (Bstack_ref, 0) /* Actually, Bstack_ref+0 is not implemented: use dup.  */ \
DEFINE (Bstack_ref1, 1)							\
DEFINE (Bstack_ref2, 2)							\
DEFINE (Bstack_ref3, 3)							\
DEFINE (Bstack_ref4, 4)							\
DEFINE (Bstack_ref5, 5)							\
DEFINE (Bstack_ref6, 6)							\
DEFINE (Bstack_ref7, 7)							\
DEFINE (Bvarref, 010)							\
DEFINE (Bvarref1, 011)							\
DEFINE (Bvarref2, 012)							\
DEFINE (Bvarref3, 013)							\
DEFINE (Bvarref4, 014)							\
DEFINE (Bvarref5, 015)							\
DEFINE (Bvarref6, 016)							\
DEFINE (Bvarref7, 017)							\
DEFINE (Bvarset, 020)							\
DEFINE (Bvarset1, 021)							\
DEFINE (Bvarset2, 022)							\
DEFINE (Bvarset3, 023)							\
DEFINE (Bvarset4, 024)							\
DEFINE (Bvarset5, 025)							\
DEFINE (Bvarset6, 026)							\
DEFINE (Bvarset7, 027)							\
DEFINE (Bvarbind, 030)							\
DEFINE (Bvarbind1, 031)							\
DEFINE (Bvarbind2, 032)							\
DEFINE (Bvarbind3, 033)							\
DEFINE (Bvarbind4, 034)							\
DEFINE (Bvarbind5, 035)							\
DEFINE (Bvarbind6, 036)							\
DEFINE (Bvarbind7, 037)							\
DEFINE (Bcall, 040)							\
DEFINE (Bcall1, 041)							\
DEFINE (Bcall2, 042)							\
DEFINE (Bcall3, 043)							\
DEFINE (Bcall4, 044)							\
DEFINE (Bcall5, 045)							\
DEFINE (Bcall6, 046)							\
DEFINE (Bcall7, 047)							\
DEFINE (Bunbind, 050)							\
DEFINE (Bunbind1, 051)							\
DEFINE (Bunbind2, 052)							\
DEFINE (Bunbind3, 053)							\
DEFINE (Bunbind4, 054)							\
DEFINE (Bunbind5, 055)							\
DEFINE (Bunbind6, 056)							\
DEFINE (Bunbind7, 057)							\
									\
132 133 134 135
DEFINE (Bpophandler, 060)						\
DEFINE (Bpushconditioncase, 061)					\
DEFINE (Bpushcatch, 062)						\
									\
Tom Tromey's avatar
Tom Tromey committed
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
DEFINE (Bnth, 070)							\
DEFINE (Bsymbolp, 071)							\
DEFINE (Bconsp, 072)							\
DEFINE (Bstringp, 073)							\
DEFINE (Blistp, 074)							\
DEFINE (Beq, 075)							\
DEFINE (Bmemq, 076)							\
DEFINE (Bnot, 077)							\
DEFINE (Bcar, 0100)							\
DEFINE (Bcdr, 0101)							\
DEFINE (Bcons, 0102)							\
DEFINE (Blist1, 0103)							\
DEFINE (Blist2, 0104)							\
DEFINE (Blist3, 0105)							\
DEFINE (Blist4, 0106)							\
DEFINE (Blength, 0107)							\
DEFINE (Baref, 0110)							\
DEFINE (Baset, 0111)							\
DEFINE (Bsymbol_value, 0112)						\
DEFINE (Bsymbol_function, 0113)						\
DEFINE (Bset, 0114)							\
DEFINE (Bfset, 0115)							\
DEFINE (Bget, 0116)							\
DEFINE (Bsubstring, 0117)						\
DEFINE (Bconcat2, 0120)							\
DEFINE (Bconcat3, 0121)							\
DEFINE (Bconcat4, 0122)							\
DEFINE (Bsub1, 0123)							\
DEFINE (Badd1, 0124)							\
DEFINE (Beqlsign, 0125)							\
DEFINE (Bgtr, 0126)							\
DEFINE (Blss, 0127)							\
DEFINE (Bleq, 0130)							\
DEFINE (Bgeq, 0131)							\
DEFINE (Bdiff, 0132)							\
DEFINE (Bnegate, 0133)							\
DEFINE (Bplus, 0134)							\
DEFINE (Bmax, 0135)							\
DEFINE (Bmin, 0136)							\
DEFINE (Bmult, 0137)							\
									\
DEFINE (Bpoint, 0140)							\
/* Was Bmark in v17.  */						\
DEFINE (Bsave_current_buffer, 0141) /* Obsolete.  */			\
DEFINE (Bgoto_char, 0142)						\
DEFINE (Binsert, 0143)							\
DEFINE (Bpoint_max, 0144)						\
DEFINE (Bpoint_min, 0145)						\
DEFINE (Bchar_after, 0146)						\
DEFINE (Bfollowing_char, 0147)						\
DEFINE (Bpreceding_char, 0150)						\
DEFINE (Bcurrent_column, 0151)						\
DEFINE (Bindent_to, 0152)						\
DEFINE (Beolp, 0154)							\
DEFINE (Beobp, 0155)							\
DEFINE (Bbolp, 0156)							\
DEFINE (Bbobp, 0157)							\
DEFINE (Bcurrent_buffer, 0160)						\
DEFINE (Bset_buffer, 0161)						\
DEFINE (Bsave_current_buffer_1, 0162) /* Replacing Bsave_current_buffer.  */ \
DEFINE (Binteractive_p, 0164) /* Obsolete since Emacs-24.1.  */		\
									\
DEFINE (Bforward_char, 0165)						\
DEFINE (Bforward_word, 0166)						\
DEFINE (Bskip_chars_forward, 0167)					\
DEFINE (Bskip_chars_backward, 0170)					\
DEFINE (Bforward_line, 0171)						\
DEFINE (Bchar_syntax, 0172)						\
DEFINE (Bbuffer_substring, 0173)					\
DEFINE (Bdelete_region, 0174)						\
DEFINE (Bnarrow_to_region, 0175)					\
DEFINE (Bwiden, 0176)							\
DEFINE (Bend_of_line, 0177)						\
									\
DEFINE (Bconstant2, 0201)						\
DEFINE (Bgoto, 0202)							\
DEFINE (Bgotoifnil, 0203)						\
DEFINE (Bgotoifnonnil, 0204)						\
DEFINE (Bgotoifnilelsepop, 0205)					\
DEFINE (Bgotoifnonnilelsepop, 0206)					\
DEFINE (Breturn, 0207)							\
DEFINE (Bdiscard, 0210)							\
DEFINE (Bdup, 0211)							\
									\
DEFINE (Bsave_excursion, 0212)						\
DEFINE (Bsave_window_excursion, 0213) /* Obsolete since Emacs-24.1.  */	\
DEFINE (Bsave_restriction, 0214)					\
DEFINE (Bcatch, 0215)							\
									\
DEFINE (Bunwind_protect, 0216)						\
DEFINE (Bcondition_case, 0217)						\
DEFINE (Btemp_output_buffer_setup, 0220) /* Obsolete since Emacs-24.1.  */ \
DEFINE (Btemp_output_buffer_show, 0221)  /* Obsolete since Emacs-24.1.  */ \
									\
DEFINE (Bunbind_all, 0222)	/* Obsolete.  Never used.  */		\
									\
DEFINE (Bset_marker, 0223)						\
DEFINE (Bmatch_beginning, 0224)						\
DEFINE (Bmatch_end, 0225)						\
DEFINE (Bupcase, 0226)							\
DEFINE (Bdowncase, 0227)						\
									\
DEFINE (Bstringeqlsign, 0230)						\
DEFINE (Bstringlss, 0231)						\
DEFINE (Bequal, 0232)							\
DEFINE (Bnthcdr, 0233)							\
DEFINE (Belt, 0234)							\
DEFINE (Bmember, 0235)							\
DEFINE (Bassq, 0236)							\
DEFINE (Bnreverse, 0237)						\
DEFINE (Bsetcar, 0240)							\
DEFINE (Bsetcdr, 0241)							\
DEFINE (Bcar_safe, 0242)						\
DEFINE (Bcdr_safe, 0243)						\
DEFINE (Bnconc, 0244)							\
DEFINE (Bquo, 0245)							\
DEFINE (Brem, 0246)							\
DEFINE (Bnumberp, 0247)							\
DEFINE (Bintegerp, 0250)						\
									\
DEFINE (BRgoto, 0252)							\
DEFINE (BRgotoifnil, 0253)						\
DEFINE (BRgotoifnonnil, 0254)						\
DEFINE (BRgotoifnilelsepop, 0255)					\
DEFINE (BRgotoifnonnilelsepop, 0256)					\
									\
DEFINE (BlistN, 0257)							\
DEFINE (BconcatN, 0260)							\
DEFINE (BinsertN, 0261)							\
									\
/* Bstack_ref is code 0.  */						\
DEFINE (Bstack_set,  0262)						\
DEFINE (Bstack_set2, 0263)						\
DEFINE (BdiscardN,   0266)						\
									\
Vibhav Pant's avatar
Vibhav Pant committed
271 272
DEFINE (Bswitch, 0267)                                                  \
                                                                        \
Tom Tromey's avatar
Tom Tromey committed
273 274 275 276 277 278 279 280
DEFINE (Bconstant, 0300)

enum byte_code_op
{
#define DEFINE(name, value) name = value,
    BYTE_CODES
#undef DEFINE

281
#if BYTE_CODE_SAFE
Tom Tromey's avatar
Tom Tromey committed
282
    Bscan_buffer = 0153, /* No longer generated as of v18.  */
Paul Eggert's avatar
Paul Eggert committed
283
    Bset_mark = 0163, /* this loser is no longer generated as of v18 */
284
#endif
Tom Tromey's avatar
Tom Tromey committed
285
};
Jim Blandy's avatar
Jim Blandy committed
286

287
/* Fetch the next byte from the bytecode stream.  */
288 289

#define FETCH (*pc++)
Jim Blandy's avatar
Jim Blandy committed
290

291
/* Fetch two bytes from the bytecode stream and make a 16-bit number
292
   out of them.  */
Jim Blandy's avatar
Jim Blandy committed
293 294 295

#define FETCH2 (op = FETCH, op + (FETCH << 8))

296 297
/* Push X onto the execution stack.  The expression X should not
   contain TOP, to avoid competing side effects.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
298

299
#define PUSH(x) (*++top = (x))
Jim Blandy's avatar
Jim Blandy committed
300 301 302

/* Pop a value off the execution stack.  */

Gerd Moellmann's avatar
Gerd Moellmann committed
303
#define POP (*top--)
Jim Blandy's avatar
Jim Blandy committed
304 305 306

/* Discard n values from the execution stack.  */

Gerd Moellmann's avatar
Gerd Moellmann committed
307 308 309
#define DISCARD(n) (top -= (n))

/* Get the value which is at the top of the execution stack, but don't
310
   pop it.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
311 312

#define TOP (*top)
Jim Blandy's avatar
Jim Blandy committed
313 314

DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0,
315 316 317 318 319
       doc: /* Function used internally in byte-compiled code.
The first argument, BYTESTR, is a string of byte code;
the second, VECTOR, a vector of constants;
the third, MAXDEPTH, the maximum stack depth used in this function.
If the third argument is incorrect, Emacs may crash.  */)
320
  (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth)
321
{
322
  return exec_byte_code (bytestr, vector, maxdepth, Qnil, 0, NULL);
323 324
}

325 326 327 328 329 330
static void
bcall0 (Lisp_Object f)
{
  Ffuncall (1, &f);
}

331 332 333 334 335 336 337 338 339
/* Execute the byte-code in BYTESTR.  VECTOR is the constant vector, and
   MAXDEPTH is the maximum stack depth used (if MAXDEPTH is incorrect,
   emacs may crash!).  If ARGS_TEMPLATE is non-nil, it should be a lisp
   argument list (including &rest, &optional, etc.), and ARGS, of size
   NARGS, should be a vector of the actual arguments.  The arguments in
   ARGS are pushed on the stack according to ARGS_TEMPLATE before
   executing BYTESTR.  */

Lisp_Object
Stefan Monnier's avatar
Stefan Monnier committed
340
exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
341
		Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
Jim Blandy's avatar
Jim Blandy committed
342 343
{
#ifdef BYTE_CODE_METER
344
  int volatile this_op = 0;
Jim Blandy's avatar
Jim Blandy committed
345 346
#endif

347
  CHECK_STRING (bytestr);
348
  CHECK_VECTOR (vector);
349
  CHECK_FIXNAT (maxdepth);
Jim Blandy's avatar
Jim Blandy committed
350

351
  ptrdiff_t const_length = ASIZE (vector);
352

353 354 355 356 357
  if (STRING_MULTIBYTE (bytestr))
    /* BYTESTR must have been produced by Emacs 20.2 or the earlier
       because they produced a raw 8-bit string for byte-code and now
       such a byte-code string is loaded as multibyte while raw 8-bit
       characters converted to multibyte form.  Thus, now we must
358
       convert them back to the originally intended unibyte form.  */
359
    bytestr = Fstring_as_unibyte (bytestr);
360

361 362
  ptrdiff_t bytestr_length = SBYTES (bytestr);
  Lisp_Object *vectorp = XVECTOR (vector)->contents;
363

364
  unsigned char quitcounter = 1;
Tom Tromey's avatar
Tom Tromey committed
365
  EMACS_INT stack_items = XFIXNAT (maxdepth) + 1;
366
  USE_SAFE_ALLOCA;
367 368 369 370
  void *alloc;
  SAFE_ALLOCA_LISP_EXTRA (alloc, stack_items, bytestr_length);
  ptrdiff_t item_bytes = stack_items * word_size;
  Lisp_Object *stack_base = ptr_bounds_clip (alloc, item_bytes);
371
  Lisp_Object *top = stack_base;
Paul Eggert's avatar
Paul Eggert committed
372
  *top = vector; /* Ensure VECTOR survives GC (Bug#33014).  */
373 374 375 376
  Lisp_Object *stack_lim = stack_base + stack_items;
  unsigned char *bytestr_data = alloc;
  bytestr_data = ptr_bounds_clip (bytestr_data + item_bytes, bytestr_length);
  memcpy (bytestr_data, SDATA (bytestr), bytestr_length);
377
  unsigned char const *pc = bytestr_data;
378
  ptrdiff_t count = SPECPDL_INDEX ();
Jim Blandy's avatar
Jim Blandy committed
379

380
  if (!NILP (args_template))
381
    {
382
      eassert (FIXNUMP (args_template));
Tom Tromey's avatar
Tom Tromey committed
383
      ptrdiff_t at = XFIXNUM (args_template);
384
      bool rest = (at & 128) != 0;
385
      int mandatory = at & 127;
386
      ptrdiff_t nonrest = at >> 8;
387 388
      ptrdiff_t maxargs = rest ? PTRDIFF_MAX : nonrest;
      if (! (mandatory <= nargs && nargs <= maxargs))
389
	Fsignal (Qwrong_number_of_arguments,
390 391
		 list2 (Fcons (make_fixnum (mandatory), make_fixnum (nonrest)),
			make_fixnum (nargs)));
392 393 394 395 396 397 398 399
      ptrdiff_t pushedargs = min (nonrest, nargs);
      for (ptrdiff_t i = 0; i < pushedargs; i++, args++)
	PUSH (*args);
      if (nonrest < nargs)
	PUSH (Flist (nargs - nonrest, args));
      else
	for (ptrdiff_t i = nargs - rest; i < nonrest; i++)
	  PUSH (Qnil);
400 401
    }

402
  while (true)
Jim Blandy's avatar
Jim Blandy committed
403
    {
404 405 406
      int op;
      enum handlertype type;

407
      if (BYTE_CODE_SAFE && ! (stack_base <= top && top < stack_lim))
408
	emacs_abort ();
Jim Blandy's avatar
Jim Blandy committed
409 410

#ifdef BYTE_CODE_METER
411
      int prev_op = this_op;
Jim Blandy's avatar
Jim Blandy committed
412 413
      this_op = op = FETCH;
      METER_CODE (prev_op, op);
414
#elif !defined BYTE_CODE_THREADED
415
      op = FETCH;
Tom Tromey's avatar
Tom Tromey committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
#endif

      /* The interpreter can be compiled one of two ways: as an
	 ordinary switch-based interpreter, or as a threaded
	 interpreter.  The threaded interpreter relies on GCC's
	 computed goto extension, so it is not available everywhere.
	 Threading provides a performance boost.  These macros are how
	 we allow the code to be compiled both ways.  */
#ifdef BYTE_CODE_THREADED
      /* The CASE macro introduces an instruction's body.  It is
	 either a label or a case label.  */
#define CASE(OP) insn_ ## OP
      /* NEXT is invoked at the end of an instruction to go to the
	 next instruction.  It is either a computed goto, or a
	 plain break.  */
#define NEXT goto *(targets[op = FETCH])
      /* FIRST is like NEXT, but is only used at the start of the
	 interpreter body.  In the switch-based interpreter it is the
	 switch, so the threaded definition must include a semicolon.  */
#define FIRST NEXT;
      /* Most cases are labeled with the CASE macro, above.
	 CASE_DEFAULT is one exception; it is used if the interpreter
	 being built requires a default case.  The threaded
	 interpreter does not, because the dispatch table is
	 completely filled.  */
#define CASE_DEFAULT
      /* This introduces an instruction that is known to call abort.  */
#define CASE_ABORT CASE (Bstack_ref): CASE (default)
#else
      /* See above for the meaning of the various defines.  */
#define CASE(OP) case OP
#define NEXT break
#define FIRST switch (op)
#define CASE_DEFAULT case 255: default:
#define CASE_ABORT case 0
#endif

#ifdef BYTE_CODE_THREADED

      /* A convenience define that saves us a lot of typing and makes
	 the table clearer.  */
#define LABEL(OP) [OP] = &&insn_ ## OP
Jim Blandy's avatar
Jim Blandy committed
458

Tom Tromey's avatar
Tom Tromey committed
459 460
      /* This is the dispatch table for the threaded interpreter.  */
      static const void *const targets[256] =
461
	{
Tom Tromey's avatar
Tom Tromey committed
462 463 464 465 466 467 468
	  [0 ... (Bconstant - 1)] = &&insn_default,
	  [Bconstant ... 255] = &&insn_Bconstant,

#define DEFINE(name, value) LABEL (name) ,
	  BYTE_CODES
#undef DEFINE
	};
469

Tom Tromey's avatar
Tom Tromey committed
470 471 472 473 474 475
#endif


      FIRST
	{
	CASE (Bvarref7):
Jim Blandy's avatar
Jim Blandy committed
476 477 478
	  op = FETCH2;
	  goto varref;

Tom Tromey's avatar
Tom Tromey committed
479 480 481 482 483 484
	CASE (Bvarref):
	CASE (Bvarref1):
	CASE (Bvarref2):
	CASE (Bvarref3):
	CASE (Bvarref4):
	CASE (Bvarref5):
485
	  op -= Bvarref;
486 487 488 489
	  goto varref;

	/* This seems to be the most frequently executed byte-code
	   among the Bvarref's, so avoid a goto here.  */
Tom Tromey's avatar
Tom Tromey committed
490
	CASE (Bvarref6):
491
	  op = FETCH;
Jim Blandy's avatar
Jim Blandy committed
492
	varref:
493
	  {
494 495
	    Lisp_Object v1 = vectorp[op], v2;
	    if (!SYMBOLP (v1)
496
		|| XSYMBOL (v1)->u.s.redirect != SYMBOL_PLAINVAL
497 498
		|| (v2 = SYMBOL_VAL (XSYMBOL (v1)), EQ (v2, Qunbound)))
	      v2 = Fsymbol_value (v1);
499
	    PUSH (v2);
Tom Tromey's avatar
Tom Tromey committed
500
	    NEXT;
501 502
	  }

Tom Tromey's avatar
Tom Tromey committed
503
	CASE (Bgotoifnil):
504
	  {
505
	    Lisp_Object v1 = POP;
506 507
	    op = FETCH2;
	    if (NILP (v1))
508
	      goto op_branch;
Tom Tromey's avatar
Tom Tromey committed
509
	    NEXT;
510
	  }
Jim Blandy's avatar
Jim Blandy committed
511

Tom Tromey's avatar
Tom Tromey committed
512
	CASE (Bcar):
513 514 515 516 517
	  if (CONSP (TOP))
	    TOP = XCAR (TOP);
	  else if (!NILP (TOP))
	    wrong_type_argument (Qlistp, TOP);
	  NEXT;
518

Tom Tromey's avatar
Tom Tromey committed
519
	CASE (Beq):
520
	  {
521
	    Lisp_Object v1 = POP;
522
	    TOP = EQ (v1, TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
523
	    NEXT;
524 525
	  }

Tom Tromey's avatar
Tom Tromey committed
526
	CASE (Bmemq):
527
	  {
528
	    Lisp_Object v1 = POP;
529
	    TOP = Fmemq (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
530
	    NEXT;
531 532
	  }

Tom Tromey's avatar
Tom Tromey committed
533
	CASE (Bcdr):
534
	  {
535 536 537 538
	    if (CONSP (TOP))
	      TOP = XCDR (TOP);
	    else if (!NILP (TOP))
	      wrong_type_argument (Qlistp, TOP);
Tom Tromey's avatar
Tom Tromey committed
539
	    NEXT;
540
	  }
Jim Blandy's avatar
Jim Blandy committed
541

Tom Tromey's avatar
Tom Tromey committed
542 543 544 545 546 547
	CASE (Bvarset):
	CASE (Bvarset1):
	CASE (Bvarset2):
	CASE (Bvarset3):
	CASE (Bvarset4):
	CASE (Bvarset5):
548
	  op -= Bvarset;
Jim Blandy's avatar
Jim Blandy committed
549 550
	  goto varset;

Tom Tromey's avatar
Tom Tromey committed
551
	CASE (Bvarset7):
552
	  op = FETCH2;
553 554
	  goto varset;

Tom Tromey's avatar
Tom Tromey committed
555
	CASE (Bvarset6):
556
	  op = FETCH;
Jim Blandy's avatar
Jim Blandy committed
557
	varset:
558
	  {
559 560
	    Lisp_Object sym = vectorp[op];
	    Lisp_Object val = POP;
561 562 563 564

	    /* Inline the most common case.  */
	    if (SYMBOLP (sym)
		&& !EQ (val, Qunbound)
Paul Eggert's avatar
Paul Eggert committed
565
		&& XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL
Eli Zaretskii's avatar
Eli Zaretskii committed
566
		&& !SYMBOL_TRAPPED_WRITE_P (sym))
567
	      SET_SYMBOL_VAL (XSYMBOL (sym), val);
568
	    else
Noam Postavsky's avatar
Noam Postavsky committed
569
              set_internal (sym, val, Qnil, SET_INTERNAL_SET);
570
	  }
Tom Tromey's avatar
Tom Tromey committed
571
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
572

Tom Tromey's avatar
Tom Tromey committed
573
	CASE (Bdup):
574
	  {
575
	    Lisp_Object v1 = TOP;
576
	    PUSH (v1);
Tom Tromey's avatar
Tom Tromey committed
577
	    NEXT;
578 579 580 581
	  }

	/* ------------------ */

Tom Tromey's avatar
Tom Tromey committed
582
	CASE (Bvarbind6):
Jim Blandy's avatar
Jim Blandy committed
583 584 585
	  op = FETCH;
	  goto varbind;

Tom Tromey's avatar
Tom Tromey committed
586
	CASE (Bvarbind7):
Jim Blandy's avatar
Jim Blandy committed
587 588 589
	  op = FETCH2;
	  goto varbind;

Tom Tromey's avatar
Tom Tromey committed
590 591 592 593 594 595
	CASE (Bvarbind):
	CASE (Bvarbind1):
	CASE (Bvarbind2):
	CASE (Bvarbind3):
	CASE (Bvarbind4):
	CASE (Bvarbind5):
Jim Blandy's avatar
Jim Blandy committed
596 597
	  op -= Bvarbind;
	varbind:
598
	  /* Specbind can signal and thus GC.  */
Jim Blandy's avatar
Jim Blandy committed
599
	  specbind (vectorp[op], POP);
Tom Tromey's avatar
Tom Tromey committed
600
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
601

Tom Tromey's avatar
Tom Tromey committed
602
	CASE (Bcall6):
Jim Blandy's avatar
Jim Blandy committed
603 604 605
	  op = FETCH;
	  goto docall;

Tom Tromey's avatar
Tom Tromey committed
606
	CASE (Bcall7):
Jim Blandy's avatar
Jim Blandy committed
607 608 609
	  op = FETCH2;
	  goto docall;

Tom Tromey's avatar
Tom Tromey committed
610 611 612 613 614 615
	CASE (Bcall):
	CASE (Bcall1):
	CASE (Bcall2):
	CASE (Bcall3):
	CASE (Bcall4):
	CASE (Bcall5):
Jim Blandy's avatar
Jim Blandy committed
616 617
	  op -= Bcall;
	docall:
618 619
	  {
	    DISCARD (op);
620
#ifdef BYTE_CODE_METER
621 622
	    if (byte_metering_on && SYMBOLP (TOP))
	      {
623 624
		Lisp_Object v1 = TOP;
		Lisp_Object v2 = Fget (v1, Qbyte_code_meter);
625
		if (FIXNUMP (v2)
Tom Tromey's avatar
Tom Tromey committed
626
		    && XFIXNUM (v2) < MOST_POSITIVE_FIXNUM)
627
		  {
Tom Tromey's avatar
Tom Tromey committed
628
		    XSETINT (v2, XFIXNUM (v2) + 1);
629 630 631
		    Fput (v1, Qbyte_code_meter, v2);
		  }
	      }
632
#endif
633
	    TOP = Ffuncall (op + 1, &TOP);
Tom Tromey's avatar
Tom Tromey committed
634
	    NEXT;
635
	  }
Jim Blandy's avatar
Jim Blandy committed
636

Tom Tromey's avatar
Tom Tromey committed
637
	CASE (Bunbind6):
Jim Blandy's avatar
Jim Blandy committed
638 639 640
	  op = FETCH;
	  goto dounbind;

Tom Tromey's avatar
Tom Tromey committed
641
	CASE (Bunbind7):
Jim Blandy's avatar
Jim Blandy committed
642 643 644
	  op = FETCH2;
	  goto dounbind;

Tom Tromey's avatar
Tom Tromey committed
645 646 647 648 649 650
	CASE (Bunbind):
	CASE (Bunbind1):
	CASE (Bunbind2):
	CASE (Bunbind3):
	CASE (Bunbind4):
	CASE (Bunbind5):
Jim Blandy's avatar
Jim Blandy committed
651 652
	  op -= Bunbind;
	dounbind:
653
	  unbind_to (SPECPDL_INDEX () - op, Qnil);
Tom Tromey's avatar
Tom Tromey committed
654
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
655

Tom Tromey's avatar
Tom Tromey committed
656
	CASE (Bunbind_all):	/* Obsolete.  Never used.  */
Jim Blandy's avatar
Jim Blandy committed
657
	  /* To unbind back to the beginning of this frame.  Not used yet,
658
	     but will be needed for tail-recursion elimination.  */
Jim Blandy's avatar
Jim Blandy committed
659
	  unbind_to (count, Qnil);
Tom Tromey's avatar
Tom Tromey committed
660
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
661

Tom Tromey's avatar
Tom Tromey committed
662
	CASE (Bgoto):
663 664 665 666 667 668 669 670 671 672 673 674 675
	  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 ();
Paul Eggert's avatar
Paul Eggert committed
676
	      maybe_quit ();
677 678
	    }
	  pc += op;
Tom Tromey's avatar
Tom Tromey committed
679
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
680

Tom Tromey's avatar
Tom Tromey committed
681
	CASE (Bgotoifnonnil):
682 683 684 685
	  op = FETCH2;
	  if (!NILP (POP))
	    goto op_branch;
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
686

Tom Tromey's avatar
Tom Tromey committed
687
	CASE (Bgotoifnilelsepop):
Jim Blandy's avatar
Jim Blandy committed
688
	  op = FETCH2;
Joseph Arceneaux's avatar
Joseph Arceneaux committed
689
	  if (NILP (TOP))
690 691
	    goto op_branch;
	  DISCARD (1);
Tom Tromey's avatar
Tom Tromey committed
692
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
693

Tom Tromey's avatar
Tom Tromey committed
694
	CASE (Bgotoifnonnilelsepop):
Jim Blandy's avatar
Jim Blandy committed
695
	  op = FETCH2;
Joseph Arceneaux's avatar
Joseph Arceneaux committed
696
	  if (!NILP (TOP))
697 698
	    goto op_branch;
	  DISCARD (1);
Tom Tromey's avatar
Tom Tromey committed
699
	  NEXT;
700

Tom Tromey's avatar
Tom Tromey committed
701
	CASE (BRgoto):
702 703
	  op = FETCH - 128;
	  goto op_relative_branch;
704

Tom Tromey's avatar
Tom Tromey committed
705
	CASE (BRgotoifnil):
706 707 708 709
	  op = FETCH - 128;
	  if (NILP (POP))
	    goto op_relative_branch;
	  NEXT;
710

Tom Tromey's avatar
Tom Tromey committed
711
	CASE (BRgotoifnonnil):
712 713 714 715
	  op = FETCH - 128;
	  if (!NILP (POP))
	    goto op_relative_branch;
	  NEXT;
716

Tom Tromey's avatar
Tom Tromey committed
717
	CASE (BRgotoifnilelsepop):
718
	  op = FETCH - 128;
719
	  if (NILP (TOP))
720 721
	    goto op_relative_branch;
	  DISCARD (1);
Tom Tromey's avatar
Tom Tromey committed
722
	  NEXT;
723

Tom Tromey's avatar
Tom Tromey committed
724
	CASE (BRgotoifnonnilelsepop):
725
	  op = FETCH - 128;
726
	  if (!NILP (TOP))
727 728
	    goto op_relative_branch;
	  DISCARD (1);
Tom Tromey's avatar
Tom Tromey committed
729
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
730

Tom Tromey's avatar
Tom Tromey committed
731
	CASE (Breturn):
Jim Blandy's avatar
Jim Blandy committed
732 733
	  goto exit;

Tom Tromey's avatar
Tom Tromey committed
734
	CASE (Bdiscard):
735
	  DISCARD (1);
Tom Tromey's avatar
Tom Tromey committed
736
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
737

Tom Tromey's avatar
Tom Tromey committed
738
	CASE (Bconstant2):
Jim Blandy's avatar
Jim Blandy committed
739
	  PUSH (vectorp[FETCH2]);
Tom Tromey's avatar
Tom Tromey committed
740
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
741

Tom Tromey's avatar
Tom Tromey committed
742
	CASE (Bsave_excursion):
743
	  record_unwind_protect_excursion ();
Tom Tromey's avatar
Tom Tromey committed
744
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
745

Tom Tromey's avatar
Tom Tromey committed
746 747
	CASE (Bsave_current_buffer): /* Obsolete since ??.  */
	CASE (Bsave_current_buffer_1):
748
	  record_unwind_current_buffer ();
Tom Tromey's avatar
Tom Tromey committed
749
	  NEXT;
750

Tom Tromey's avatar
Tom Tromey committed
751
	CASE (Bsave_window_excursion): /* Obsolete since 24.1.  */
752
	  {
753 754
	    ptrdiff_t count1 = SPECPDL_INDEX ();
	    record_unwind_protect (restore_window_configuration,
755 756
				   Fcurrent_window_configuration (Qnil));
	    TOP = Fprogn (TOP);
757
	    unbind_to (count1, TOP);
Tom Tromey's avatar
Tom Tromey committed
758
	    NEXT;
759
	  }
Jim Blandy's avatar
Jim Blandy committed
760

Tom Tromey's avatar
Tom Tromey committed
761
	CASE (Bsave_restriction):
762 763
	  record_unwind_protect (save_restriction_restore,
				 save_restriction_save ());
Tom Tromey's avatar
Tom Tromey committed
764
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
765

766
	CASE (Bcatch):		/* Obsolete since 24.4.  */
767
	  {
768
	    Lisp_Object v1 = POP;
769
	    TOP = internal_catch (TOP, eval_sub, v1);
Tom Tromey's avatar
Tom Tromey committed
770
	    NEXT;
771
	  }
Jim Blandy's avatar
Jim Blandy committed
772

773 774 775 776
	CASE (Bpushcatch):	/* New in 24.4.  */
	  type = CATCHER;
	  goto pushhandler;
	CASE (Bpushconditioncase): /* New in 24.4.  */
777 778
	  type = CONDITION_CASE;
	pushhandler:
779
	  {
780 781
	    struct handler *c = push_handler (POP, type);
	    c->bytecode_dest = FETCH2;
782
	    c->bytecode_top = top;
783

784 785 786 787
	    if (sys_setjmp (c->jmp))
	      {
		struct handler *c = handlerlist;
		top = c->bytecode_top;
788
		op = c->bytecode_dest;
789 790
		handlerlist = c->next;
		PUSH (c->val);
791
		goto op_branch;
792
	      }
793

794 795 796 797
	    NEXT;
	  }

	CASE (Bpophandler):	/* New in 24.4.  */
798 799
	  handlerlist = handlerlist->next;
	  NEXT;
800

Tom Tromey's avatar
Tom Tromey committed
801
	CASE (Bunwind_protect):	/* FIXME: avoid closure for lexbind.  */
802 803 804
	  {
	    Lisp_Object handler = POP;
	    /* Support for a function here is new in 24.4.  */
Paul Eggert's avatar
Paul Eggert committed
805
	    record_unwind_protect (FUNCTIONP (handler) ? bcall0 : prog_ignore,
806 807 808
				   handler);
	    NEXT;
	  }
Jim Blandy's avatar
Jim Blandy committed
809

810
	CASE (Bcondition_case):		/* Obsolete since 24.4.  */
811
	  {
812
	    Lisp_Object handlers = POP, body = POP;
813
	    TOP = internal_lisp_condition_case (TOP, body, handlers);
Tom Tromey's avatar
Tom Tromey committed
814
	    NEXT;
815
	  }
Jim Blandy's avatar
Jim Blandy committed
816

Tom Tromey's avatar
Tom Tromey committed
817
	CASE (Btemp_output_buffer_setup): /* Obsolete since 24.1.  */
818
	  CHECK_STRING (TOP);
819
	  temp_output_buffer_setup (SSDATA (TOP));
Jim Blandy's avatar
Jim Blandy committed
820
	  TOP = Vstandard_output;
Tom Tromey's avatar
Tom Tromey committed
821
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
822

Tom Tromey's avatar
Tom Tromey committed
823
	CASE (Btemp_output_buffer_show): /* Obsolete since 24.1.  */
824
	  {
825
	    Lisp_Object v1 = POP;
826 827 828
	    temp_output_buffer_show (TOP);
	    TOP = v1;
	    /* pop binding of standard-output */
829
	    unbind_to (SPECPDL_INDEX () - 1, Qnil);
Tom Tromey's avatar
Tom Tromey committed
830
	    NEXT;
831
	  }
Jim Blandy's avatar
Jim Blandy committed
832

Tom Tromey's avatar
Tom Tromey committed
833
	CASE (Bnth):
834
	  {
835
	    Lisp_Object v2 = POP, v1 = TOP;
836
	    if (RANGED_FIXNUMP (0, v1, SMALL_LIST_LEN_MAX))
837
	      {
838 839 840
		for (EMACS_INT n = XFIXNUM (v1); 0 < n && CONSP (v2); n--)
		  v2 = XCDR (v2);
		TOP = CAR (v2);
841
	      }
842 843
	    else
	      TOP = Fnth (v1, v2);
Tom Tromey's avatar
Tom Tromey committed
844
	    NEXT;
845
	  }
Jim Blandy's avatar
Jim Blandy committed
846

Tom Tromey's avatar
Tom Tromey committed
847
	CASE (Bsymbolp):
848
	  TOP = SYMBOLP (TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
849
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
850

Tom Tromey's avatar
Tom Tromey committed
851
	CASE (Bconsp):
Jim Blandy's avatar
Jim Blandy committed
852
	  TOP = CONSP (TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
853
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
854

Tom Tromey's avatar
Tom Tromey committed
855
	CASE (Bstringp):
856
	  TOP = STRINGP (TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
857
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
858

Tom Tromey's avatar
Tom Tromey committed
859
	CASE (Blistp):
Joseph Arceneaux's avatar
Joseph Arceneaux committed
860
	  TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
861
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
862

Tom Tromey's avatar
Tom Tromey committed
863
	CASE (Bnot):
Joseph Arceneaux's avatar
Joseph Arceneaux committed
864
	  TOP = NILP (TOP) ? Qt : Qnil;
Tom Tromey's avatar
Tom Tromey committed
865
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
866

Tom Tromey's avatar
Tom Tromey committed
867
	CASE (Bcons):
868
	  {
869
	    Lisp_Object v1 = POP;
870
	    TOP = Fcons (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
871
	    NEXT;
872
	  }
Jim Blandy's avatar
Jim Blandy committed
873

Tom Tromey's avatar
Tom Tromey committed
874
	CASE (Blist1):
875
	  TOP = list1 (TOP);
Tom Tromey's avatar
Tom Tromey committed
876
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
877

Tom Tromey's avatar
Tom Tromey committed
878
	CASE (Blist2):
879
	  {
880
	    Lisp_Object v1 = POP;
881
	    TOP = list2 (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
882
	    NEXT;
883
	  }
Jim Blandy's avatar
Jim Blandy committed
884

Tom Tromey's avatar
Tom Tromey committed
885
	CASE (Blist3):
886
	  DISCARD (2);
Jim Blandy's avatar
Jim Blandy committed
887
	  TOP = Flist (3, &TOP);
Tom Tromey's avatar
Tom Tromey committed
888
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
889

Tom Tromey's avatar
Tom Tromey committed
890
	CASE (Blist4):
891
	  DISCARD (3);
Jim Blandy's avatar
Jim Blandy committed
892
	  TOP = Flist (4, &TOP);
Tom Tromey's avatar
Tom Tromey committed
893
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
894

Tom Tromey's avatar
Tom Tromey committed
895
	CASE (BlistN):
896 897 898
	  op = FETCH;
	  DISCARD (op - 1);
	  TOP = Flist (op, &TOP);
Tom Tromey's avatar
Tom Tromey committed
899
	  NEXT;
900

Tom Tromey's avatar
Tom Tromey committed
901
	CASE (Blength):
Jim Blandy's avatar
Jim Blandy committed
902
	  TOP = Flength (TOP);
Tom Tromey's avatar
Tom Tromey committed
903
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
904

Tom Tromey's avatar
Tom Tromey committed
905
	CASE (Baref):
906
	  {
907
	    Lisp_Object v1 = POP;
908
	    TOP = Faref (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
909
	    NEXT;
910
	  }
Jim Blandy's avatar
Jim Blandy committed
911

Tom Tromey's avatar
Tom Tromey committed
912
	CASE (Baset):
913
	  {
914
	    Lisp_Object v2 = POP, v1 = POP;
915
	    TOP = Faset (TOP, v1, v2);
Tom Tromey's avatar
Tom Tromey committed
916
	    NEXT;
917
	  }
Jim Blandy's avatar
Jim Blandy committed
918

Tom Tromey's avatar
Tom Tromey committed
919
	CASE (Bsymbol_value):
Jim Blandy's avatar
Jim Blandy committed
920
	  TOP = Fsymbol_value (TOP);
Tom Tromey's avatar
Tom Tromey committed
921
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
922

Tom Tromey's avatar
Tom Tromey committed
923
	CASE (Bsymbol_function):
Jim Blandy's avatar
Jim Blandy committed
924
	  TOP = Fsymbol_function (TOP);
Tom Tromey's avatar
Tom Tromey committed
925
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
926

Tom Tromey's avatar
Tom Tromey committed
927
	CASE (Bset):
928
	  {
929
	    Lisp_Object v1 = POP;
930
	    TOP = Fset (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
931
	    NEXT;
932
	  }
Jim Blandy's avatar
Jim Blandy committed
933

Tom Tromey's avatar
Tom Tromey committed
934
	CASE (Bfset):
935
	  {
936
	    Lisp_Object v1 = POP;
937
	    TOP = Ffset (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
938
	    NEXT;
939
	  }
Jim Blandy's avatar
Jim Blandy committed
940

Tom Tromey's avatar
Tom Tromey committed
941
	CASE (Bget):
942
	  {
943
	    Lisp_Object v1 = POP;
944
	    TOP = Fget (TOP, v1);
Tom Tromey's avatar
Tom Tromey committed
945
	    NEXT;
946
	  }
Jim Blandy's avatar
Jim Blandy committed
947

Tom Tromey's avatar
Tom Tromey committed
948
	CASE (Bsubstring):
949
	  {
950
	    Lisp_Object v2 = POP, v1 = POP;
951
	    TOP = Fsubstring (TOP, v1, v2);
Tom Tromey's avatar
Tom Tromey committed
952
	    NEXT;
953
	  }
Jim Blandy's avatar
Jim Blandy committed
954

Tom Tromey's avatar
Tom Tromey committed
955
	CASE (Bconcat2):
956
	  DISCARD (1);
Jim Blandy's avatar
Jim Blandy committed
957
	  TOP = Fconcat (2, &TOP);
Tom Tromey's avatar
Tom Tromey committed
958
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
959

Tom Tromey's avatar
Tom Tromey committed
960
	CASE (Bconcat3):
961
	  DISCARD (2);
Jim Blandy's avatar
Jim Blandy committed
962
	  TOP = Fconcat (3, &TOP);
Tom Tromey's avatar
Tom Tromey committed
963
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
964

Tom Tromey's avatar
Tom Tromey committed
965
	CASE (Bconcat4):
966
	  DISCARD (3);
Jim Blandy's avatar
Jim Blandy committed
967
	  TOP = Fconcat (4, &TOP);
Tom Tromey's avatar
Tom Tromey committed
968
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
969

Tom Tromey's avatar
Tom Tromey committed
970
	CASE (BconcatN):
971 972 973
	  op = FETCH;
	  DISCARD (op - 1);
	  TOP = Fconcat (op, &TOP);
Tom Tromey's avatar
Tom Tromey committed
974
	  NEXT;
975

Tom Tromey's avatar
Tom Tromey committed
976
	CASE (Bsub1):
Tom Tromey's avatar
Tom Tromey committed
977 978
	  TOP = (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM
		 ? make_fixnum (XFIXNUM (TOP) - 1)
979
		 : Fsub1 (TOP));
980
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
981

Tom Tromey's avatar
Tom Tromey committed
982
	CASE (Badd1):
Tom Tromey's avatar
Tom Tromey committed
983 984
	  TOP = (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM
		 ? make_fixnum (XFIXNUM (TOP) + 1)
985
		 : Fadd1 (TOP));
986
	  NEXT;
Jim Blandy's avatar
Jim Blandy committed
987

Tom Tromey's avatar
Tom Tromey committed
988
	CASE (Beqlsign):
989
	  {
990 991
	    Lisp_Object v1 = POP;
	    TOP = arithcompare (TOP, v1, ARITH_EQUAL);
Tom Tromey's avatar
Tom Tromey committed
992
	    NEXT;