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 (vectorp
[op
], POP
);
667 BEFORE_POTENTIAL_GC ();
669 #ifdef BYTE_CODE_METER
670 if (byte_metering_on
&& SYMBOLP (TOP
))
675 v2
= Fget (v1
, Qbyte_code_meter
);
677 && XINT (v2
) != ((1<<VALBITS
)-1))
679 XSETINT (v2
, XINT (v2
) + 1);
680 Fput (v1
, Qbyte_code_meter
, v2
);
684 TOP
= Ffuncall (op
+ 1, &TOP
);
685 AFTER_POTENTIAL_GC ();
705 BEFORE_POTENTIAL_GC ();
706 unbind_to (specpdl_ptr
- specpdl
- op
, Qnil
);
707 AFTER_POTENTIAL_GC ();
711 /* To unbind back to the beginning of this frame. Not used yet,
712 but will be needed for tail-recursion elimination. */
713 BEFORE_POTENTIAL_GC ();
714 unbind_to (count
, Qnil
);
715 AFTER_POTENTIAL_GC ();
721 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
723 stack
.pc
= stack
.byte_string_start
+ op
;
733 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;
772 stack
.pc
+= (int) *stack
.pc
- 128;
782 stack
.pc
+= (int) *stack
.pc
- 128;
787 case BRgotoifnilelsepop
:
793 stack
.pc
+= op
- 128;
798 case BRgotoifnonnilelsepop
:
804 stack
.pc
+= op
- 128;
818 PUSH (vectorp
[FETCH2
]);
821 case Bsave_excursion
:
822 record_unwind_protect (save_excursion_restore
,
823 save_excursion_save ());
826 case Bsave_current_buffer
:
827 case Bsave_current_buffer_1
:
828 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
831 case Bsave_window_excursion
:
832 BEFORE_POTENTIAL_GC ();
833 TOP
= Fsave_window_excursion (TOP
);
834 AFTER_POTENTIAL_GC ();
837 case Bsave_restriction
:
838 record_unwind_protect (save_restriction_restore
,
839 save_restriction_save ());
845 BEFORE_POTENTIAL_GC ();
847 TOP
= internal_catch (TOP
, Feval
, v1
);
848 AFTER_POTENTIAL_GC ();
852 case Bunwind_protect
:
853 record_unwind_protect (0, POP
);
854 (specpdl_ptr
- 1)->symbol
= Qnil
;
857 case Bcondition_case
:
861 v1
= Fcons (POP
, v1
);
862 BEFORE_POTENTIAL_GC ();
863 TOP
= Fcondition_case (Fcons (TOP
, v1
));
864 AFTER_POTENTIAL_GC ();
868 case Btemp_output_buffer_setup
:
869 BEFORE_POTENTIAL_GC ();
870 temp_output_buffer_setup (XSTRING (TOP
)->data
);
871 AFTER_POTENTIAL_GC ();
872 TOP
= Vstandard_output
;
875 case Btemp_output_buffer_show
:
878 BEFORE_POTENTIAL_GC ();
880 temp_output_buffer_show (TOP
);
882 /* pop binding of standard-output */
883 unbind_to (specpdl_ptr
- specpdl
- 1, Qnil
);
884 AFTER_POTENTIAL_GC ();
891 BEFORE_POTENTIAL_GC ();
894 CHECK_NUMBER (v2
, 0);
895 AFTER_POTENTIAL_GC ();
905 BEFORE_POTENTIAL_GC ();
906 v1
= wrong_type_argument (Qlistp
, v1
);
907 AFTER_POTENTIAL_GC ();
919 BEFORE_POTENTIAL_GC ();
920 Fcar (wrong_type_argument (Qlistp
, v1
));
921 AFTER_POTENTIAL_GC ();
927 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
931 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
935 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
939 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
943 TOP
= NILP (TOP
) ? Qt
: Qnil
;
950 TOP
= Fcons (TOP
, v1
);
955 TOP
= Fcons (TOP
, Qnil
);
962 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
968 TOP
= Flist (3, &TOP
);
973 TOP
= Flist (4, &TOP
);
979 TOP
= Flist (op
, &TOP
);
983 BEFORE_POTENTIAL_GC ();
985 AFTER_POTENTIAL_GC ();
991 BEFORE_POTENTIAL_GC ();
993 TOP
= Faref (TOP
, v1
);
994 AFTER_POTENTIAL_GC ();
1001 BEFORE_POTENTIAL_GC ();
1003 TOP
= Faset (TOP
, v1
, v2
);
1004 AFTER_POTENTIAL_GC ();
1009 BEFORE_POTENTIAL_GC ();
1010 TOP
= Fsymbol_value (TOP
);
1011 AFTER_POTENTIAL_GC ();
1014 case Bsymbol_function
:
1015 BEFORE_POTENTIAL_GC ();
1016 TOP
= Fsymbol_function (TOP
);
1017 AFTER_POTENTIAL_GC ();
1023 BEFORE_POTENTIAL_GC ();
1025 TOP
= Fset (TOP
, v1
);
1026 AFTER_POTENTIAL_GC ();
1033 BEFORE_POTENTIAL_GC ();
1035 TOP
= Ffset (TOP
, v1
);
1036 AFTER_POTENTIAL_GC ();
1043 BEFORE_POTENTIAL_GC ();
1045 TOP
= Fget (TOP
, v1
);
1046 AFTER_POTENTIAL_GC ();
1053 BEFORE_POTENTIAL_GC ();
1055 TOP
= Fsubstring (TOP
, v1
, v2
);
1056 AFTER_POTENTIAL_GC ();
1061 BEFORE_POTENTIAL_GC ();
1063 TOP
= Fconcat (2, &TOP
);
1064 AFTER_POTENTIAL_GC ();
1068 BEFORE_POTENTIAL_GC ();
1070 TOP
= Fconcat (3, &TOP
);
1071 AFTER_POTENTIAL_GC ();
1075 BEFORE_POTENTIAL_GC ();
1077 TOP
= Fconcat (4, &TOP
);
1078 AFTER_POTENTIAL_GC ();
1083 BEFORE_POTENTIAL_GC ();
1085 TOP
= Fconcat (op
, &TOP
);
1086 AFTER_POTENTIAL_GC ();
1095 XSETINT (v1
, XINT (v1
) - 1);
1109 XSETINT (v1
, XINT (v1
) + 1);
1114 BEFORE_POTENTIAL_GC ();
1116 AFTER_POTENTIAL_GC ();
1124 BEFORE_POTENTIAL_GC ();
1126 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
, 0);
1127 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
, 0);
1128 AFTER_POTENTIAL_GC ();
1129 if (FLOATP (v1
) || FLOATP (v2
))
1133 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1134 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1135 TOP
= (f1
== f2
? Qt
: Qnil
);
1138 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1145 BEFORE_POTENTIAL_GC ();
1147 TOP
= Fgtr (TOP
, v1
);
1148 AFTER_POTENTIAL_GC ();
1155 BEFORE_POTENTIAL_GC ();
1157 TOP
= Flss (TOP
, v1
);
1158 AFTER_POTENTIAL_GC ();
1165 BEFORE_POTENTIAL_GC ();
1167 TOP
= Fleq (TOP
, v1
);
1168 AFTER_POTENTIAL_GC ();
1176 TOP
= Fgeq (TOP
, v1
);
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 XSETFASTINT (v1
, current_column ());
1329 BEFORE_POTENTIAL_GC ();
1330 TOP
= Findent_to (TOP
, Qnil
);
1331 AFTER_POTENTIAL_GC ();
1350 case Bcurrent_buffer
:
1351 PUSH (Fcurrent_buffer ());
1355 BEFORE_POTENTIAL_GC ();
1356 TOP
= Fset_buffer (TOP
);
1357 AFTER_POTENTIAL_GC ();
1360 case Binteractive_p
:
1361 PUSH (Finteractive_p ());
1365 BEFORE_POTENTIAL_GC ();
1366 TOP
= Fforward_char (TOP
);
1367 AFTER_POTENTIAL_GC ();
1371 BEFORE_POTENTIAL_GC ();
1372 TOP
= Fforward_word (TOP
);
1373 AFTER_POTENTIAL_GC ();
1376 case Bskip_chars_forward
:
1379 BEFORE_POTENTIAL_GC ();
1381 TOP
= Fskip_chars_forward (TOP
, v1
);
1382 AFTER_POTENTIAL_GC ();
1386 case Bskip_chars_backward
:
1389 BEFORE_POTENTIAL_GC ();
1391 TOP
= Fskip_chars_backward (TOP
, v1
);
1392 AFTER_POTENTIAL_GC ();
1397 BEFORE_POTENTIAL_GC ();
1398 TOP
= Fforward_line (TOP
);
1399 AFTER_POTENTIAL_GC ();
1403 BEFORE_POTENTIAL_GC ();
1404 CHECK_NUMBER (TOP
, 0);
1405 AFTER_POTENTIAL_GC ();
1406 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (XINT (TOP
))]);
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 ();
1533 CHECK_NUMBER (v2
, 0);
1534 AFTER_POTENTIAL_GC ();
1541 else if (!NILP (v1
))
1544 BEFORE_POTENTIAL_GC ();
1545 v1
= wrong_type_argument (Qlistp
, v1
);
1546 AFTER_POTENTIAL_GC ();
1558 BEFORE_POTENTIAL_GC ();
1559 Fcar (wrong_type_argument (Qlistp
, v1
));
1560 AFTER_POTENTIAL_GC ();
1565 BEFORE_POTENTIAL_GC ();
1567 TOP
= Felt (TOP
, v1
);
1568 AFTER_POTENTIAL_GC ();
1576 BEFORE_POTENTIAL_GC ();
1578 TOP
= Fmember (TOP
, v1
);
1579 AFTER_POTENTIAL_GC ();
1586 BEFORE_POTENTIAL_GC ();
1588 TOP
= Fassq (TOP
, v1
);
1589 AFTER_POTENTIAL_GC ();
1594 BEFORE_POTENTIAL_GC ();
1595 TOP
= Fnreverse (TOP
);
1596 AFTER_POTENTIAL_GC ();
1602 BEFORE_POTENTIAL_GC ();
1604 TOP
= Fsetcar (TOP
, v1
);
1605 AFTER_POTENTIAL_GC ();
1612 BEFORE_POTENTIAL_GC ();
1614 TOP
= Fsetcdr (TOP
, v1
);
1615 AFTER_POTENTIAL_GC ();
1642 BEFORE_POTENTIAL_GC ();
1644 TOP
= Fnconc (2, &TOP
);
1645 AFTER_POTENTIAL_GC ();
1649 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1653 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1656 #ifdef BYTE_CODE_SAFE
1658 BEFORE_POTENTIAL_GC ();
1659 error ("set-mark is an obsolete bytecode");
1660 AFTER_POTENTIAL_GC ();
1663 BEFORE_POTENTIAL_GC ();
1664 error ("scan-buffer is an obsolete bytecode");
1665 AFTER_POTENTIAL_GC ();
1674 #ifdef BYTE_CODE_SAFE
1679 if ((op
-= Bconstant
) >= const_length
)
1685 PUSH (vectorp
[op
- Bconstant
]);
1692 byte_stack_list
= byte_stack_list
->next
;
1694 /* Binds and unbinds are supposed to be compiled balanced. */
1695 if (specpdl_ptr
- specpdl
!= count
)
1696 #ifdef BYTE_CODE_SAFE
1697 error ("binding stack not balanced (serious byte compiler bug)");
1708 Qbytecode
= intern ("byte-code");
1709 staticpro (&Qbytecode
);
1711 defsubr (&Sbyte_code
);
1713 #ifdef BYTE_CODE_METER
1715 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1716 "A vector of vectors which holds a histogram of byte-code usage.\n\
1717 (aref (aref byte-code-meter 0) CODE) indicates how many times the byte\n\
1718 opcode CODE has been executed.\n\
1719 (aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,\n\
1720 indicates how many times the byte opcodes CODE1 and CODE2 have been\n\
1721 executed in succession.");
1722 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1723 "If non-nil, keep profiling information on byte code usage.\n\
1724 The variable byte-code-meter indicates how often each byte opcode is used.\n\
1725 If a symbol has a property named `byte-code-meter' whose value is an\n\
1726 integer, it is incremented each time that symbol's function is called.");
1728 byte_metering_on
= 0;
1729 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1730 Qbyte_code_meter
= intern ("byte-code-meter");
1731 staticpro (&Qbyte_code_meter
);
1735 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1736 Fmake_vector (make_number (256), make_number (0));