1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 hacked on by jwz@lucid.com 17-jun-91
22 o added a compile-time switch to turn on simple sanity checking;
23 o put back the obsolete byte-codes for error-detection;
24 o added a new instruction, unbind_all, which I will use for
25 tail-recursion elimination;
26 o made temp_output_buffer_show be called with the right number
28 o made the new bytecodes be called with args in the right order;
29 o added metering support.
32 o added relative jump instructions;
33 o all conditionals now only do QUIT if they jump.
40 #include "character.h"
44 #ifdef CHECK_FRAME_FONT
50 * define BYTE_CODE_SAFE to enable some minor sanity checking (useful for
51 * debugging the byte compiler...)
53 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
55 /* #define BYTE_CODE_SAFE */
56 /* #define BYTE_CODE_METER */
59 #ifdef BYTE_CODE_METER
61 Lisp_Object Vbyte_code_meter
, Qbyte_code_meter
;
64 #define METER_2(code1, code2) \
65 XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
68 #define METER_1(code) METER_2 (0, (code))
70 #define METER_CODE(last_code, this_code) \
72 if (byte_metering_on) \
74 if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM) \
75 METER_1 (this_code)++; \
77 && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM) \
78 METER_2 (last_code, this_code)++; \
82 #else /* no BYTE_CODE_METER */
84 #define METER_CODE(last_code, this_code)
86 #endif /* no BYTE_CODE_METER */
89 Lisp_Object Qbytecode
;
117 #define Bsymbol_value 0112
118 #define Bsymbol_function 0113
122 #define Bsubstring 0117
123 #define Bconcat2 0120
124 #define Bconcat3 0121
125 #define Bconcat4 0122
128 #define Beqlsign 0125
141 /* Was Bmark in v17. */
142 #define Bsave_current_buffer 0141
143 #define Bgoto_char 0142
145 #define Bpoint_max 0144
146 #define Bpoint_min 0145
147 #define Bchar_after 0146
148 #define Bfollowing_char 0147
149 #define Bpreceding_char 0150
150 #define Bcurrent_column 0151
151 #define Bindent_to 0152
152 #define Bscan_buffer 0153 /* No longer generated as of v18 */
157 #define Bcurrent_buffer 0160
158 #define Bset_buffer 0161
159 #define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */
160 #define Bread_char 0162 /* No longer generated as of v19 */
161 #define Bset_mark 0163 /* this loser is no longer generated as of v18 */
162 #define Binteractive_p 0164 /* Needed since interactive-p takes unevalled args */
164 #define Bforward_char 0165
165 #define Bforward_word 0166
166 #define Bskip_chars_forward 0167
167 #define Bskip_chars_backward 0170
168 #define Bforward_line 0171
169 #define Bchar_syntax 0172
170 #define Bbuffer_substring 0173
171 #define Bdelete_region 0174
172 #define Bnarrow_to_region 0175
174 #define Bend_of_line 0177
176 #define Bconstant2 0201
178 #define Bgotoifnil 0203
179 #define Bgotoifnonnil 0204
180 #define Bgotoifnilelsepop 0205
181 #define Bgotoifnonnilelsepop 0206
183 #define Bdiscard 0210
186 #define Bsave_excursion 0212
187 #define Bsave_window_excursion 0213
188 #define Bsave_restriction 0214
191 #define Bunwind_protect 0216
192 #define Bcondition_case 0217
193 #define Btemp_output_buffer_setup 0220
194 #define Btemp_output_buffer_show 0221
196 #define Bunbind_all 0222
198 #define Bset_marker 0223
199 #define Bmatch_beginning 0224
200 #define Bmatch_end 0225
202 #define Bdowncase 0227
204 #define Bstringeqlsign 0230
205 #define Bstringlss 0231
211 #define Bnreverse 0237
214 #define Bcar_safe 0242
215 #define Bcdr_safe 0243
219 #define Bnumberp 0247
220 #define Bintegerp 0250
223 #define BRgotoifnil 0253
224 #define BRgotoifnonnil 0254
225 #define BRgotoifnilelsepop 0255
226 #define BRgotoifnonnilelsepop 0256
229 #define BconcatN 0260
230 #define BinsertN 0261
232 #define Bconstant 0300
233 #define CONSTANTLIM 0100
236 /* Structure describing a value stack used during byte-code execution
241 /* Program counter. This points into the byte_string below
242 and is relocated when that string is relocated. */
243 const unsigned char *pc
;
245 /* Top and bottom of stack. The bottom points to an area of memory
246 allocated with alloca in Fbyte_code. */
247 Lisp_Object
*top
, *bottom
;
249 /* The string containing the byte-code, and its current address.
250 Storing this here protects it from GC because mark_byte_stack
252 Lisp_Object byte_string
;
253 const unsigned char *byte_string_start
;
255 /* The vector of constants used during byte-code execution. Storing
256 this here protects it from GC because mark_byte_stack marks it. */
257 Lisp_Object constants
;
259 /* Next entry in byte_stack_list. */
260 struct byte_stack
*next
;
263 /* A list of currently active byte-code execution value stacks.
264 Fbyte_code adds an entry to the head of this list before it starts
265 processing byte-code, and it removed the entry again when it is
266 done. Signalling an error truncates the list analoguous to
269 struct byte_stack
*byte_stack_list
;
272 /* Mark objects on byte_stack_list. Called during GC. */
277 struct byte_stack
*stack
;
280 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
282 /* If STACK->top is null here, this means there's an opcode in
283 Fbyte_code that wasn't expected to GC, but did. To find out
284 which opcode this is, record the value of `stack', and walk
285 up the stack in a debugger, stopping in frames of Fbyte_code.
286 The culprit is found in the frame of Fbyte_code where the
287 address of its local variable `stack' is equal to the
288 recorded value of `stack' here. */
289 eassert (stack
->top
);
291 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
294 mark_object (stack
->byte_string
);
295 mark_object (stack
->constants
);
300 /* Unmark objects in the stacks on byte_stack_list. Relocate program
301 counters. Called when GC has completed. */
306 struct byte_stack
*stack
;
308 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
310 if (stack
->byte_string_start
!= SDATA (stack
->byte_string
))
312 int offset
= stack
->pc
- stack
->byte_string_start
;
313 stack
->byte_string_start
= SDATA (stack
->byte_string
);
314 stack
->pc
= stack
->byte_string_start
+ offset
;
320 /* Fetch the next byte from the bytecode stream */
322 #define FETCH *stack.pc++
324 /* Fetch two bytes from the bytecode stream and make a 16-bit number
327 #define FETCH2 (op = FETCH, op + (FETCH << 8))
329 /* Push x onto the execution stack. This used to be #define PUSH(x)
330 (*++stackp = (x)) This oddity is necessary because Alliant can't be
331 bothered to compile the preincrement operator properly, as of 4/91.
334 #define PUSH(x) (top++, *top = (x))
336 /* Pop a value off the execution stack. */
340 /* Discard n values from the execution stack. */
342 #define DISCARD(n) (top -= (n))
344 /* Get the value which is at the top of the execution stack, but don't
349 /* Actions that must be performed before and after calling a function
352 #define BEFORE_POTENTIAL_GC() stack.top = top
353 #define AFTER_POTENTIAL_GC() stack.top = NULL
355 /* Garbage collect if we have consed enough since the last time.
356 We do this at every branch, to avoid loops that never GC. */
359 if (consing_since_gc > gc_cons_threshold \
360 && consing_since_gc > gc_relative_threshold) \
362 BEFORE_POTENTIAL_GC (); \
363 Fgarbage_collect (); \
364 AFTER_POTENTIAL_GC (); \
368 /* Check for jumping out of range. */
370 #ifdef BYTE_CODE_SAFE
372 #define CHECK_RANGE(ARG) \
373 if (ARG >= bytestr_length) abort ()
375 #else /* not BYTE_CODE_SAFE */
377 #define CHECK_RANGE(ARG)
379 #endif /* not BYTE_CODE_SAFE */
381 /* A version of the QUIT macro which makes sure that the stack top is
382 set before signaling `quit'. */
384 #define BYTE_CODE_QUIT \
386 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
388 Lisp_Object flag = Vquit_flag; \
390 BEFORE_POTENTIAL_GC (); \
391 if (EQ (Vthrow_on_input, flag)) \
392 Fthrow (Vthrow_on_input, Qt); \
393 Fsignal (Qquit, Qnil); \
394 AFTER_POTENTIAL_GC (); \
396 ELSE_PENDING_SIGNALS \
400 DEFUN ("byte-code", Fbyte_code
, Sbyte_code
, 3, 3, 0,
401 doc
: /* Function used internally in byte-compiled code.
402 The first argument, BYTESTR, is a string of byte code;
403 the second, VECTOR, a vector of constants;
404 the third, MAXDEPTH, the maximum stack depth used in this function.
405 If the third argument is incorrect, Emacs may crash. */)
406 (bytestr
, vector
, maxdepth
)
407 Lisp_Object bytestr
, vector
, maxdepth
;
409 int count
= SPECPDL_INDEX ();
410 #ifdef BYTE_CODE_METER
415 /* Lisp_Object v1, v2; */
416 Lisp_Object
*vectorp
;
417 #ifdef BYTE_CODE_SAFE
418 int const_length
= XVECTOR (vector
)->size
;
422 struct byte_stack stack
;
426 #if 0 /* CHECK_FRAME_FONT */
428 struct frame
*f
= SELECTED_FRAME ();
430 && FRAME_FONT (f
)->direction
!= 0
431 && FRAME_FONT (f
)->direction
!= 1)
436 CHECK_STRING (bytestr
);
437 CHECK_VECTOR (vector
);
438 CHECK_NUMBER (maxdepth
);
440 if (STRING_MULTIBYTE (bytestr
))
441 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
442 because they produced a raw 8-bit string for byte-code and now
443 such a byte-code string is loaded as multibyte while raw 8-bit
444 characters converted to multibyte form. Thus, now we must
445 convert them back to the originally intended unibyte form. */
446 bytestr
= Fstring_as_unibyte (bytestr
);
448 bytestr_length
= SBYTES (bytestr
);
449 vectorp
= XVECTOR (vector
)->contents
;
451 stack
.byte_string
= bytestr
;
452 stack
.pc
= stack
.byte_string_start
= SDATA (bytestr
);
453 stack
.constants
= vector
;
454 stack
.bottom
= (Lisp_Object
*) alloca (XFASTINT (maxdepth
)
455 * sizeof (Lisp_Object
));
456 top
= stack
.bottom
- 1;
458 stack
.next
= byte_stack_list
;
459 byte_stack_list
= &stack
;
461 #ifdef BYTE_CODE_SAFE
462 stacke
= stack
.bottom
- 1 + XFASTINT (maxdepth
);
467 #ifdef BYTE_CODE_SAFE
470 else if (top
< stack
.bottom
- 1)
474 #ifdef BYTE_CODE_METER
476 this_op
= op
= FETCH
;
477 METER_CODE (prev_op
, op
);
497 /* This seems to be the most frequently executed byte-code
498 among the Bvarref's, so avoid a goto here. */
508 if (XSYMBOL (v1
)->redirect
!= SYMBOL_PLAINVAL
509 || (v2
= SYMBOL_VAL (XSYMBOL (v1
)),
512 BEFORE_POTENTIAL_GC ();
513 v2
= Fsymbol_value (v1
);
514 AFTER_POTENTIAL_GC ();
519 BEFORE_POTENTIAL_GC ();
520 v2
= Fsymbol_value (v1
);
521 AFTER_POTENTIAL_GC ();
537 stack
.pc
= stack
.byte_string_start
+ op
;
554 TOP
= EQ (v1
, TOP
) ? Qt
: Qnil
;
561 BEFORE_POTENTIAL_GC ();
563 TOP
= Fmemq (TOP
, v1
);
564 AFTER_POTENTIAL_GC ();
593 Lisp_Object sym
, val
;
598 /* Inline the most common case. */
600 && !EQ (val
, Qunbound
)
601 && !XSYMBOL (sym
)->redirect
602 && !SYMBOL_CONSTANT_P (sym
))
603 XSYMBOL (sym
)->val
.value
= val
;
606 BEFORE_POTENTIAL_GC ();
607 set_internal (sym
, val
, Qnil
, 0);
608 AFTER_POTENTIAL_GC ();
622 /* ------------------ */
640 /* Specbind can signal and thus GC. */
641 BEFORE_POTENTIAL_GC ();
642 specbind (vectorp
[op
], POP
);
643 AFTER_POTENTIAL_GC ();
663 BEFORE_POTENTIAL_GC ();
665 #ifdef BYTE_CODE_METER
666 if (byte_metering_on
&& SYMBOLP (TOP
))
671 v2
= Fget (v1
, Qbyte_code_meter
);
673 && XINT (v2
) < MOST_POSITIVE_FIXNUM
)
675 XSETINT (v2
, XINT (v2
) + 1);
676 Fput (v1
, Qbyte_code_meter
, v2
);
680 TOP
= Ffuncall (op
+ 1, &TOP
);
681 AFTER_POTENTIAL_GC ();
701 BEFORE_POTENTIAL_GC ();
702 unbind_to (SPECPDL_INDEX () - op
, Qnil
);
703 AFTER_POTENTIAL_GC ();
707 /* To unbind back to the beginning of this frame. Not used yet,
708 but will be needed for tail-recursion elimination. */
709 BEFORE_POTENTIAL_GC ();
710 unbind_to (count
, Qnil
);
711 AFTER_POTENTIAL_GC ();
717 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
719 stack
.pc
= stack
.byte_string_start
+ op
;
732 stack
.pc
= stack
.byte_string_start
+ op
;
737 case Bgotoifnilelsepop
:
744 stack
.pc
= stack
.byte_string_start
+ op
;
749 case Bgotoifnonnilelsepop
:
756 stack
.pc
= stack
.byte_string_start
+ op
;
764 stack
.pc
+= (int) *stack
.pc
- 127;
775 stack
.pc
+= (int) *stack
.pc
- 128;
789 stack
.pc
+= (int) *stack
.pc
- 128;
795 case BRgotoifnilelsepop
:
801 stack
.pc
+= op
- 128;
806 case BRgotoifnonnilelsepop
:
812 stack
.pc
+= op
- 128;
826 PUSH (vectorp
[FETCH2
]);
829 case Bsave_excursion
:
830 record_unwind_protect (save_excursion_restore
,
831 save_excursion_save ());
834 case Bsave_current_buffer
:
835 case Bsave_current_buffer_1
:
836 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
839 case Bsave_window_excursion
:
840 BEFORE_POTENTIAL_GC ();
841 TOP
= Fsave_window_excursion (TOP
);
842 AFTER_POTENTIAL_GC ();
845 case Bsave_restriction
:
846 record_unwind_protect (save_restriction_restore
,
847 save_restriction_save ());
853 BEFORE_POTENTIAL_GC ();
855 TOP
= internal_catch (TOP
, Feval
, v1
);
856 AFTER_POTENTIAL_GC ();
860 case Bunwind_protect
:
861 record_unwind_protect (Fprogn
, POP
);
864 case Bcondition_case
:
866 Lisp_Object handlers
, body
;
869 BEFORE_POTENTIAL_GC ();
870 TOP
= internal_lisp_condition_case (TOP
, body
, handlers
);
871 AFTER_POTENTIAL_GC ();
875 case Btemp_output_buffer_setup
:
876 BEFORE_POTENTIAL_GC ();
878 temp_output_buffer_setup (SDATA (TOP
));
879 AFTER_POTENTIAL_GC ();
880 TOP
= Vstandard_output
;
883 case Btemp_output_buffer_show
:
886 BEFORE_POTENTIAL_GC ();
888 temp_output_buffer_show (TOP
);
890 /* pop binding of standard-output */
891 unbind_to (SPECPDL_INDEX () - 1, Qnil
);
892 AFTER_POTENTIAL_GC ();
899 BEFORE_POTENTIAL_GC ();
903 AFTER_POTENTIAL_GC ();
906 while (--op
>= 0 && CONSP (v1
))
914 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
918 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
922 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
926 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
930 TOP
= NILP (TOP
) ? Qt
: Qnil
;
937 TOP
= Fcons (TOP
, v1
);
942 TOP
= Fcons (TOP
, Qnil
);
949 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
955 TOP
= Flist (3, &TOP
);
960 TOP
= Flist (4, &TOP
);
966 TOP
= Flist (op
, &TOP
);
970 BEFORE_POTENTIAL_GC ();
972 AFTER_POTENTIAL_GC ();
978 BEFORE_POTENTIAL_GC ();
980 TOP
= Faref (TOP
, v1
);
981 AFTER_POTENTIAL_GC ();
988 BEFORE_POTENTIAL_GC ();
990 TOP
= Faset (TOP
, v1
, v2
);
991 AFTER_POTENTIAL_GC ();
996 BEFORE_POTENTIAL_GC ();
997 TOP
= Fsymbol_value (TOP
);
998 AFTER_POTENTIAL_GC ();
1001 case Bsymbol_function
:
1002 BEFORE_POTENTIAL_GC ();
1003 TOP
= Fsymbol_function (TOP
);
1004 AFTER_POTENTIAL_GC ();
1010 BEFORE_POTENTIAL_GC ();
1012 TOP
= Fset (TOP
, v1
);
1013 AFTER_POTENTIAL_GC ();
1020 BEFORE_POTENTIAL_GC ();
1022 TOP
= Ffset (TOP
, v1
);
1023 AFTER_POTENTIAL_GC ();
1030 BEFORE_POTENTIAL_GC ();
1032 TOP
= Fget (TOP
, v1
);
1033 AFTER_POTENTIAL_GC ();
1040 BEFORE_POTENTIAL_GC ();
1042 TOP
= Fsubstring (TOP
, v1
, v2
);
1043 AFTER_POTENTIAL_GC ();
1048 BEFORE_POTENTIAL_GC ();
1050 TOP
= Fconcat (2, &TOP
);
1051 AFTER_POTENTIAL_GC ();
1055 BEFORE_POTENTIAL_GC ();
1057 TOP
= Fconcat (3, &TOP
);
1058 AFTER_POTENTIAL_GC ();
1062 BEFORE_POTENTIAL_GC ();
1064 TOP
= Fconcat (4, &TOP
);
1065 AFTER_POTENTIAL_GC ();
1070 BEFORE_POTENTIAL_GC ();
1072 TOP
= Fconcat (op
, &TOP
);
1073 AFTER_POTENTIAL_GC ();
1082 XSETINT (v1
, XINT (v1
) - 1);
1087 BEFORE_POTENTIAL_GC ();
1089 AFTER_POTENTIAL_GC ();
1100 XSETINT (v1
, XINT (v1
) + 1);
1105 BEFORE_POTENTIAL_GC ();
1107 AFTER_POTENTIAL_GC ();
1115 BEFORE_POTENTIAL_GC ();
1117 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
);
1118 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
);
1119 AFTER_POTENTIAL_GC ();
1120 if (FLOATP (v1
) || FLOATP (v2
))
1124 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1125 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1126 TOP
= (f1
== f2
? Qt
: Qnil
);
1129 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1136 BEFORE_POTENTIAL_GC ();
1138 TOP
= Fgtr (TOP
, v1
);
1139 AFTER_POTENTIAL_GC ();
1146 BEFORE_POTENTIAL_GC ();
1148 TOP
= Flss (TOP
, v1
);
1149 AFTER_POTENTIAL_GC ();
1156 BEFORE_POTENTIAL_GC ();
1158 TOP
= Fleq (TOP
, v1
);
1159 AFTER_POTENTIAL_GC ();
1166 BEFORE_POTENTIAL_GC ();
1168 TOP
= Fgeq (TOP
, v1
);
1169 AFTER_POTENTIAL_GC ();
1174 BEFORE_POTENTIAL_GC ();
1176 TOP
= Fminus (2, &TOP
);
1177 AFTER_POTENTIAL_GC ();
1186 XSETINT (v1
, - XINT (v1
));
1191 BEFORE_POTENTIAL_GC ();
1192 TOP
= Fminus (1, &TOP
);
1193 AFTER_POTENTIAL_GC ();
1199 BEFORE_POTENTIAL_GC ();
1201 TOP
= Fplus (2, &TOP
);
1202 AFTER_POTENTIAL_GC ();
1206 BEFORE_POTENTIAL_GC ();
1208 TOP
= Fmax (2, &TOP
);
1209 AFTER_POTENTIAL_GC ();
1213 BEFORE_POTENTIAL_GC ();
1215 TOP
= Fmin (2, &TOP
);
1216 AFTER_POTENTIAL_GC ();
1220 BEFORE_POTENTIAL_GC ();
1222 TOP
= Ftimes (2, &TOP
);
1223 AFTER_POTENTIAL_GC ();
1227 BEFORE_POTENTIAL_GC ();
1229 TOP
= Fquo (2, &TOP
);
1230 AFTER_POTENTIAL_GC ();
1236 BEFORE_POTENTIAL_GC ();
1238 TOP
= Frem (TOP
, v1
);
1239 AFTER_POTENTIAL_GC ();
1246 XSETFASTINT (v1
, PT
);
1252 BEFORE_POTENTIAL_GC ();
1253 TOP
= Fgoto_char (TOP
);
1254 AFTER_POTENTIAL_GC ();
1258 BEFORE_POTENTIAL_GC ();
1259 TOP
= Finsert (1, &TOP
);
1260 AFTER_POTENTIAL_GC ();
1265 BEFORE_POTENTIAL_GC ();
1267 TOP
= Finsert (op
, &TOP
);
1268 AFTER_POTENTIAL_GC ();
1274 XSETFASTINT (v1
, ZV
);
1282 XSETFASTINT (v1
, BEGV
);
1288 BEFORE_POTENTIAL_GC ();
1289 TOP
= Fchar_after (TOP
);
1290 AFTER_POTENTIAL_GC ();
1293 case Bfollowing_char
:
1296 BEFORE_POTENTIAL_GC ();
1297 v1
= Ffollowing_char ();
1298 AFTER_POTENTIAL_GC ();
1303 case Bpreceding_char
:
1306 BEFORE_POTENTIAL_GC ();
1307 v1
= Fprevious_char ();
1308 AFTER_POTENTIAL_GC ();
1313 case Bcurrent_column
:
1316 BEFORE_POTENTIAL_GC ();
1317 XSETFASTINT (v1
, (int) current_column ()); /* iftc */
1318 AFTER_POTENTIAL_GC ();
1324 BEFORE_POTENTIAL_GC ();
1325 TOP
= Findent_to (TOP
, Qnil
);
1326 AFTER_POTENTIAL_GC ();
1345 case Bcurrent_buffer
:
1346 PUSH (Fcurrent_buffer ());
1350 BEFORE_POTENTIAL_GC ();
1351 TOP
= Fset_buffer (TOP
);
1352 AFTER_POTENTIAL_GC ();
1355 case Binteractive_p
:
1356 PUSH (Finteractive_p ());
1360 BEFORE_POTENTIAL_GC ();
1361 TOP
= Fforward_char (TOP
);
1362 AFTER_POTENTIAL_GC ();
1366 BEFORE_POTENTIAL_GC ();
1367 TOP
= Fforward_word (TOP
);
1368 AFTER_POTENTIAL_GC ();
1371 case Bskip_chars_forward
:
1374 BEFORE_POTENTIAL_GC ();
1376 TOP
= Fskip_chars_forward (TOP
, v1
);
1377 AFTER_POTENTIAL_GC ();
1381 case Bskip_chars_backward
:
1384 BEFORE_POTENTIAL_GC ();
1386 TOP
= Fskip_chars_backward (TOP
, v1
);
1387 AFTER_POTENTIAL_GC ();
1392 BEFORE_POTENTIAL_GC ();
1393 TOP
= Fforward_line (TOP
);
1394 AFTER_POTENTIAL_GC ();
1401 BEFORE_POTENTIAL_GC ();
1402 CHECK_CHARACTER (TOP
);
1403 AFTER_POTENTIAL_GC ();
1405 if (NILP (current_buffer
->enable_multibyte_characters
))
1406 MAKE_CHAR_MULTIBYTE (c
);
1407 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (c
)]);
1411 case Bbuffer_substring
:
1414 BEFORE_POTENTIAL_GC ();
1416 TOP
= Fbuffer_substring (TOP
, v1
);
1417 AFTER_POTENTIAL_GC ();
1421 case Bdelete_region
:
1424 BEFORE_POTENTIAL_GC ();
1426 TOP
= Fdelete_region (TOP
, v1
);
1427 AFTER_POTENTIAL_GC ();
1431 case Bnarrow_to_region
:
1434 BEFORE_POTENTIAL_GC ();
1436 TOP
= Fnarrow_to_region (TOP
, v1
);
1437 AFTER_POTENTIAL_GC ();
1442 BEFORE_POTENTIAL_GC ();
1444 AFTER_POTENTIAL_GC ();
1448 BEFORE_POTENTIAL_GC ();
1449 TOP
= Fend_of_line (TOP
);
1450 AFTER_POTENTIAL_GC ();
1456 BEFORE_POTENTIAL_GC ();
1459 TOP
= Fset_marker (TOP
, v2
, v1
);
1460 AFTER_POTENTIAL_GC ();
1464 case Bmatch_beginning
:
1465 BEFORE_POTENTIAL_GC ();
1466 TOP
= Fmatch_beginning (TOP
);
1467 AFTER_POTENTIAL_GC ();
1471 BEFORE_POTENTIAL_GC ();
1472 TOP
= Fmatch_end (TOP
);
1473 AFTER_POTENTIAL_GC ();
1477 BEFORE_POTENTIAL_GC ();
1478 TOP
= Fupcase (TOP
);
1479 AFTER_POTENTIAL_GC ();
1483 BEFORE_POTENTIAL_GC ();
1484 TOP
= Fdowncase (TOP
);
1485 AFTER_POTENTIAL_GC ();
1488 case Bstringeqlsign
:
1491 BEFORE_POTENTIAL_GC ();
1493 TOP
= Fstring_equal (TOP
, v1
);
1494 AFTER_POTENTIAL_GC ();
1501 BEFORE_POTENTIAL_GC ();
1503 TOP
= Fstring_lessp (TOP
, v1
);
1504 AFTER_POTENTIAL_GC ();
1512 TOP
= Fequal (TOP
, v1
);
1519 BEFORE_POTENTIAL_GC ();
1521 TOP
= Fnthcdr (TOP
, v1
);
1522 AFTER_POTENTIAL_GC ();
1531 /* Exchange args and then do nth. */
1532 BEFORE_POTENTIAL_GC ();
1536 AFTER_POTENTIAL_GC ();
1539 while (--op
>= 0 && CONSP (v1
))
1546 BEFORE_POTENTIAL_GC ();
1548 TOP
= Felt (TOP
, v1
);
1549 AFTER_POTENTIAL_GC ();
1557 BEFORE_POTENTIAL_GC ();
1559 TOP
= Fmember (TOP
, v1
);
1560 AFTER_POTENTIAL_GC ();
1567 BEFORE_POTENTIAL_GC ();
1569 TOP
= Fassq (TOP
, v1
);
1570 AFTER_POTENTIAL_GC ();
1575 BEFORE_POTENTIAL_GC ();
1576 TOP
= Fnreverse (TOP
);
1577 AFTER_POTENTIAL_GC ();
1583 BEFORE_POTENTIAL_GC ();
1585 TOP
= Fsetcar (TOP
, v1
);
1586 AFTER_POTENTIAL_GC ();
1593 BEFORE_POTENTIAL_GC ();
1595 TOP
= Fsetcdr (TOP
, v1
);
1596 AFTER_POTENTIAL_GC ();
1604 TOP
= CAR_SAFE (v1
);
1612 TOP
= CDR_SAFE (v1
);
1617 BEFORE_POTENTIAL_GC ();
1619 TOP
= Fnconc (2, &TOP
);
1620 AFTER_POTENTIAL_GC ();
1624 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1628 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1631 #ifdef BYTE_CODE_SAFE
1633 BEFORE_POTENTIAL_GC ();
1634 error ("set-mark is an obsolete bytecode");
1635 AFTER_POTENTIAL_GC ();
1638 BEFORE_POTENTIAL_GC ();
1639 error ("scan-buffer is an obsolete bytecode");
1640 AFTER_POTENTIAL_GC ();
1649 #ifdef BYTE_CODE_SAFE
1654 if ((op
-= Bconstant
) >= const_length
)
1660 PUSH (vectorp
[op
- Bconstant
]);
1667 byte_stack_list
= byte_stack_list
->next
;
1669 /* Binds and unbinds are supposed to be compiled balanced. */
1670 if (SPECPDL_INDEX () != count
)
1671 #ifdef BYTE_CODE_SAFE
1672 error ("binding stack not balanced (serious byte compiler bug)");
1683 Qbytecode
= intern_c_string ("byte-code");
1684 staticpro (&Qbytecode
);
1686 defsubr (&Sbyte_code
);
1688 #ifdef BYTE_CODE_METER
1690 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1691 doc
: /* A vector of vectors which holds a histogram of byte-code usage.
1692 \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte
1693 opcode CODE has been executed.
1694 \(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
1695 indicates how many times the byte opcodes CODE1 and CODE2 have been
1696 executed in succession. */);
1698 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1699 doc
: /* If non-nil, keep profiling information on byte code usage.
1700 The variable byte-code-meter indicates how often each byte opcode is used.
1701 If a symbol has a property named `byte-code-meter' whose value is an
1702 integer, it is incremented each time that symbol's function is called. */);
1704 byte_metering_on
= 0;
1705 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1706 Qbyte_code_meter
= intern_c_string ("byte-code-meter");
1707 staticpro (&Qbyte_code_meter
);
1711 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1712 Fmake_vector (make_number (256), make_number (0));
1717 /* arch-tag: b9803b6f-1ed6-4190-8adf-33fd3a9d10e9
1718 (do not change this comment) */