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 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.
39 #include "character.h"
43 #ifdef CHECK_FRAME_FONT
49 * define BYTE_CODE_SAFE to enable some minor sanity checking (useful for
50 * debugging the byte compiler...)
52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
54 /* #define BYTE_CODE_SAFE */
55 /* #define BYTE_CODE_METER */
58 #ifdef BYTE_CODE_METER
60 Lisp_Object Vbyte_code_meter
, Qbyte_code_meter
;
63 #define METER_2(code1, code2) \
64 XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
67 #define METER_1(code) METER_2 (0, (code))
69 #define METER_CODE(last_code, this_code) \
71 if (byte_metering_on) \
73 if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM) \
74 METER_1 (this_code)++; \
76 && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM) \
77 METER_2 (last_code, this_code)++; \
81 #else /* no BYTE_CODE_METER */
83 #define METER_CODE(last_code, this_code)
85 #endif /* no BYTE_CODE_METER */
88 Lisp_Object Qbytecode
;
116 #define Bsymbol_value 0112
117 #define Bsymbol_function 0113
121 #define Bsubstring 0117
122 #define Bconcat2 0120
123 #define Bconcat3 0121
124 #define Bconcat4 0122
127 #define Beqlsign 0125
140 /* Was Bmark in v17. */
141 #define Bsave_current_buffer 0141
142 #define Bgoto_char 0142
144 #define Bpoint_max 0144
145 #define Bpoint_min 0145
146 #define Bchar_after 0146
147 #define Bfollowing_char 0147
148 #define Bpreceding_char 0150
149 #define Bcurrent_column 0151
150 #define Bindent_to 0152
151 #define Bscan_buffer 0153 /* No longer generated as of v18 */
156 #define Bcurrent_buffer 0160
157 #define Bset_buffer 0161
158 #define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */
159 #define Bread_char 0162 /* No longer generated as of v19 */
160 #define Bset_mark 0163 /* this loser is no longer generated as of v18 */
161 #define Binteractive_p 0164 /* Needed since interactive-p takes unevalled args */
163 #define Bforward_char 0165
164 #define Bforward_word 0166
165 #define Bskip_chars_forward 0167
166 #define Bskip_chars_backward 0170
167 #define Bforward_line 0171
168 #define Bchar_syntax 0172
169 #define Bbuffer_substring 0173
170 #define Bdelete_region 0174
171 #define Bnarrow_to_region 0175
173 #define Bend_of_line 0177
175 #define Bconstant2 0201
177 #define Bgotoifnil 0203
178 #define Bgotoifnonnil 0204
179 #define Bgotoifnilelsepop 0205
180 #define Bgotoifnonnilelsepop 0206
182 #define Bdiscard 0210
185 #define Bsave_excursion 0212
186 #define Bsave_window_excursion 0213
187 #define Bsave_restriction 0214
190 #define Bunwind_protect 0216
191 #define Bcondition_case 0217
192 #define Btemp_output_buffer_setup 0220
193 #define Btemp_output_buffer_show 0221
195 #define Bunbind_all 0222
197 #define Bset_marker 0223
198 #define Bmatch_beginning 0224
199 #define Bmatch_end 0225
201 #define Bdowncase 0227
203 #define Bstringeqlsign 0230
204 #define Bstringlss 0231
210 #define Bnreverse 0237
213 #define Bcar_safe 0242
214 #define Bcdr_safe 0243
218 #define Bnumberp 0247
219 #define Bintegerp 0250
222 #define BRgotoifnil 0253
223 #define BRgotoifnonnil 0254
224 #define BRgotoifnilelsepop 0255
225 #define BRgotoifnonnilelsepop 0256
228 #define BconcatN 0260
229 #define BinsertN 0261
231 #define Bconstant 0300
232 #define CONSTANTLIM 0100
235 /* Structure describing a value stack used during byte-code execution
240 /* Program counter. This points into the byte_string below
241 and is relocated when that string is relocated. */
242 const unsigned char *pc
;
244 /* Top and bottom of stack. The bottom points to an area of memory
245 allocated with alloca in Fbyte_code. */
246 Lisp_Object
*top
, *bottom
;
248 /* The string containing the byte-code, and its current address.
249 Storing this here protects it from GC because mark_byte_stack
251 Lisp_Object byte_string
;
252 const unsigned char *byte_string_start
;
254 /* The vector of constants used during byte-code execution. Storing
255 this here protects it from GC because mark_byte_stack marks it. */
256 Lisp_Object constants
;
258 /* Next entry in byte_stack_list. */
259 struct byte_stack
*next
;
262 /* A list of currently active byte-code execution value stacks.
263 Fbyte_code adds an entry to the head of this list before it starts
264 processing byte-code, and it removed the entry again when it is
265 done. Signalling an error truncates the list analoguous to
268 struct byte_stack
*byte_stack_list
;
271 /* Mark objects on byte_stack_list. Called during GC. */
276 struct byte_stack
*stack
;
279 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
281 /* If STACK->top is null here, this means there's an opcode in
282 Fbyte_code that wasn't expected to GC, but did. To find out
283 which opcode this is, record the value of `stack', and walk
284 up the stack in a debugger, stopping in frames of Fbyte_code.
285 The culprit is found in the frame of Fbyte_code where the
286 address of its local variable `stack' is equal to the
287 recorded value of `stack' here. */
288 eassert (stack
->top
);
290 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
293 mark_object (stack
->byte_string
);
294 mark_object (stack
->constants
);
299 /* Unmark objects in the stacks on byte_stack_list. Relocate program
300 counters. Called when GC has completed. */
305 struct byte_stack
*stack
;
307 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
309 if (stack
->byte_string_start
!= SDATA (stack
->byte_string
))
311 int offset
= stack
->pc
- stack
->byte_string_start
;
312 stack
->byte_string_start
= SDATA (stack
->byte_string
);
313 stack
->pc
= stack
->byte_string_start
+ offset
;
319 /* Fetch the next byte from the bytecode stream */
321 #define FETCH *stack.pc++
323 /* Fetch two bytes from the bytecode stream and make a 16-bit number
326 #define FETCH2 (op = FETCH, op + (FETCH << 8))
328 /* Push x onto the execution stack. This used to be #define PUSH(x)
329 (*++stackp = (x)) This oddity is necessary because Alliant can't be
330 bothered to compile the preincrement operator properly, as of 4/91.
333 #define PUSH(x) (top++, *top = (x))
335 /* Pop a value off the execution stack. */
339 /* Discard n values from the execution stack. */
341 #define DISCARD(n) (top -= (n))
343 /* Get the value which is at the top of the execution stack, but don't
348 /* Actions that must be performed before and after calling a function
351 #define BEFORE_POTENTIAL_GC() stack.top = top
352 #define AFTER_POTENTIAL_GC() stack.top = NULL
354 /* Garbage collect if we have consed enough since the last time.
355 We do this at every branch, to avoid loops that never GC. */
358 if (consing_since_gc > gc_cons_threshold \
359 && consing_since_gc > gc_relative_threshold) \
361 BEFORE_POTENTIAL_GC (); \
362 Fgarbage_collect (); \
363 AFTER_POTENTIAL_GC (); \
367 /* Check for jumping out of range. */
369 #ifdef BYTE_CODE_SAFE
371 #define CHECK_RANGE(ARG) \
372 if (ARG >= bytestr_length) abort ()
374 #else /* not BYTE_CODE_SAFE */
376 #define CHECK_RANGE(ARG)
378 #endif /* not BYTE_CODE_SAFE */
380 /* A version of the QUIT macro which makes sure that the stack top is
381 set before signaling `quit'. */
383 #define BYTE_CODE_QUIT \
385 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
387 Lisp_Object flag = Vquit_flag; \
389 BEFORE_POTENTIAL_GC (); \
390 if (EQ (Vthrow_on_input, flag)) \
391 Fthrow (Vthrow_on_input, Qt); \
392 Fsignal (Qquit, Qnil); \
393 AFTER_POTENTIAL_GC (); \
398 DEFUN ("byte-code", Fbyte_code
, Sbyte_code
, 3, 3, 0,
399 doc
: /* Function used internally in byte-compiled code.
400 The first argument, BYTESTR, is a string of byte code;
401 the second, VECTOR, a vector of constants;
402 the third, MAXDEPTH, the maximum stack depth used in this function.
403 If the third argument is incorrect, Emacs may crash. */)
404 (bytestr
, vector
, maxdepth
)
405 Lisp_Object bytestr
, vector
, maxdepth
;
407 int count
= SPECPDL_INDEX ();
408 #ifdef BYTE_CODE_METER
413 /* Lisp_Object v1, v2; */
414 Lisp_Object
*vectorp
;
415 #ifdef BYTE_CODE_SAFE
416 int const_length
= XVECTOR (vector
)->size
;
420 struct byte_stack stack
;
424 #if 0 /* CHECK_FRAME_FONT */
426 struct frame
*f
= SELECTED_FRAME ();
428 && FRAME_FONT (f
)->direction
!= 0
429 && FRAME_FONT (f
)->direction
!= 1)
434 CHECK_STRING (bytestr
);
435 CHECK_VECTOR (vector
);
436 CHECK_NUMBER (maxdepth
);
438 if (STRING_MULTIBYTE (bytestr
))
439 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
440 because they produced a raw 8-bit string for byte-code and now
441 such a byte-code string is loaded as multibyte while raw 8-bit
442 characters converted to multibyte form. Thus, now we must
443 convert them back to the originally intended unibyte form. */
444 bytestr
= Fstring_as_unibyte (bytestr
);
446 bytestr_length
= SBYTES (bytestr
);
447 vectorp
= XVECTOR (vector
)->contents
;
449 stack
.byte_string
= bytestr
;
450 stack
.pc
= stack
.byte_string_start
= SDATA (bytestr
);
451 stack
.constants
= vector
;
452 stack
.bottom
= (Lisp_Object
*) alloca (XFASTINT (maxdepth
)
453 * sizeof (Lisp_Object
));
454 top
= stack
.bottom
- 1;
456 stack
.next
= byte_stack_list
;
457 byte_stack_list
= &stack
;
459 #ifdef BYTE_CODE_SAFE
460 stacke
= stack
.bottom
- 1 + XFASTINT (maxdepth
);
465 #ifdef BYTE_CODE_SAFE
468 else if (top
< stack
.bottom
- 1)
472 #ifdef BYTE_CODE_METER
474 this_op
= op
= FETCH
;
475 METER_CODE (prev_op
, op
);
495 /* This seems to be the most frequently executed byte-code
496 among the Bvarref's, so avoid a goto here. */
506 v2
= SYMBOL_VALUE (v1
);
507 if (MISCP (v2
) || EQ (v2
, Qunbound
))
509 BEFORE_POTENTIAL_GC ();
510 v2
= Fsymbol_value (v1
);
511 AFTER_POTENTIAL_GC ();
516 BEFORE_POTENTIAL_GC ();
517 v2
= Fsymbol_value (v1
);
518 AFTER_POTENTIAL_GC ();
534 stack
.pc
= stack
.byte_string_start
+ op
;
551 TOP
= EQ (v1
, TOP
) ? Qt
: Qnil
;
558 BEFORE_POTENTIAL_GC ();
560 TOP
= Fmemq (TOP
, v1
);
561 AFTER_POTENTIAL_GC ();
590 Lisp_Object sym
, val
;
595 /* Inline the most common case. */
597 && !EQ (val
, Qunbound
)
598 && !XSYMBOL (sym
)->indirect_variable
599 && !SYMBOL_CONSTANT_P (sym
)
600 && !MISCP (XSYMBOL (sym
)->value
))
601 XSYMBOL (sym
)->value
= val
;
604 BEFORE_POTENTIAL_GC ();
605 set_internal (sym
, val
, current_buffer
, 0);
606 AFTER_POTENTIAL_GC ();
620 /* ------------------ */
638 /* Specbind can signal and thus GC. */
639 BEFORE_POTENTIAL_GC ();
640 specbind (vectorp
[op
], POP
);
641 AFTER_POTENTIAL_GC ();
661 BEFORE_POTENTIAL_GC ();
663 #ifdef BYTE_CODE_METER
664 if (byte_metering_on
&& SYMBOLP (TOP
))
669 v2
= Fget (v1
, Qbyte_code_meter
);
671 && XINT (v2
) < MOST_POSITIVE_FIXNUM
)
673 XSETINT (v2
, XINT (v2
) + 1);
674 Fput (v1
, Qbyte_code_meter
, v2
);
678 TOP
= Ffuncall (op
+ 1, &TOP
);
679 AFTER_POTENTIAL_GC ();
699 BEFORE_POTENTIAL_GC ();
700 unbind_to (SPECPDL_INDEX () - op
, Qnil
);
701 AFTER_POTENTIAL_GC ();
705 /* To unbind back to the beginning of this frame. Not used yet,
706 but will be needed for tail-recursion elimination. */
707 BEFORE_POTENTIAL_GC ();
708 unbind_to (count
, Qnil
);
709 AFTER_POTENTIAL_GC ();
715 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
717 stack
.pc
= stack
.byte_string_start
+ op
;
730 stack
.pc
= stack
.byte_string_start
+ op
;
735 case Bgotoifnilelsepop
:
742 stack
.pc
= stack
.byte_string_start
+ op
;
747 case Bgotoifnonnilelsepop
:
754 stack
.pc
= stack
.byte_string_start
+ op
;
762 stack
.pc
+= (int) *stack
.pc
- 127;
773 stack
.pc
+= (int) *stack
.pc
- 128;
787 stack
.pc
+= (int) *stack
.pc
- 128;
793 case BRgotoifnilelsepop
:
799 stack
.pc
+= op
- 128;
804 case BRgotoifnonnilelsepop
:
810 stack
.pc
+= op
- 128;
824 PUSH (vectorp
[FETCH2
]);
827 case Bsave_excursion
:
828 record_unwind_protect (save_excursion_restore
,
829 save_excursion_save ());
832 case Bsave_current_buffer
:
833 case Bsave_current_buffer_1
:
834 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
837 case Bsave_window_excursion
:
838 BEFORE_POTENTIAL_GC ();
839 TOP
= Fsave_window_excursion (TOP
);
840 AFTER_POTENTIAL_GC ();
843 case Bsave_restriction
:
844 record_unwind_protect (save_restriction_restore
,
845 save_restriction_save ());
851 BEFORE_POTENTIAL_GC ();
853 TOP
= internal_catch (TOP
, Feval
, v1
);
854 AFTER_POTENTIAL_GC ();
858 case Bunwind_protect
:
859 record_unwind_protect (Fprogn
, POP
);
862 case Bcondition_case
:
864 Lisp_Object handlers
, body
;
867 BEFORE_POTENTIAL_GC ();
868 TOP
= internal_lisp_condition_case (TOP
, body
, handlers
);
869 AFTER_POTENTIAL_GC ();
873 case Btemp_output_buffer_setup
:
874 BEFORE_POTENTIAL_GC ();
876 temp_output_buffer_setup (SDATA (TOP
));
877 AFTER_POTENTIAL_GC ();
878 TOP
= Vstandard_output
;
881 case Btemp_output_buffer_show
:
884 BEFORE_POTENTIAL_GC ();
886 temp_output_buffer_show (TOP
);
888 /* pop binding of standard-output */
889 unbind_to (SPECPDL_INDEX () - 1, Qnil
);
890 AFTER_POTENTIAL_GC ();
897 BEFORE_POTENTIAL_GC ();
901 AFTER_POTENTIAL_GC ();
904 while (--op
>= 0 && CONSP (v1
))
912 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
916 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
920 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
924 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
928 TOP
= NILP (TOP
) ? Qt
: Qnil
;
935 TOP
= Fcons (TOP
, v1
);
940 TOP
= Fcons (TOP
, Qnil
);
947 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
953 TOP
= Flist (3, &TOP
);
958 TOP
= Flist (4, &TOP
);
964 TOP
= Flist (op
, &TOP
);
968 BEFORE_POTENTIAL_GC ();
970 AFTER_POTENTIAL_GC ();
976 BEFORE_POTENTIAL_GC ();
978 TOP
= Faref (TOP
, v1
);
979 AFTER_POTENTIAL_GC ();
986 BEFORE_POTENTIAL_GC ();
988 TOP
= Faset (TOP
, v1
, v2
);
989 AFTER_POTENTIAL_GC ();
994 BEFORE_POTENTIAL_GC ();
995 TOP
= Fsymbol_value (TOP
);
996 AFTER_POTENTIAL_GC ();
999 case Bsymbol_function
:
1000 BEFORE_POTENTIAL_GC ();
1001 TOP
= Fsymbol_function (TOP
);
1002 AFTER_POTENTIAL_GC ();
1008 BEFORE_POTENTIAL_GC ();
1010 TOP
= Fset (TOP
, v1
);
1011 AFTER_POTENTIAL_GC ();
1018 BEFORE_POTENTIAL_GC ();
1020 TOP
= Ffset (TOP
, v1
);
1021 AFTER_POTENTIAL_GC ();
1028 BEFORE_POTENTIAL_GC ();
1030 TOP
= Fget (TOP
, v1
);
1031 AFTER_POTENTIAL_GC ();
1038 BEFORE_POTENTIAL_GC ();
1040 TOP
= Fsubstring (TOP
, v1
, v2
);
1041 AFTER_POTENTIAL_GC ();
1046 BEFORE_POTENTIAL_GC ();
1048 TOP
= Fconcat (2, &TOP
);
1049 AFTER_POTENTIAL_GC ();
1053 BEFORE_POTENTIAL_GC ();
1055 TOP
= Fconcat (3, &TOP
);
1056 AFTER_POTENTIAL_GC ();
1060 BEFORE_POTENTIAL_GC ();
1062 TOP
= Fconcat (4, &TOP
);
1063 AFTER_POTENTIAL_GC ();
1068 BEFORE_POTENTIAL_GC ();
1070 TOP
= Fconcat (op
, &TOP
);
1071 AFTER_POTENTIAL_GC ();
1080 XSETINT (v1
, XINT (v1
) - 1);
1085 BEFORE_POTENTIAL_GC ();
1087 AFTER_POTENTIAL_GC ();
1098 XSETINT (v1
, XINT (v1
) + 1);
1103 BEFORE_POTENTIAL_GC ();
1105 AFTER_POTENTIAL_GC ();
1113 BEFORE_POTENTIAL_GC ();
1115 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
);
1116 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
);
1117 AFTER_POTENTIAL_GC ();
1118 if (FLOATP (v1
) || FLOATP (v2
))
1122 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1123 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1124 TOP
= (f1
== f2
? Qt
: Qnil
);
1127 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1134 BEFORE_POTENTIAL_GC ();
1136 TOP
= Fgtr (TOP
, v1
);
1137 AFTER_POTENTIAL_GC ();
1144 BEFORE_POTENTIAL_GC ();
1146 TOP
= Flss (TOP
, v1
);
1147 AFTER_POTENTIAL_GC ();
1154 BEFORE_POTENTIAL_GC ();
1156 TOP
= Fleq (TOP
, v1
);
1157 AFTER_POTENTIAL_GC ();
1164 BEFORE_POTENTIAL_GC ();
1166 TOP
= Fgeq (TOP
, v1
);
1167 AFTER_POTENTIAL_GC ();
1172 BEFORE_POTENTIAL_GC ();
1174 TOP
= Fminus (2, &TOP
);
1175 AFTER_POTENTIAL_GC ();
1184 XSETINT (v1
, - XINT (v1
));
1189 BEFORE_POTENTIAL_GC ();
1190 TOP
= Fminus (1, &TOP
);
1191 AFTER_POTENTIAL_GC ();
1197 BEFORE_POTENTIAL_GC ();
1199 TOP
= Fplus (2, &TOP
);
1200 AFTER_POTENTIAL_GC ();
1204 BEFORE_POTENTIAL_GC ();
1206 TOP
= Fmax (2, &TOP
);
1207 AFTER_POTENTIAL_GC ();
1211 BEFORE_POTENTIAL_GC ();
1213 TOP
= Fmin (2, &TOP
);
1214 AFTER_POTENTIAL_GC ();
1218 BEFORE_POTENTIAL_GC ();
1220 TOP
= Ftimes (2, &TOP
);
1221 AFTER_POTENTIAL_GC ();
1225 BEFORE_POTENTIAL_GC ();
1227 TOP
= Fquo (2, &TOP
);
1228 AFTER_POTENTIAL_GC ();
1234 BEFORE_POTENTIAL_GC ();
1236 TOP
= Frem (TOP
, v1
);
1237 AFTER_POTENTIAL_GC ();
1244 XSETFASTINT (v1
, PT
);
1250 BEFORE_POTENTIAL_GC ();
1251 TOP
= Fgoto_char (TOP
);
1252 AFTER_POTENTIAL_GC ();
1256 BEFORE_POTENTIAL_GC ();
1257 TOP
= Finsert (1, &TOP
);
1258 AFTER_POTENTIAL_GC ();
1263 BEFORE_POTENTIAL_GC ();
1265 TOP
= Finsert (op
, &TOP
);
1266 AFTER_POTENTIAL_GC ();
1272 XSETFASTINT (v1
, ZV
);
1280 XSETFASTINT (v1
, BEGV
);
1286 BEFORE_POTENTIAL_GC ();
1287 TOP
= Fchar_after (TOP
);
1288 AFTER_POTENTIAL_GC ();
1291 case Bfollowing_char
:
1294 BEFORE_POTENTIAL_GC ();
1295 v1
= Ffollowing_char ();
1296 AFTER_POTENTIAL_GC ();
1301 case Bpreceding_char
:
1304 BEFORE_POTENTIAL_GC ();
1305 v1
= Fprevious_char ();
1306 AFTER_POTENTIAL_GC ();
1311 case Bcurrent_column
:
1314 BEFORE_POTENTIAL_GC ();
1315 XSETFASTINT (v1
, (int) current_column ()); /* iftc */
1316 AFTER_POTENTIAL_GC ();
1322 BEFORE_POTENTIAL_GC ();
1323 TOP
= Findent_to (TOP
, Qnil
);
1324 AFTER_POTENTIAL_GC ();
1343 case Bcurrent_buffer
:
1344 PUSH (Fcurrent_buffer ());
1348 BEFORE_POTENTIAL_GC ();
1349 TOP
= Fset_buffer (TOP
);
1350 AFTER_POTENTIAL_GC ();
1353 case Binteractive_p
:
1354 PUSH (Finteractive_p ());
1358 BEFORE_POTENTIAL_GC ();
1359 TOP
= Fforward_char (TOP
);
1360 AFTER_POTENTIAL_GC ();
1364 BEFORE_POTENTIAL_GC ();
1365 TOP
= Fforward_word (TOP
);
1366 AFTER_POTENTIAL_GC ();
1369 case Bskip_chars_forward
:
1372 BEFORE_POTENTIAL_GC ();
1374 TOP
= Fskip_chars_forward (TOP
, v1
);
1375 AFTER_POTENTIAL_GC ();
1379 case Bskip_chars_backward
:
1382 BEFORE_POTENTIAL_GC ();
1384 TOP
= Fskip_chars_backward (TOP
, v1
);
1385 AFTER_POTENTIAL_GC ();
1390 BEFORE_POTENTIAL_GC ();
1391 TOP
= Fforward_line (TOP
);
1392 AFTER_POTENTIAL_GC ();
1399 BEFORE_POTENTIAL_GC ();
1400 CHECK_CHARACTER (TOP
);
1401 AFTER_POTENTIAL_GC ();
1403 if (NILP (current_buffer
->enable_multibyte_characters
))
1404 MAKE_CHAR_MULTIBYTE (c
);
1405 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (c
)]);
1409 case Bbuffer_substring
:
1412 BEFORE_POTENTIAL_GC ();
1414 TOP
= Fbuffer_substring (TOP
, v1
);
1415 AFTER_POTENTIAL_GC ();
1419 case Bdelete_region
:
1422 BEFORE_POTENTIAL_GC ();
1424 TOP
= Fdelete_region (TOP
, v1
);
1425 AFTER_POTENTIAL_GC ();
1429 case Bnarrow_to_region
:
1432 BEFORE_POTENTIAL_GC ();
1434 TOP
= Fnarrow_to_region (TOP
, v1
);
1435 AFTER_POTENTIAL_GC ();
1440 BEFORE_POTENTIAL_GC ();
1442 AFTER_POTENTIAL_GC ();
1446 BEFORE_POTENTIAL_GC ();
1447 TOP
= Fend_of_line (TOP
);
1448 AFTER_POTENTIAL_GC ();
1454 BEFORE_POTENTIAL_GC ();
1457 TOP
= Fset_marker (TOP
, v2
, v1
);
1458 AFTER_POTENTIAL_GC ();
1462 case Bmatch_beginning
:
1463 BEFORE_POTENTIAL_GC ();
1464 TOP
= Fmatch_beginning (TOP
);
1465 AFTER_POTENTIAL_GC ();
1469 BEFORE_POTENTIAL_GC ();
1470 TOP
= Fmatch_end (TOP
);
1471 AFTER_POTENTIAL_GC ();
1475 BEFORE_POTENTIAL_GC ();
1476 TOP
= Fupcase (TOP
);
1477 AFTER_POTENTIAL_GC ();
1481 BEFORE_POTENTIAL_GC ();
1482 TOP
= Fdowncase (TOP
);
1483 AFTER_POTENTIAL_GC ();
1486 case Bstringeqlsign
:
1489 BEFORE_POTENTIAL_GC ();
1491 TOP
= Fstring_equal (TOP
, v1
);
1492 AFTER_POTENTIAL_GC ();
1499 BEFORE_POTENTIAL_GC ();
1501 TOP
= Fstring_lessp (TOP
, v1
);
1502 AFTER_POTENTIAL_GC ();
1510 TOP
= Fequal (TOP
, v1
);
1517 BEFORE_POTENTIAL_GC ();
1519 TOP
= Fnthcdr (TOP
, v1
);
1520 AFTER_POTENTIAL_GC ();
1529 /* Exchange args and then do nth. */
1530 BEFORE_POTENTIAL_GC ();
1534 AFTER_POTENTIAL_GC ();
1537 while (--op
>= 0 && CONSP (v1
))
1544 BEFORE_POTENTIAL_GC ();
1546 TOP
= Felt (TOP
, v1
);
1547 AFTER_POTENTIAL_GC ();
1555 BEFORE_POTENTIAL_GC ();
1557 TOP
= Fmember (TOP
, v1
);
1558 AFTER_POTENTIAL_GC ();
1565 BEFORE_POTENTIAL_GC ();
1567 TOP
= Fassq (TOP
, v1
);
1568 AFTER_POTENTIAL_GC ();
1573 BEFORE_POTENTIAL_GC ();
1574 TOP
= Fnreverse (TOP
);
1575 AFTER_POTENTIAL_GC ();
1581 BEFORE_POTENTIAL_GC ();
1583 TOP
= Fsetcar (TOP
, v1
);
1584 AFTER_POTENTIAL_GC ();
1591 BEFORE_POTENTIAL_GC ();
1593 TOP
= Fsetcdr (TOP
, v1
);
1594 AFTER_POTENTIAL_GC ();
1602 TOP
= CAR_SAFE (v1
);
1610 TOP
= CDR_SAFE (v1
);
1615 BEFORE_POTENTIAL_GC ();
1617 TOP
= Fnconc (2, &TOP
);
1618 AFTER_POTENTIAL_GC ();
1622 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1626 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1629 #ifdef BYTE_CODE_SAFE
1631 BEFORE_POTENTIAL_GC ();
1632 error ("set-mark is an obsolete bytecode");
1633 AFTER_POTENTIAL_GC ();
1636 BEFORE_POTENTIAL_GC ();
1637 error ("scan-buffer is an obsolete bytecode");
1638 AFTER_POTENTIAL_GC ();
1647 #ifdef BYTE_CODE_SAFE
1652 if ((op
-= Bconstant
) >= const_length
)
1658 PUSH (vectorp
[op
- Bconstant
]);
1665 byte_stack_list
= byte_stack_list
->next
;
1667 /* Binds and unbinds are supposed to be compiled balanced. */
1668 if (SPECPDL_INDEX () != count
)
1669 #ifdef BYTE_CODE_SAFE
1670 error ("binding stack not balanced (serious byte compiler bug)");
1681 Qbytecode
= intern ("byte-code");
1682 staticpro (&Qbytecode
);
1684 defsubr (&Sbyte_code
);
1686 #ifdef BYTE_CODE_METER
1688 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1689 doc
: /* A vector of vectors which holds a histogram of byte-code usage.
1690 \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte
1691 opcode CODE has been executed.
1692 \(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
1693 indicates how many times the byte opcodes CODE1 and CODE2 have been
1694 executed in succession. */);
1696 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1697 doc
: /* If non-nil, keep profiling information on byte code usage.
1698 The variable byte-code-meter indicates how often each byte opcode is used.
1699 If a symbol has a property named `byte-code-meter' whose value is an
1700 integer, it is incremented each time that symbol's function is called. */);
1702 byte_metering_on
= 0;
1703 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1704 Qbyte_code_meter
= intern ("byte-code-meter");
1705 staticpro (&Qbyte_code_meter
);
1709 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1710 Fmake_vector (make_number (256), make_number (0));
1715 /* arch-tag: b9803b6f-1ed6-4190-8adf-33fd3a9d10e9
1716 (do not change this comment) */