1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001, 2002, 2003, 2004
3 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 2, or (at your option)
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; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 hacked on by jwz@lucid.com 17-jun-91
23 o added a compile-time switch to turn on simple sanity checking;
24 o put back the obsolete byte-codes for error-detection;
25 o added a new instruction, unbind_all, which I will use for
26 tail-recursion elimination;
27 o made temp_output_buffer_show be called with the right number
29 o made the new bytecodes be called with args in the right order;
30 o added metering support.
33 o added relative jump instructions;
34 o all conditionals now only do QUIT if they jump.
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) \
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)) \
388 BEFORE_POTENTIAL_GC (); \
389 Fsignal (Qquit, Qnil); \
390 AFTER_POTENTIAL_GC (); \
395 DEFUN ("byte-code", Fbyte_code
, Sbyte_code
, 3, 3, 0,
396 doc
: /* Function used internally in byte-compiled code.
397 The first argument, BYTESTR, is a string of byte code;
398 the second, VECTOR, a vector of constants;
399 the third, MAXDEPTH, the maximum stack depth used in this function.
400 If the third argument is incorrect, Emacs may crash. */)
401 (bytestr
, vector
, maxdepth
)
402 Lisp_Object bytestr
, vector
, maxdepth
;
404 int count
= SPECPDL_INDEX ();
405 #ifdef BYTE_CODE_METER
410 /* Lisp_Object v1, v2; */
411 Lisp_Object
*vectorp
;
412 #ifdef BYTE_CODE_SAFE
413 int const_length
= XVECTOR (vector
)->size
;
417 struct byte_stack stack
;
421 #ifdef CHECK_FRAME_FONT
423 struct frame
*f
= SELECTED_FRAME ();
425 && FRAME_FONT (f
)->direction
!= 0
426 && FRAME_FONT (f
)->direction
!= 1)
431 CHECK_STRING (bytestr
);
432 if (!VECTORP (vector
))
433 vector
= wrong_type_argument (Qvectorp
, vector
);
434 CHECK_NUMBER (maxdepth
);
436 if (STRING_MULTIBYTE (bytestr
))
437 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
438 because they produced a raw 8-bit string for byte-code and now
439 such a byte-code string is loaded as multibyte while raw 8-bit
440 characters converted to multibyte form. Thus, now we must
441 convert them back to the originally intended unibyte form. */
442 bytestr
= Fstring_as_unibyte (bytestr
);
444 bytestr_length
= SBYTES (bytestr
);
445 vectorp
= XVECTOR (vector
)->contents
;
447 stack
.byte_string
= bytestr
;
448 stack
.pc
= stack
.byte_string_start
= SDATA (bytestr
);
449 stack
.constants
= vector
;
450 stack
.bottom
= (Lisp_Object
*) alloca (XFASTINT (maxdepth
)
451 * sizeof (Lisp_Object
));
452 top
= stack
.bottom
- 1;
454 stack
.next
= byte_stack_list
;
455 byte_stack_list
= &stack
;
457 #ifdef BYTE_CODE_SAFE
458 stacke
= stack
.bottom
- 1 + XFASTINT (maxdepth
);
463 #ifdef BYTE_CODE_SAFE
466 else if (top
< stack
.bottom
- 1)
470 #ifdef BYTE_CODE_METER
472 this_op
= op
= FETCH
;
473 METER_CODE (prev_op
, op
);
493 /* This seems to be the most frequently executed byte-code
494 among the Bvarref's, so avoid a goto here. */
504 v2
= SYMBOL_VALUE (v1
);
505 if (MISCP (v2
) || EQ (v2
, Qunbound
))
507 BEFORE_POTENTIAL_GC ();
508 v2
= Fsymbol_value (v1
);
509 AFTER_POTENTIAL_GC ();
514 BEFORE_POTENTIAL_GC ();
515 v2
= Fsymbol_value (v1
);
516 AFTER_POTENTIAL_GC ();
529 stack
.pc
= stack
.byte_string_start
+ op
;
543 wrong_type_argument (Qlistp
, v1
);
552 TOP
= EQ (v1
, TOP
) ? Qt
: Qnil
;
559 BEFORE_POTENTIAL_GC ();
561 TOP
= Fmemq (TOP
, v1
);
562 AFTER_POTENTIAL_GC ();
576 wrong_type_argument (Qlistp
, v1
);
598 Lisp_Object sym
, val
;
603 /* Inline the most common case. */
605 && !EQ (val
, Qunbound
)
606 && !XSYMBOL (sym
)->indirect_variable
607 && !XSYMBOL (sym
)->constant
608 && !MISCP (XSYMBOL (sym
)->value
))
609 XSYMBOL (sym
)->value
= val
;
612 BEFORE_POTENTIAL_GC ();
613 set_internal (sym
, val
, current_buffer
, 0);
614 AFTER_POTENTIAL_GC ();
628 /* ------------------ */
646 /* Specbind can signal and thus GC. */
647 BEFORE_POTENTIAL_GC ();
648 specbind (vectorp
[op
], POP
);
649 AFTER_POTENTIAL_GC ();
669 BEFORE_POTENTIAL_GC ();
671 #ifdef BYTE_CODE_METER
672 if (byte_metering_on
&& SYMBOLP (TOP
))
677 v2
= Fget (v1
, Qbyte_code_meter
);
679 && XINT (v2
) < MOST_POSITIVE_FIXNUM
)
681 XSETINT (v2
, XINT (v2
) + 1);
682 Fput (v1
, Qbyte_code_meter
, v2
);
686 TOP
= Ffuncall (op
+ 1, &TOP
);
687 AFTER_POTENTIAL_GC ();
707 BEFORE_POTENTIAL_GC ();
708 unbind_to (SPECPDL_INDEX () - op
, Qnil
);
709 AFTER_POTENTIAL_GC ();
713 /* To unbind back to the beginning of this frame. Not used yet,
714 but will be needed for tail-recursion elimination. */
715 BEFORE_POTENTIAL_GC ();
716 unbind_to (count
, Qnil
);
717 AFTER_POTENTIAL_GC ();
723 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
725 stack
.pc
= stack
.byte_string_start
+ op
;
735 stack
.pc
= stack
.byte_string_start
+ op
;
739 case Bgotoifnilelsepop
:
746 stack
.pc
= stack
.byte_string_start
+ op
;
751 case Bgotoifnonnilelsepop
:
758 stack
.pc
= stack
.byte_string_start
+ op
;
766 stack
.pc
+= (int) *stack
.pc
- 127;
774 stack
.pc
+= (int) *stack
.pc
- 128;
784 stack
.pc
+= (int) *stack
.pc
- 128;
789 case BRgotoifnilelsepop
:
795 stack
.pc
+= op
- 128;
800 case BRgotoifnonnilelsepop
:
806 stack
.pc
+= op
- 128;
820 PUSH (vectorp
[FETCH2
]);
823 case Bsave_excursion
:
824 record_unwind_protect (save_excursion_restore
,
825 save_excursion_save ());
828 case Bsave_current_buffer
:
829 case Bsave_current_buffer_1
:
830 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
833 case Bsave_window_excursion
:
834 BEFORE_POTENTIAL_GC ();
835 TOP
= Fsave_window_excursion (TOP
);
836 AFTER_POTENTIAL_GC ();
839 case Bsave_restriction
:
840 record_unwind_protect (save_restriction_restore
,
841 save_restriction_save ());
847 BEFORE_POTENTIAL_GC ();
849 TOP
= internal_catch (TOP
, Feval
, v1
);
850 AFTER_POTENTIAL_GC ();
854 case Bunwind_protect
:
855 record_unwind_protect (Fprogn
, POP
);
858 case Bcondition_case
:
862 v1
= Fcons (POP
, v1
);
863 BEFORE_POTENTIAL_GC ();
864 TOP
= Fcondition_case (Fcons (TOP
, v1
));
865 AFTER_POTENTIAL_GC ();
869 case Btemp_output_buffer_setup
:
870 BEFORE_POTENTIAL_GC ();
872 temp_output_buffer_setup (SDATA (TOP
));
873 AFTER_POTENTIAL_GC ();
874 TOP
= Vstandard_output
;
877 case Btemp_output_buffer_show
:
880 BEFORE_POTENTIAL_GC ();
882 temp_output_buffer_show (TOP
);
884 /* pop binding of standard-output */
885 unbind_to (SPECPDL_INDEX () - 1, Qnil
);
886 AFTER_POTENTIAL_GC ();
893 BEFORE_POTENTIAL_GC ();
897 AFTER_POTENTIAL_GC ();
907 wrong_type_argument (Qlistp
, v1
);
916 wrong_type_argument (Qlistp
, v1
);
921 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
925 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
929 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
933 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
937 TOP
= NILP (TOP
) ? Qt
: Qnil
;
944 TOP
= Fcons (TOP
, v1
);
949 TOP
= Fcons (TOP
, Qnil
);
956 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
962 TOP
= Flist (3, &TOP
);
967 TOP
= Flist (4, &TOP
);
973 TOP
= Flist (op
, &TOP
);
977 BEFORE_POTENTIAL_GC ();
979 AFTER_POTENTIAL_GC ();
985 BEFORE_POTENTIAL_GC ();
987 TOP
= Faref (TOP
, v1
);
988 AFTER_POTENTIAL_GC ();
995 BEFORE_POTENTIAL_GC ();
997 TOP
= Faset (TOP
, v1
, v2
);
998 AFTER_POTENTIAL_GC ();
1003 BEFORE_POTENTIAL_GC ();
1004 TOP
= Fsymbol_value (TOP
);
1005 AFTER_POTENTIAL_GC ();
1008 case Bsymbol_function
:
1009 BEFORE_POTENTIAL_GC ();
1010 TOP
= Fsymbol_function (TOP
);
1011 AFTER_POTENTIAL_GC ();
1017 BEFORE_POTENTIAL_GC ();
1019 TOP
= Fset (TOP
, v1
);
1020 AFTER_POTENTIAL_GC ();
1027 BEFORE_POTENTIAL_GC ();
1029 TOP
= Ffset (TOP
, v1
);
1030 AFTER_POTENTIAL_GC ();
1037 BEFORE_POTENTIAL_GC ();
1039 TOP
= Fget (TOP
, v1
);
1040 AFTER_POTENTIAL_GC ();
1047 BEFORE_POTENTIAL_GC ();
1049 TOP
= Fsubstring (TOP
, v1
, v2
);
1050 AFTER_POTENTIAL_GC ();
1055 BEFORE_POTENTIAL_GC ();
1057 TOP
= Fconcat (2, &TOP
);
1058 AFTER_POTENTIAL_GC ();
1062 BEFORE_POTENTIAL_GC ();
1064 TOP
= Fconcat (3, &TOP
);
1065 AFTER_POTENTIAL_GC ();
1069 BEFORE_POTENTIAL_GC ();
1071 TOP
= Fconcat (4, &TOP
);
1072 AFTER_POTENTIAL_GC ();
1077 BEFORE_POTENTIAL_GC ();
1079 TOP
= Fconcat (op
, &TOP
);
1080 AFTER_POTENTIAL_GC ();
1089 XSETINT (v1
, XINT (v1
) - 1);
1094 BEFORE_POTENTIAL_GC ();
1096 AFTER_POTENTIAL_GC ();
1107 XSETINT (v1
, XINT (v1
) + 1);
1112 BEFORE_POTENTIAL_GC ();
1114 AFTER_POTENTIAL_GC ();
1122 BEFORE_POTENTIAL_GC ();
1124 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
);
1125 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
);
1126 AFTER_POTENTIAL_GC ();
1127 if (FLOATP (v1
) || FLOATP (v2
))
1131 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1132 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1133 TOP
= (f1
== f2
? Qt
: Qnil
);
1136 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1143 BEFORE_POTENTIAL_GC ();
1145 TOP
= Fgtr (TOP
, v1
);
1146 AFTER_POTENTIAL_GC ();
1153 BEFORE_POTENTIAL_GC ();
1155 TOP
= Flss (TOP
, v1
);
1156 AFTER_POTENTIAL_GC ();
1163 BEFORE_POTENTIAL_GC ();
1165 TOP
= Fleq (TOP
, v1
);
1166 AFTER_POTENTIAL_GC ();
1173 BEFORE_POTENTIAL_GC ();
1175 TOP
= Fgeq (TOP
, v1
);
1176 AFTER_POTENTIAL_GC ();
1181 BEFORE_POTENTIAL_GC ();
1183 TOP
= Fminus (2, &TOP
);
1184 AFTER_POTENTIAL_GC ();
1193 XSETINT (v1
, - XINT (v1
));
1198 BEFORE_POTENTIAL_GC ();
1199 TOP
= Fminus (1, &TOP
);
1200 AFTER_POTENTIAL_GC ();
1206 BEFORE_POTENTIAL_GC ();
1208 TOP
= Fplus (2, &TOP
);
1209 AFTER_POTENTIAL_GC ();
1213 BEFORE_POTENTIAL_GC ();
1215 TOP
= Fmax (2, &TOP
);
1216 AFTER_POTENTIAL_GC ();
1220 BEFORE_POTENTIAL_GC ();
1222 TOP
= Fmin (2, &TOP
);
1223 AFTER_POTENTIAL_GC ();
1227 BEFORE_POTENTIAL_GC ();
1229 TOP
= Ftimes (2, &TOP
);
1230 AFTER_POTENTIAL_GC ();
1234 BEFORE_POTENTIAL_GC ();
1236 TOP
= Fquo (2, &TOP
);
1237 AFTER_POTENTIAL_GC ();
1243 BEFORE_POTENTIAL_GC ();
1245 TOP
= Frem (TOP
, v1
);
1246 AFTER_POTENTIAL_GC ();
1253 XSETFASTINT (v1
, PT
);
1259 BEFORE_POTENTIAL_GC ();
1260 TOP
= Fgoto_char (TOP
);
1261 AFTER_POTENTIAL_GC ();
1265 BEFORE_POTENTIAL_GC ();
1266 TOP
= Finsert (1, &TOP
);
1267 AFTER_POTENTIAL_GC ();
1272 BEFORE_POTENTIAL_GC ();
1274 TOP
= Finsert (op
, &TOP
);
1275 AFTER_POTENTIAL_GC ();
1281 XSETFASTINT (v1
, ZV
);
1289 XSETFASTINT (v1
, BEGV
);
1295 BEFORE_POTENTIAL_GC ();
1296 TOP
= Fchar_after (TOP
);
1297 AFTER_POTENTIAL_GC ();
1300 case Bfollowing_char
:
1303 BEFORE_POTENTIAL_GC ();
1304 v1
= Ffollowing_char ();
1305 AFTER_POTENTIAL_GC ();
1310 case Bpreceding_char
:
1313 BEFORE_POTENTIAL_GC ();
1314 v1
= Fprevious_char ();
1315 AFTER_POTENTIAL_GC ();
1320 case Bcurrent_column
:
1323 BEFORE_POTENTIAL_GC ();
1324 XSETFASTINT (v1
, (int) current_column ()); /* iftc */
1325 AFTER_POTENTIAL_GC ();
1331 BEFORE_POTENTIAL_GC ();
1332 TOP
= Findent_to (TOP
, Qnil
);
1333 AFTER_POTENTIAL_GC ();
1352 case Bcurrent_buffer
:
1353 PUSH (Fcurrent_buffer ());
1357 BEFORE_POTENTIAL_GC ();
1358 TOP
= Fset_buffer (TOP
);
1359 AFTER_POTENTIAL_GC ();
1362 case Binteractive_p
:
1363 PUSH (Finteractive_p ());
1367 BEFORE_POTENTIAL_GC ();
1368 TOP
= Fforward_char (TOP
);
1369 AFTER_POTENTIAL_GC ();
1373 BEFORE_POTENTIAL_GC ();
1374 TOP
= Fforward_word (TOP
);
1375 AFTER_POTENTIAL_GC ();
1378 case Bskip_chars_forward
:
1381 BEFORE_POTENTIAL_GC ();
1383 TOP
= Fskip_chars_forward (TOP
, v1
);
1384 AFTER_POTENTIAL_GC ();
1388 case Bskip_chars_backward
:
1391 BEFORE_POTENTIAL_GC ();
1393 TOP
= Fskip_chars_backward (TOP
, v1
);
1394 AFTER_POTENTIAL_GC ();
1399 BEFORE_POTENTIAL_GC ();
1400 TOP
= Fforward_line (TOP
);
1401 AFTER_POTENTIAL_GC ();
1405 BEFORE_POTENTIAL_GC ();
1407 AFTER_POTENTIAL_GC ();
1408 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (XINT (TOP
))]);
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 ();
1543 else if (!NILP (v1
))
1546 wrong_type_argument (Qlistp
, v1
);
1555 wrong_type_argument (Qlistp
, v1
);
1559 BEFORE_POTENTIAL_GC ();
1561 TOP
= Felt (TOP
, v1
);
1562 AFTER_POTENTIAL_GC ();
1570 BEFORE_POTENTIAL_GC ();
1572 TOP
= Fmember (TOP
, v1
);
1573 AFTER_POTENTIAL_GC ();
1580 BEFORE_POTENTIAL_GC ();
1582 TOP
= Fassq (TOP
, v1
);
1583 AFTER_POTENTIAL_GC ();
1588 BEFORE_POTENTIAL_GC ();
1589 TOP
= Fnreverse (TOP
);
1590 AFTER_POTENTIAL_GC ();
1596 BEFORE_POTENTIAL_GC ();
1598 TOP
= Fsetcar (TOP
, v1
);
1599 AFTER_POTENTIAL_GC ();
1606 BEFORE_POTENTIAL_GC ();
1608 TOP
= Fsetcdr (TOP
, v1
);
1609 AFTER_POTENTIAL_GC ();
1636 BEFORE_POTENTIAL_GC ();
1638 TOP
= Fnconc (2, &TOP
);
1639 AFTER_POTENTIAL_GC ();
1643 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1647 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1650 #ifdef BYTE_CODE_SAFE
1652 BEFORE_POTENTIAL_GC ();
1653 error ("set-mark is an obsolete bytecode");
1654 AFTER_POTENTIAL_GC ();
1657 BEFORE_POTENTIAL_GC ();
1658 error ("scan-buffer is an obsolete bytecode");
1659 AFTER_POTENTIAL_GC ();
1668 #ifdef BYTE_CODE_SAFE
1673 if ((op
-= Bconstant
) >= const_length
)
1679 PUSH (vectorp
[op
- Bconstant
]);
1686 byte_stack_list
= byte_stack_list
->next
;
1688 /* Binds and unbinds are supposed to be compiled balanced. */
1689 if (SPECPDL_INDEX () != count
)
1690 #ifdef BYTE_CODE_SAFE
1691 error ("binding stack not balanced (serious byte compiler bug)");
1702 Qbytecode
= intern ("byte-code");
1703 staticpro (&Qbytecode
);
1705 defsubr (&Sbyte_code
);
1707 #ifdef BYTE_CODE_METER
1709 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1710 doc
: /* A vector of vectors which holds a histogram of byte-code usage.
1711 \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte
1712 opcode CODE has been executed.
1713 \(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
1714 indicates how many times the byte opcodes CODE1 and CODE2 have been
1715 executed in succession. */);
1717 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1718 doc
: /* If non-nil, keep profiling information on byte code usage.
1719 The variable byte-code-meter indicates how often each byte opcode is used.
1720 If a symbol has a property named `byte-code-meter' whose value is an
1721 integer, it is incremented each time that symbol's function is called. */);
1723 byte_metering_on
= 0;
1724 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1725 Qbyte_code_meter
= intern ("byte-code-meter");
1726 staticpro (&Qbyte_code_meter
);
1730 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1731 Fmake_vector (make_number (256), make_number (0));
1736 /* arch-tag: b9803b6f-1ed6-4190-8adf-33fd3a9d10e9
1737 (do not change this comment) */