1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
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.
43 * define BYTE_CODE_SAFE to enable some minor sanity checking (useful for
44 * debugging the byte compiler...)
46 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
48 /* #define BYTE_CODE_SAFE */
49 /* #define BYTE_CODE_METER */
52 #ifdef BYTE_CODE_METER
54 Lisp_Object Vbyte_code_meter
, Qbyte_code_meter
;
57 #define METER_2(code1, code2) \
58 XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
61 #define METER_1(code) METER_2 (0, (code))
63 #define METER_CODE(last_code, this_code) \
65 if (byte_metering_on) \
67 if (METER_1 (this_code) != ((1<<VALBITS)-1)) \
68 METER_1 (this_code)++; \
70 && METER_2 (last_code, this_code) != ((1<<VALBITS)-1))\
71 METER_2 (last_code, this_code)++; \
75 #else /* no BYTE_CODE_METER */
77 #define METER_CODE(last_code, this_code)
79 #endif /* no BYTE_CODE_METER */
82 Lisp_Object Qbytecode
;
110 #define Bsymbol_value 0112
111 #define Bsymbol_function 0113
115 #define Bsubstring 0117
116 #define Bconcat2 0120
117 #define Bconcat3 0121
118 #define Bconcat4 0122
121 #define Beqlsign 0125
134 /* Was Bmark in v17. */
135 #define Bsave_current_buffer 0141
136 #define Bgoto_char 0142
138 #define Bpoint_max 0144
139 #define Bpoint_min 0145
140 #define Bchar_after 0146
141 #define Bfollowing_char 0147
142 #define Bpreceding_char 0150
143 #define Bcurrent_column 0151
144 #define Bindent_to 0152
145 #define Bscan_buffer 0153 /* No longer generated as of v18 */
150 #define Bcurrent_buffer 0160
151 #define Bset_buffer 0161
152 #define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */
153 #define Bread_char 0162 /* No longer generated as of v19 */
154 #define Bset_mark 0163 /* this loser is no longer generated as of v18 */
155 #define Binteractive_p 0164 /* Needed since interactive-p takes unevalled args */
157 #define Bforward_char 0165
158 #define Bforward_word 0166
159 #define Bskip_chars_forward 0167
160 #define Bskip_chars_backward 0170
161 #define Bforward_line 0171
162 #define Bchar_syntax 0172
163 #define Bbuffer_substring 0173
164 #define Bdelete_region 0174
165 #define Bnarrow_to_region 0175
167 #define Bend_of_line 0177
169 #define Bconstant2 0201
171 #define Bgotoifnil 0203
172 #define Bgotoifnonnil 0204
173 #define Bgotoifnilelsepop 0205
174 #define Bgotoifnonnilelsepop 0206
176 #define Bdiscard 0210
179 #define Bsave_excursion 0212
180 #define Bsave_window_excursion 0213
181 #define Bsave_restriction 0214
184 #define Bunwind_protect 0216
185 #define Bcondition_case 0217
186 #define Btemp_output_buffer_setup 0220
187 #define Btemp_output_buffer_show 0221
189 #define Bunbind_all 0222
191 #define Bset_marker 0223
192 #define Bmatch_beginning 0224
193 #define Bmatch_end 0225
195 #define Bdowncase 0227
197 #define Bstringeqlsign 0230
198 #define Bstringlss 0231
204 #define Bnreverse 0237
207 #define Bcar_safe 0242
208 #define Bcdr_safe 0243
212 #define Bnumberp 0247
213 #define Bintegerp 0250
216 #define BRgotoifnil 0253
217 #define BRgotoifnonnil 0254
218 #define BRgotoifnilelsepop 0255
219 #define BRgotoifnonnilelsepop 0256
222 #define BconcatN 0260
223 #define BinsertN 0261
225 #define Bconstant 0300
226 #define CONSTANTLIM 0100
229 /* Structure describing a value stack used during byte-code execution
234 /* Program counter. This points into the byte_string below
235 and is relocated when that string is relocated. */
238 /* Top and bottom of stack. The bottom points to an area of memory
239 allocated with alloca in Fbyte_code. */
240 Lisp_Object
*top
, *bottom
;
242 /* The string containing the byte-code, and its current address.
243 Storing this here protects it from GC because mark_byte_stack
245 Lisp_Object byte_string
;
246 unsigned char *byte_string_start
;
248 /* The vector of constants used during byte-code execution. Storing
249 this here protects it from GC because mark_byte_stack marks it. */
250 Lisp_Object constants
;
252 /* Next entry in byte_stack_list. */
253 struct byte_stack
*next
;
256 /* A list of currently active byte-code execution value stacks.
257 Fbyte_code adds an entry to the head of this list before it starts
258 processing byte-code, and it removed the entry again when it is
259 done. Signalling an error truncates the list analoguous to
262 struct byte_stack
*byte_stack_list
;
265 /* Mark objects on byte_stack_list. Called during GC. */
270 struct byte_stack
*stack
;
273 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
275 /* If STACK->top is null here, this means there's an opcode in
276 Fbyte_code that wasn't expected to GC, but did. To find out
277 which opcode this is, record the value of `stack', and walk
278 up the stack in a debugger, stopping in frames of Fbyte_code.
279 The culprit is found in the frame of Fbyte_code where the
280 address of its local variable `stack' is equal to the
281 recorded value of `stack' here. */
285 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
286 if (!XMARKBIT (*obj
))
292 if (!XMARKBIT (stack
->byte_string
))
294 mark_object (&stack
->byte_string
);
295 XMARK (stack
->byte_string
);
298 if (!XMARKBIT (stack
->constants
))
300 mark_object (&stack
->constants
);
301 XMARK (stack
->constants
);
307 /* Unmark objects in the stacks on byte_stack_list. Relocate program
308 counters. Called when GC has completed. */
313 struct byte_stack
*stack
;
316 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
318 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
321 XUNMARK (stack
->byte_string
);
322 XUNMARK (stack
->constants
);
324 if (stack
->byte_string_start
!= XSTRING (stack
->byte_string
)->data
)
326 int offset
= stack
->pc
- stack
->byte_string_start
;
327 stack
->byte_string_start
= XSTRING (stack
->byte_string
)->data
;
328 stack
->pc
= stack
->byte_string_start
+ offset
;
334 /* Fetch the next byte from the bytecode stream */
336 #define FETCH *stack.pc++
338 /* Fetch two bytes from the bytecode stream and make a 16-bit number
341 #define FETCH2 (op = FETCH, op + (FETCH << 8))
343 /* Push x onto the execution stack. This used to be #define PUSH(x)
344 (*++stackp = (x)) This oddity is necessary because Alliant can't be
345 bothered to compile the preincrement operator properly, as of 4/91.
348 #define PUSH(x) (top++, *top = (x))
350 /* Pop a value off the execution stack. */
354 /* Discard n values from the execution stack. */
356 #define DISCARD(n) (top -= (n))
358 /* Get the value which is at the top of the execution stack, but don't
363 /* Actions that must be performed before and after calling a function
366 #define BEFORE_POTENTIAL_GC() stack.top = top
367 #define AFTER_POTENTIAL_GC() stack.top = NULL
369 /* Garbage collect if we have consed enough since the last time.
370 We do this at every branch, to avoid loops that never GC. */
373 if (consing_since_gc > gc_cons_threshold) \
375 BEFORE_POTENTIAL_GC (); \
376 Fgarbage_collect (); \
377 AFTER_POTENTIAL_GC (); \
381 /* Check for jumping out of range. */
383 #ifdef BYTE_CODE_SAFE
385 #define CHECK_RANGE(ARG) \
386 if (ARG >= bytestr_length) abort ()
388 #else /* not BYTE_CODE_SAFE */
390 #define CHECK_RANGE(ARG)
392 #endif /* not BYTE_CODE_SAFE */
395 DEFUN ("byte-code", Fbyte_code
, Sbyte_code
, 3, 3, 0,
396 "Function used internally in byte-compiled code.\n\
397 The first argument, BYTESTR, is a string of byte code;\n\
398 the second, VECTOR, a vector of constants;\n\
399 the third, MAXDEPTH, the maximum stack depth used in this function.\n\
400 If the third argument is incorrect, Emacs may crash.")
401 (bytestr
, vector
, maxdepth
)
402 Lisp_Object bytestr
, vector
, maxdepth
;
404 int count
= specpdl_ptr
- specpdl
;
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 CHECK_STRING (bytestr
, 0);
422 if (!VECTORP (vector
))
423 vector
= wrong_type_argument (Qvectorp
, vector
);
424 CHECK_NUMBER (maxdepth
, 2);
426 if (STRING_MULTIBYTE (bytestr
))
427 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
428 because they produced a raw 8-bit string for byte-code and now
429 such a byte-code string is loaded as multibyte while raw 8-bit
430 characters converted to multibyte form. Thus, now we must
431 convert them back to the original unibyte form. */
432 bytestr
= Fstring_as_unibyte (bytestr
);
434 bytestr_length
= STRING_BYTES (XSTRING (bytestr
));
435 vectorp
= XVECTOR (vector
)->contents
;
437 stack
.byte_string
= bytestr
;
438 stack
.pc
= stack
.byte_string_start
= XSTRING (bytestr
)->data
;
439 stack
.constants
= vector
;
440 stack
.bottom
= (Lisp_Object
*) alloca (XFASTINT (maxdepth
)
441 * sizeof (Lisp_Object
));
442 top
= stack
.bottom
- 1;
444 stack
.next
= byte_stack_list
;
445 byte_stack_list
= &stack
;
447 #ifdef BYTE_CODE_SAFE
448 stacke
= stack
.bottom
- 1 + XFASTINT (maxdepth
);
453 #ifdef BYTE_CODE_SAFE
456 else if (top
< stack
.bottom
- 1)
460 #ifdef BYTE_CODE_METER
462 this_op
= op
= FETCH
;
463 METER_CODE (prev_op
, op
);
483 /* This seems to be the most frequently executed byte-code
484 among the Bvarref's, so avoid a goto here. */
494 v2
= XSYMBOL (v1
)->value
;
495 if (MISCP (v2
) || EQ (v2
, Qunbound
))
497 BEFORE_POTENTIAL_GC ();
498 v2
= Fsymbol_value (v1
);
499 AFTER_POTENTIAL_GC ();
504 BEFORE_POTENTIAL_GC ();
505 v2
= Fsymbol_value (v1
);
506 AFTER_POTENTIAL_GC ();
519 stack
.pc
= stack
.byte_string_start
+ op
;
533 BEFORE_POTENTIAL_GC ();
534 Fcar (wrong_type_argument (Qlistp
, v1
));
535 AFTER_POTENTIAL_GC ();
544 TOP
= EQ (v1
, TOP
) ? Qt
: Qnil
;
551 BEFORE_POTENTIAL_GC ();
553 TOP
= Fmemq (TOP
, v1
);
554 AFTER_POTENTIAL_GC ();
568 BEFORE_POTENTIAL_GC ();
569 Fcdr (wrong_type_argument (Qlistp
, v1
));
570 AFTER_POTENTIAL_GC ();
592 Lisp_Object sym
, val
;
597 /* Inline the most common case. */
599 && !EQ (val
, Qunbound
)
600 && !MISCP (XSYMBOL (sym
)->value
)
601 /* I think this should either be checked in the byte
602 compiler, or there should be a flag indicating that
603 a symbol might be constant in Lisp_Symbol, instead
604 of checking this here over and over again. --gerd. */
607 && !(XSYMBOL (sym
)->name
->data
[0] == ':'
608 && EQ (XSYMBOL (sym
)->obarray
, initial_obarray
)
610 XSYMBOL (sym
)->value
= val
;
613 BEFORE_POTENTIAL_GC ();
614 set_internal (sym
, val
, current_buffer
, 0);
615 AFTER_POTENTIAL_GC ();
629 /* ------------------ */
647 /* Specbind can signal and thus GC. */
648 BEFORE_POTENTIAL_GC ();
649 specbind (vectorp
[op
], POP
);
650 AFTER_POTENTIAL_GC ();
670 BEFORE_POTENTIAL_GC ();
672 #ifdef BYTE_CODE_METER
673 if (byte_metering_on
&& SYMBOLP (TOP
))
678 v2
= Fget (v1
, Qbyte_code_meter
);
680 && XINT (v2
) != ((1<<VALBITS
)-1))
682 XSETINT (v2
, XINT (v2
) + 1);
683 Fput (v1
, Qbyte_code_meter
, v2
);
687 TOP
= Ffuncall (op
+ 1, &TOP
);
688 AFTER_POTENTIAL_GC ();
708 BEFORE_POTENTIAL_GC ();
709 unbind_to (specpdl_ptr
- specpdl
- op
, Qnil
);
710 AFTER_POTENTIAL_GC ();
714 /* To unbind back to the beginning of this frame. Not used yet,
715 but will be needed for tail-recursion elimination. */
716 BEFORE_POTENTIAL_GC ();
717 unbind_to (count
, Qnil
);
718 AFTER_POTENTIAL_GC ();
724 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
726 stack
.pc
= stack
.byte_string_start
+ op
;
736 stack
.pc
= stack
.byte_string_start
+ op
;
740 case Bgotoifnilelsepop
:
747 stack
.pc
= stack
.byte_string_start
+ op
;
752 case Bgotoifnonnilelsepop
:
759 stack
.pc
= stack
.byte_string_start
+ op
;
767 stack
.pc
+= (int) *stack
.pc
- 127;
775 stack
.pc
+= (int) *stack
.pc
- 128;
785 stack
.pc
+= (int) *stack
.pc
- 128;
790 case BRgotoifnilelsepop
:
796 stack
.pc
+= op
- 128;
801 case BRgotoifnonnilelsepop
:
807 stack
.pc
+= op
- 128;
821 PUSH (vectorp
[FETCH2
]);
824 case Bsave_excursion
:
825 record_unwind_protect (save_excursion_restore
,
826 save_excursion_save ());
829 case Bsave_current_buffer
:
830 case Bsave_current_buffer_1
:
831 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
834 case Bsave_window_excursion
:
835 BEFORE_POTENTIAL_GC ();
836 TOP
= Fsave_window_excursion (TOP
);
837 AFTER_POTENTIAL_GC ();
840 case Bsave_restriction
:
841 record_unwind_protect (save_restriction_restore
,
842 save_restriction_save ());
848 BEFORE_POTENTIAL_GC ();
850 TOP
= internal_catch (TOP
, Feval
, v1
);
851 AFTER_POTENTIAL_GC ();
855 case Bunwind_protect
:
856 /* The function record_unwind_protect can GC. */
857 BEFORE_POTENTIAL_GC ();
858 record_unwind_protect (0, POP
);
859 AFTER_POTENTIAL_GC ();
860 (specpdl_ptr
- 1)->symbol
= Qnil
;
863 case Bcondition_case
:
867 v1
= Fcons (POP
, v1
);
868 BEFORE_POTENTIAL_GC ();
869 TOP
= Fcondition_case (Fcons (TOP
, v1
));
870 AFTER_POTENTIAL_GC ();
874 case Btemp_output_buffer_setup
:
875 BEFORE_POTENTIAL_GC ();
876 temp_output_buffer_setup (XSTRING (TOP
)->data
);
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_ptr
- specpdl
- 1, Qnil
);
890 AFTER_POTENTIAL_GC ();
897 BEFORE_POTENTIAL_GC ();
900 CHECK_NUMBER (v2
, 0);
901 AFTER_POTENTIAL_GC ();
911 BEFORE_POTENTIAL_GC ();
912 v1
= wrong_type_argument (Qlistp
, v1
);
913 AFTER_POTENTIAL_GC ();
925 BEFORE_POTENTIAL_GC ();
926 Fcar (wrong_type_argument (Qlistp
, v1
));
927 AFTER_POTENTIAL_GC ();
933 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
937 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
941 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
945 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
949 TOP
= NILP (TOP
) ? Qt
: Qnil
;
956 TOP
= Fcons (TOP
, v1
);
961 TOP
= Fcons (TOP
, Qnil
);
968 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
974 TOP
= Flist (3, &TOP
);
979 TOP
= Flist (4, &TOP
);
985 TOP
= Flist (op
, &TOP
);
989 BEFORE_POTENTIAL_GC ();
991 AFTER_POTENTIAL_GC ();
997 BEFORE_POTENTIAL_GC ();
999 TOP
= Faref (TOP
, v1
);
1000 AFTER_POTENTIAL_GC ();
1007 BEFORE_POTENTIAL_GC ();
1009 TOP
= Faset (TOP
, v1
, v2
);
1010 AFTER_POTENTIAL_GC ();
1015 BEFORE_POTENTIAL_GC ();
1016 TOP
= Fsymbol_value (TOP
);
1017 AFTER_POTENTIAL_GC ();
1020 case Bsymbol_function
:
1021 BEFORE_POTENTIAL_GC ();
1022 TOP
= Fsymbol_function (TOP
);
1023 AFTER_POTENTIAL_GC ();
1029 BEFORE_POTENTIAL_GC ();
1031 TOP
= Fset (TOP
, v1
);
1032 AFTER_POTENTIAL_GC ();
1039 BEFORE_POTENTIAL_GC ();
1041 TOP
= Ffset (TOP
, v1
);
1042 AFTER_POTENTIAL_GC ();
1049 BEFORE_POTENTIAL_GC ();
1051 TOP
= Fget (TOP
, v1
);
1052 AFTER_POTENTIAL_GC ();
1059 BEFORE_POTENTIAL_GC ();
1061 TOP
= Fsubstring (TOP
, v1
, v2
);
1062 AFTER_POTENTIAL_GC ();
1067 BEFORE_POTENTIAL_GC ();
1069 TOP
= Fconcat (2, &TOP
);
1070 AFTER_POTENTIAL_GC ();
1074 BEFORE_POTENTIAL_GC ();
1076 TOP
= Fconcat (3, &TOP
);
1077 AFTER_POTENTIAL_GC ();
1081 BEFORE_POTENTIAL_GC ();
1083 TOP
= Fconcat (4, &TOP
);
1084 AFTER_POTENTIAL_GC ();
1089 BEFORE_POTENTIAL_GC ();
1091 TOP
= Fconcat (op
, &TOP
);
1092 AFTER_POTENTIAL_GC ();
1101 XSETINT (v1
, XINT (v1
) - 1);
1115 XSETINT (v1
, XINT (v1
) + 1);
1120 BEFORE_POTENTIAL_GC ();
1122 AFTER_POTENTIAL_GC ();
1130 BEFORE_POTENTIAL_GC ();
1132 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
, 0);
1133 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
, 0);
1134 AFTER_POTENTIAL_GC ();
1135 if (FLOATP (v1
) || FLOATP (v2
))
1139 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1140 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1141 TOP
= (f1
== f2
? Qt
: Qnil
);
1144 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1151 BEFORE_POTENTIAL_GC ();
1153 TOP
= Fgtr (TOP
, v1
);
1154 AFTER_POTENTIAL_GC ();
1161 BEFORE_POTENTIAL_GC ();
1163 TOP
= Flss (TOP
, v1
);
1164 AFTER_POTENTIAL_GC ();
1171 BEFORE_POTENTIAL_GC ();
1173 TOP
= Fleq (TOP
, v1
);
1174 AFTER_POTENTIAL_GC ();
1182 TOP
= Fgeq (TOP
, v1
);
1187 BEFORE_POTENTIAL_GC ();
1189 TOP
= Fminus (2, &TOP
);
1190 AFTER_POTENTIAL_GC ();
1199 XSETINT (v1
, - XINT (v1
));
1204 BEFORE_POTENTIAL_GC ();
1205 TOP
= Fminus (1, &TOP
);
1206 AFTER_POTENTIAL_GC ();
1212 BEFORE_POTENTIAL_GC ();
1214 TOP
= Fplus (2, &TOP
);
1215 AFTER_POTENTIAL_GC ();
1219 BEFORE_POTENTIAL_GC ();
1221 TOP
= Fmax (2, &TOP
);
1222 AFTER_POTENTIAL_GC ();
1226 BEFORE_POTENTIAL_GC ();
1228 TOP
= Fmin (2, &TOP
);
1229 AFTER_POTENTIAL_GC ();
1233 BEFORE_POTENTIAL_GC ();
1235 TOP
= Ftimes (2, &TOP
);
1236 AFTER_POTENTIAL_GC ();
1240 BEFORE_POTENTIAL_GC ();
1242 TOP
= Fquo (2, &TOP
);
1243 AFTER_POTENTIAL_GC ();
1249 BEFORE_POTENTIAL_GC ();
1251 TOP
= Frem (TOP
, v1
);
1252 AFTER_POTENTIAL_GC ();
1259 XSETFASTINT (v1
, PT
);
1265 BEFORE_POTENTIAL_GC ();
1266 TOP
= Fgoto_char (TOP
);
1267 AFTER_POTENTIAL_GC ();
1271 BEFORE_POTENTIAL_GC ();
1272 TOP
= Finsert (1, &TOP
);
1273 AFTER_POTENTIAL_GC ();
1278 BEFORE_POTENTIAL_GC ();
1280 TOP
= Finsert (op
, &TOP
);
1281 AFTER_POTENTIAL_GC ();
1287 XSETFASTINT (v1
, ZV
);
1295 XSETFASTINT (v1
, BEGV
);
1301 BEFORE_POTENTIAL_GC ();
1302 TOP
= Fchar_after (TOP
);
1303 AFTER_POTENTIAL_GC ();
1306 case Bfollowing_char
:
1309 BEFORE_POTENTIAL_GC ();
1310 v1
= Ffollowing_char ();
1311 AFTER_POTENTIAL_GC ();
1316 case Bpreceding_char
:
1319 BEFORE_POTENTIAL_GC ();
1320 v1
= Fprevious_char ();
1321 AFTER_POTENTIAL_GC ();
1326 case Bcurrent_column
:
1329 XSETFASTINT (v1
, current_column ());
1335 BEFORE_POTENTIAL_GC ();
1336 TOP
= Findent_to (TOP
, Qnil
);
1337 AFTER_POTENTIAL_GC ();
1356 case Bcurrent_buffer
:
1357 PUSH (Fcurrent_buffer ());
1361 BEFORE_POTENTIAL_GC ();
1362 TOP
= Fset_buffer (TOP
);
1363 AFTER_POTENTIAL_GC ();
1366 case Binteractive_p
:
1367 PUSH (Finteractive_p ());
1371 BEFORE_POTENTIAL_GC ();
1372 TOP
= Fforward_char (TOP
);
1373 AFTER_POTENTIAL_GC ();
1377 BEFORE_POTENTIAL_GC ();
1378 TOP
= Fforward_word (TOP
);
1379 AFTER_POTENTIAL_GC ();
1382 case Bskip_chars_forward
:
1385 BEFORE_POTENTIAL_GC ();
1387 TOP
= Fskip_chars_forward (TOP
, v1
);
1388 AFTER_POTENTIAL_GC ();
1392 case Bskip_chars_backward
:
1395 BEFORE_POTENTIAL_GC ();
1397 TOP
= Fskip_chars_backward (TOP
, v1
);
1398 AFTER_POTENTIAL_GC ();
1403 BEFORE_POTENTIAL_GC ();
1404 TOP
= Fforward_line (TOP
);
1405 AFTER_POTENTIAL_GC ();
1409 BEFORE_POTENTIAL_GC ();
1410 CHECK_NUMBER (TOP
, 0);
1411 AFTER_POTENTIAL_GC ();
1412 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (XINT (TOP
))]);
1415 case Bbuffer_substring
:
1418 BEFORE_POTENTIAL_GC ();
1420 TOP
= Fbuffer_substring (TOP
, v1
);
1421 AFTER_POTENTIAL_GC ();
1425 case Bdelete_region
:
1428 BEFORE_POTENTIAL_GC ();
1430 TOP
= Fdelete_region (TOP
, v1
);
1431 AFTER_POTENTIAL_GC ();
1435 case Bnarrow_to_region
:
1438 BEFORE_POTENTIAL_GC ();
1440 TOP
= Fnarrow_to_region (TOP
, v1
);
1441 AFTER_POTENTIAL_GC ();
1446 BEFORE_POTENTIAL_GC ();
1448 AFTER_POTENTIAL_GC ();
1452 BEFORE_POTENTIAL_GC ();
1453 TOP
= Fend_of_line (TOP
);
1454 AFTER_POTENTIAL_GC ();
1460 BEFORE_POTENTIAL_GC ();
1463 TOP
= Fset_marker (TOP
, v2
, v1
);
1464 AFTER_POTENTIAL_GC ();
1468 case Bmatch_beginning
:
1469 BEFORE_POTENTIAL_GC ();
1470 TOP
= Fmatch_beginning (TOP
);
1471 AFTER_POTENTIAL_GC ();
1475 BEFORE_POTENTIAL_GC ();
1476 TOP
= Fmatch_end (TOP
);
1477 AFTER_POTENTIAL_GC ();
1481 BEFORE_POTENTIAL_GC ();
1482 TOP
= Fupcase (TOP
);
1483 AFTER_POTENTIAL_GC ();
1487 BEFORE_POTENTIAL_GC ();
1488 TOP
= Fdowncase (TOP
);
1489 AFTER_POTENTIAL_GC ();
1492 case Bstringeqlsign
:
1495 BEFORE_POTENTIAL_GC ();
1497 TOP
= Fstring_equal (TOP
, v1
);
1498 AFTER_POTENTIAL_GC ();
1505 BEFORE_POTENTIAL_GC ();
1507 TOP
= Fstring_lessp (TOP
, v1
);
1508 AFTER_POTENTIAL_GC ();
1516 TOP
= Fequal (TOP
, v1
);
1523 BEFORE_POTENTIAL_GC ();
1525 TOP
= Fnthcdr (TOP
, v1
);
1526 AFTER_POTENTIAL_GC ();
1535 /* Exchange args and then do nth. */
1536 BEFORE_POTENTIAL_GC ();
1539 CHECK_NUMBER (v2
, 0);
1540 AFTER_POTENTIAL_GC ();
1547 else if (!NILP (v1
))
1550 BEFORE_POTENTIAL_GC ();
1551 v1
= wrong_type_argument (Qlistp
, v1
);
1552 AFTER_POTENTIAL_GC ();
1564 BEFORE_POTENTIAL_GC ();
1565 Fcar (wrong_type_argument (Qlistp
, v1
));
1566 AFTER_POTENTIAL_GC ();
1571 BEFORE_POTENTIAL_GC ();
1573 TOP
= Felt (TOP
, v1
);
1574 AFTER_POTENTIAL_GC ();
1582 BEFORE_POTENTIAL_GC ();
1584 TOP
= Fmember (TOP
, v1
);
1585 AFTER_POTENTIAL_GC ();
1592 BEFORE_POTENTIAL_GC ();
1594 TOP
= Fassq (TOP
, v1
);
1595 AFTER_POTENTIAL_GC ();
1600 BEFORE_POTENTIAL_GC ();
1601 TOP
= Fnreverse (TOP
);
1602 AFTER_POTENTIAL_GC ();
1608 BEFORE_POTENTIAL_GC ();
1610 TOP
= Fsetcar (TOP
, v1
);
1611 AFTER_POTENTIAL_GC ();
1618 BEFORE_POTENTIAL_GC ();
1620 TOP
= Fsetcdr (TOP
, v1
);
1621 AFTER_POTENTIAL_GC ();
1648 BEFORE_POTENTIAL_GC ();
1650 TOP
= Fnconc (2, &TOP
);
1651 AFTER_POTENTIAL_GC ();
1655 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1659 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1662 #ifdef BYTE_CODE_SAFE
1664 BEFORE_POTENTIAL_GC ();
1665 error ("set-mark is an obsolete bytecode");
1666 AFTER_POTENTIAL_GC ();
1669 BEFORE_POTENTIAL_GC ();
1670 error ("scan-buffer is an obsolete bytecode");
1671 AFTER_POTENTIAL_GC ();
1680 #ifdef BYTE_CODE_SAFE
1685 if ((op
-= Bconstant
) >= const_length
)
1691 PUSH (vectorp
[op
- Bconstant
]);
1698 byte_stack_list
= byte_stack_list
->next
;
1700 /* Binds and unbinds are supposed to be compiled balanced. */
1701 if (specpdl_ptr
- specpdl
!= count
)
1702 #ifdef BYTE_CODE_SAFE
1703 error ("binding stack not balanced (serious byte compiler bug)");
1714 Qbytecode
= intern ("byte-code");
1715 staticpro (&Qbytecode
);
1717 defsubr (&Sbyte_code
);
1719 #ifdef BYTE_CODE_METER
1721 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1722 "A vector of vectors which holds a histogram of byte-code usage.\n\
1723 (aref (aref byte-code-meter 0) CODE) indicates how many times the byte\n\
1724 opcode CODE has been executed.\n\
1725 (aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,\n\
1726 indicates how many times the byte opcodes CODE1 and CODE2 have been\n\
1727 executed in succession.");
1728 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1729 "If non-nil, keep profiling information on byte code usage.\n\
1730 The variable byte-code-meter indicates how often each byte opcode is used.\n\
1731 If a symbol has a property named `byte-code-meter' whose value is an\n\
1732 integer, it is incremented each time that symbol's function is called.");
1734 byte_metering_on
= 0;
1735 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1736 Qbyte_code_meter
= intern ("byte-code-meter");
1737 staticpro (&Qbyte_code_meter
);
1741 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1742 Fmake_vector (make_number (256), make_number (0));