(sgml-empty-tags): New var.
[emacs.git] / src / bytecode.c
blobc356eb3a26224ffa699d680960994d4663e47e85
1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001
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)
10 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; 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
28 of args;
29 o made the new bytecodes be called with args in the right order;
30 o added metering support.
32 by Hallvard:
33 o added relative jump instructions;
34 o all conditionals now only do QUIT if they jump.
37 #include <config.h>
38 #include "lisp.h"
39 #include "buffer.h"
40 #include "charset.h"
41 #include "syntax.h"
43 #ifdef CHECK_FRAME_FONT
44 #include "frame.h"
45 #include "xterm.h"
46 #endif
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;
61 int byte_metering_on;
63 #define METER_2(code1, code2) \
64 XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
65 ->contents[(code2)])
67 #define METER_1(code) METER_2 (0, (code))
69 #define METER_CODE(last_code, this_code) \
70 { \
71 if (byte_metering_on) \
72 { \
73 if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM) \
74 METER_1 (this_code)++; \
75 if (last_code \
76 && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM) \
77 METER_2 (last_code, this_code)++; \
78 } \
81 #else /* no BYTE_CODE_METER */
83 #define METER_CODE(last_code, this_code)
85 #endif /* no BYTE_CODE_METER */
88 Lisp_Object Qbytecode;
90 /* Byte codes: */
92 #define Bvarref 010
93 #define Bvarset 020
94 #define Bvarbind 030
95 #define Bcall 040
96 #define Bunbind 050
98 #define Bnth 070
99 #define Bsymbolp 071
100 #define Bconsp 072
101 #define Bstringp 073
102 #define Blistp 074
103 #define Beq 075
104 #define Bmemq 076
105 #define Bnot 077
106 #define Bcar 0100
107 #define Bcdr 0101
108 #define Bcons 0102
109 #define Blist1 0103
110 #define Blist2 0104
111 #define Blist3 0105
112 #define Blist4 0106
113 #define Blength 0107
114 #define Baref 0110
115 #define Baset 0111
116 #define Bsymbol_value 0112
117 #define Bsymbol_function 0113
118 #define Bset 0114
119 #define Bfset 0115
120 #define Bget 0116
121 #define Bsubstring 0117
122 #define Bconcat2 0120
123 #define Bconcat3 0121
124 #define Bconcat4 0122
125 #define Bsub1 0123
126 #define Badd1 0124
127 #define Beqlsign 0125
128 #define Bgtr 0126
129 #define Blss 0127
130 #define Bleq 0130
131 #define Bgeq 0131
132 #define Bdiff 0132
133 #define Bnegate 0133
134 #define Bplus 0134
135 #define Bmax 0135
136 #define Bmin 0136
137 #define Bmult 0137
139 #define Bpoint 0140
140 /* Was Bmark in v17. */
141 #define Bsave_current_buffer 0141
142 #define Bgoto_char 0142
143 #define Binsert 0143
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 */
152 #define Beolp 0154
153 #define Beobp 0155
154 #define Bbolp 0156
155 #define Bbobp 0157
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
172 #define Bwiden 0176
173 #define Bend_of_line 0177
175 #define Bconstant2 0201
176 #define Bgoto 0202
177 #define Bgotoifnil 0203
178 #define Bgotoifnonnil 0204
179 #define Bgotoifnilelsepop 0205
180 #define Bgotoifnonnilelsepop 0206
181 #define Breturn 0207
182 #define Bdiscard 0210
183 #define Bdup 0211
185 #define Bsave_excursion 0212
186 #define Bsave_window_excursion 0213
187 #define Bsave_restriction 0214
188 #define Bcatch 0215
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
200 #define Bupcase 0226
201 #define Bdowncase 0227
203 #define Bstringeqlsign 0230
204 #define Bstringlss 0231
205 #define Bequal 0232
206 #define Bnthcdr 0233
207 #define Belt 0234
208 #define Bmember 0235
209 #define Bassq 0236
210 #define Bnreverse 0237
211 #define Bsetcar 0240
212 #define Bsetcdr 0241
213 #define Bcar_safe 0242
214 #define Bcdr_safe 0243
215 #define Bnconc 0244
216 #define Bquo 0245
217 #define Brem 0246
218 #define Bnumberp 0247
219 #define Bintegerp 0250
221 #define BRgoto 0252
222 #define BRgotoifnil 0253
223 #define BRgotoifnonnil 0254
224 #define BRgotoifnilelsepop 0255
225 #define BRgotoifnonnilelsepop 0256
227 #define BlistN 0257
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
236 in Fbyte_code. */
238 struct byte_stack
240 /* Program counter. This points into the byte_string below
241 and is relocated when that string is relocated. */
242 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
250 marks it. */
251 Lisp_Object byte_string;
252 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
266 gcprolist. */
268 struct byte_stack *byte_stack_list;
271 /* Mark objects on byte_stack_list. Called during GC. */
273 void
274 mark_byte_stack ()
276 struct byte_stack *stack;
277 Lisp_Object *obj;
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 if (!stack->top)
289 abort ();
291 for (obj = stack->bottom; obj <= stack->top; ++obj)
292 if (!XMARKBIT (*obj))
294 mark_object (obj);
295 XMARK (*obj);
298 if (!XMARKBIT (stack->byte_string))
300 mark_object (&stack->byte_string);
301 XMARK (stack->byte_string);
304 if (!XMARKBIT (stack->constants))
306 mark_object (&stack->constants);
307 XMARK (stack->constants);
313 /* Unmark objects in the stacks on byte_stack_list. Relocate program
314 counters. Called when GC has completed. */
316 void
317 unmark_byte_stack ()
319 struct byte_stack *stack;
320 Lisp_Object *obj;
322 for (stack = byte_stack_list; stack; stack = stack->next)
324 for (obj = stack->bottom; obj <= stack->top; ++obj)
325 XUNMARK (*obj);
327 XUNMARK (stack->byte_string);
328 XUNMARK (stack->constants);
330 if (stack->byte_string_start != XSTRING (stack->byte_string)->data)
332 int offset = stack->pc - stack->byte_string_start;
333 stack->byte_string_start = XSTRING (stack->byte_string)->data;
334 stack->pc = stack->byte_string_start + offset;
340 /* Fetch the next byte from the bytecode stream */
342 #define FETCH *stack.pc++
344 /* Fetch two bytes from the bytecode stream and make a 16-bit number
345 out of them */
347 #define FETCH2 (op = FETCH, op + (FETCH << 8))
349 /* Push x onto the execution stack. This used to be #define PUSH(x)
350 (*++stackp = (x)) This oddity is necessary because Alliant can't be
351 bothered to compile the preincrement operator properly, as of 4/91.
352 -JimB */
354 #define PUSH(x) (top++, *top = (x))
356 /* Pop a value off the execution stack. */
358 #define POP (*top--)
360 /* Discard n values from the execution stack. */
362 #define DISCARD(n) (top -= (n))
364 /* Get the value which is at the top of the execution stack, but don't
365 pop it. */
367 #define TOP (*top)
369 /* Actions that must be performed before and after calling a function
370 that might GC. */
372 #define BEFORE_POTENTIAL_GC() stack.top = top
373 #define AFTER_POTENTIAL_GC() stack.top = NULL
375 /* Garbage collect if we have consed enough since the last time.
376 We do this at every branch, to avoid loops that never GC. */
378 #define MAYBE_GC() \
379 if (consing_since_gc > gc_cons_threshold) \
381 BEFORE_POTENTIAL_GC (); \
382 Fgarbage_collect (); \
383 AFTER_POTENTIAL_GC (); \
385 else
387 /* Check for jumping out of range. */
389 #ifdef BYTE_CODE_SAFE
391 #define CHECK_RANGE(ARG) \
392 if (ARG >= bytestr_length) abort ()
394 #else /* not BYTE_CODE_SAFE */
396 #define CHECK_RANGE(ARG)
398 #endif /* not BYTE_CODE_SAFE */
400 /* A version of the QUIT macro which makes sure that the stack top is
401 set before signaling `quit'. */
403 #define BYTE_CODE_QUIT \
404 do { \
405 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
407 Vquit_flag = Qnil; \
408 BEFORE_POTENTIAL_GC (); \
409 Fsignal (Qquit, Qnil); \
411 } while (0)
414 DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0,
415 doc: /* Function used internally in byte-compiled code.
416 The first argument, BYTESTR, is a string of byte code;
417 the second, VECTOR, a vector of constants;
418 the third, MAXDEPTH, the maximum stack depth used in this function.
419 If the third argument is incorrect, Emacs may crash. */)
420 (bytestr, vector, maxdepth)
421 Lisp_Object bytestr, vector, maxdepth;
423 int count = specpdl_ptr - specpdl;
424 #ifdef BYTE_CODE_METER
425 int this_op = 0;
426 int prev_op;
427 #endif
428 int op;
429 /* Lisp_Object v1, v2; */
430 Lisp_Object *vectorp;
431 #ifdef BYTE_CODE_SAFE
432 int const_length = XVECTOR (vector)->size;
433 Lisp_Object *stacke;
434 #endif
435 int bytestr_length;
436 struct byte_stack stack;
437 Lisp_Object *top;
438 Lisp_Object result;
440 #ifdef CHECK_FRAME_FONT
442 struct frame *f = SELECTED_FRAME ();
443 if (FRAME_X_P (f)
444 && FRAME_FONT (f)->direction != 0
445 && FRAME_FONT (f)->direction != 1)
446 abort ();
448 #endif
450 CHECK_STRING (bytestr, 0);
451 if (!VECTORP (vector))
452 vector = wrong_type_argument (Qvectorp, vector);
453 CHECK_NUMBER (maxdepth, 2);
455 if (STRING_MULTIBYTE (bytestr))
456 /* BYTESTR must have been produced by Emacs 20.2 or the earlier
457 because they produced a raw 8-bit string for byte-code and now
458 such a byte-code string is loaded as multibyte while raw 8-bit
459 characters converted to multibyte form. Thus, now we must
460 convert them back to the original unibyte form. */
461 bytestr = Fstring_as_unibyte (bytestr);
463 bytestr_length = STRING_BYTES (XSTRING (bytestr));
464 vectorp = XVECTOR (vector)->contents;
466 stack.byte_string = bytestr;
467 stack.pc = stack.byte_string_start = XSTRING (bytestr)->data;
468 stack.constants = vector;
469 stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth)
470 * sizeof (Lisp_Object));
471 top = stack.bottom - 1;
472 stack.top = NULL;
473 stack.next = byte_stack_list;
474 byte_stack_list = &stack;
476 #ifdef BYTE_CODE_SAFE
477 stacke = stack.bottom - 1 + XFASTINT (maxdepth);
478 #endif
480 while (1)
482 #ifdef BYTE_CODE_SAFE
483 if (top > stacke)
484 abort ();
485 else if (top < stack.bottom - 1)
486 abort ();
487 #endif
489 #ifdef BYTE_CODE_METER
490 prev_op = this_op;
491 this_op = op = FETCH;
492 METER_CODE (prev_op, op);
493 #else
494 op = FETCH;
495 #endif
497 switch (op)
499 case Bvarref + 7:
500 op = FETCH2;
501 goto varref;
503 case Bvarref:
504 case Bvarref + 1:
505 case Bvarref + 2:
506 case Bvarref + 3:
507 case Bvarref + 4:
508 case Bvarref + 5:
509 op = op - Bvarref;
510 goto varref;
512 /* This seems to be the most frequently executed byte-code
513 among the Bvarref's, so avoid a goto here. */
514 case Bvarref+6:
515 op = FETCH;
516 varref:
518 Lisp_Object v1, v2;
520 v1 = vectorp[op];
521 if (SYMBOLP (v1))
523 v2 = SYMBOL_VALUE (v1);
524 if (MISCP (v2) || EQ (v2, Qunbound))
526 BEFORE_POTENTIAL_GC ();
527 v2 = Fsymbol_value (v1);
528 AFTER_POTENTIAL_GC ();
531 else
533 BEFORE_POTENTIAL_GC ();
534 v2 = Fsymbol_value (v1);
535 AFTER_POTENTIAL_GC ();
537 PUSH (v2);
538 break;
541 case Bgotoifnil:
542 MAYBE_GC ();
543 op = FETCH2;
544 if (NILP (POP))
546 BYTE_CODE_QUIT;
547 CHECK_RANGE (op);
548 stack.pc = stack.byte_string_start + op;
550 break;
552 case Bcar:
554 Lisp_Object v1;
555 v1 = TOP;
556 if (CONSP (v1))
557 TOP = XCAR (v1);
558 else if (NILP (v1))
559 TOP = Qnil;
560 else
562 BEFORE_POTENTIAL_GC ();
563 Fcar (wrong_type_argument (Qlistp, v1));
564 AFTER_POTENTIAL_GC ();
566 break;
569 case Beq:
571 Lisp_Object v1;
572 v1 = POP;
573 TOP = EQ (v1, TOP) ? Qt : Qnil;
574 break;
577 case Bmemq:
579 Lisp_Object v1;
580 BEFORE_POTENTIAL_GC ();
581 v1 = POP;
582 TOP = Fmemq (TOP, v1);
583 AFTER_POTENTIAL_GC ();
584 break;
587 case Bcdr:
589 Lisp_Object v1;
590 v1 = TOP;
591 if (CONSP (v1))
592 TOP = XCDR (v1);
593 else if (NILP (v1))
594 TOP = Qnil;
595 else
597 BEFORE_POTENTIAL_GC ();
598 Fcdr (wrong_type_argument (Qlistp, v1));
599 AFTER_POTENTIAL_GC ();
601 break;
604 case Bvarset:
605 case Bvarset+1:
606 case Bvarset+2:
607 case Bvarset+3:
608 case Bvarset+4:
609 case Bvarset+5:
610 op -= Bvarset;
611 goto varset;
613 case Bvarset+7:
614 op = FETCH2;
615 goto varset;
617 case Bvarset+6:
618 op = FETCH;
619 varset:
621 Lisp_Object sym, val;
623 sym = vectorp[op];
624 val = TOP;
626 /* Inline the most common case. */
627 if (SYMBOLP (sym)
628 && !EQ (val, Qunbound)
629 && !XSYMBOL (sym)->indirect_variable
630 && !XSYMBOL (sym)->constant
631 && !MISCP (XSYMBOL (sym)->value))
632 XSYMBOL (sym)->value = val;
633 else
635 BEFORE_POTENTIAL_GC ();
636 set_internal (sym, val, current_buffer, 0);
637 AFTER_POTENTIAL_GC ();
640 POP;
641 break;
643 case Bdup:
645 Lisp_Object v1;
646 v1 = TOP;
647 PUSH (v1);
648 break;
651 /* ------------------ */
653 case Bvarbind+6:
654 op = FETCH;
655 goto varbind;
657 case Bvarbind+7:
658 op = FETCH2;
659 goto varbind;
661 case Bvarbind:
662 case Bvarbind+1:
663 case Bvarbind+2:
664 case Bvarbind+3:
665 case Bvarbind+4:
666 case Bvarbind+5:
667 op -= Bvarbind;
668 varbind:
669 /* Specbind can signal and thus GC. */
670 BEFORE_POTENTIAL_GC ();
671 specbind (vectorp[op], POP);
672 AFTER_POTENTIAL_GC ();
673 break;
675 case Bcall+6:
676 op = FETCH;
677 goto docall;
679 case Bcall+7:
680 op = FETCH2;
681 goto docall;
683 case Bcall:
684 case Bcall+1:
685 case Bcall+2:
686 case Bcall+3:
687 case Bcall+4:
688 case Bcall+5:
689 op -= Bcall;
690 docall:
692 BEFORE_POTENTIAL_GC ();
693 DISCARD (op);
694 #ifdef BYTE_CODE_METER
695 if (byte_metering_on && SYMBOLP (TOP))
697 Lisp_Object v1, v2;
699 v1 = TOP;
700 v2 = Fget (v1, Qbyte_code_meter);
701 if (INTEGERP (v2)
702 && XINT (v2) < MOST_POSITIVE_FIXNUM)
704 XSETINT (v2, XINT (v2) + 1);
705 Fput (v1, Qbyte_code_meter, v2);
708 #endif
709 TOP = Ffuncall (op + 1, &TOP);
710 AFTER_POTENTIAL_GC ();
711 break;
714 case Bunbind+6:
715 op = FETCH;
716 goto dounbind;
718 case Bunbind+7:
719 op = FETCH2;
720 goto dounbind;
722 case Bunbind:
723 case Bunbind+1:
724 case Bunbind+2:
725 case Bunbind+3:
726 case Bunbind+4:
727 case Bunbind+5:
728 op -= Bunbind;
729 dounbind:
730 BEFORE_POTENTIAL_GC ();
731 unbind_to (specpdl_ptr - specpdl - op, Qnil);
732 AFTER_POTENTIAL_GC ();
733 break;
735 case Bunbind_all:
736 /* To unbind back to the beginning of this frame. Not used yet,
737 but will be needed for tail-recursion elimination. */
738 BEFORE_POTENTIAL_GC ();
739 unbind_to (count, Qnil);
740 AFTER_POTENTIAL_GC ();
741 break;
743 case Bgoto:
744 MAYBE_GC ();
745 BYTE_CODE_QUIT;
746 op = FETCH2; /* pc = FETCH2 loses since FETCH2 contains pc++ */
747 CHECK_RANGE (op);
748 stack.pc = stack.byte_string_start + op;
749 break;
751 case Bgotoifnonnil:
752 MAYBE_GC ();
753 op = FETCH2;
754 if (!NILP (POP))
756 BYTE_CODE_QUIT;
757 CHECK_RANGE (op);
758 stack.pc = stack.byte_string_start + op;
760 break;
762 case Bgotoifnilelsepop:
763 MAYBE_GC ();
764 op = FETCH2;
765 if (NILP (TOP))
767 BYTE_CODE_QUIT;
768 CHECK_RANGE (op);
769 stack.pc = stack.byte_string_start + op;
771 else DISCARD (1);
772 break;
774 case Bgotoifnonnilelsepop:
775 MAYBE_GC ();
776 op = FETCH2;
777 if (!NILP (TOP))
779 BYTE_CODE_QUIT;
780 CHECK_RANGE (op);
781 stack.pc = stack.byte_string_start + op;
783 else DISCARD (1);
784 break;
786 case BRgoto:
787 MAYBE_GC ();
788 BYTE_CODE_QUIT;
789 stack.pc += (int) *stack.pc - 127;
790 break;
792 case BRgotoifnil:
793 MAYBE_GC ();
794 if (NILP (POP))
796 BYTE_CODE_QUIT;
797 stack.pc += (int) *stack.pc - 128;
799 stack.pc++;
800 break;
802 case BRgotoifnonnil:
803 MAYBE_GC ();
804 if (!NILP (POP))
806 BYTE_CODE_QUIT;
807 stack.pc += (int) *stack.pc - 128;
809 stack.pc++;
810 break;
812 case BRgotoifnilelsepop:
813 MAYBE_GC ();
814 op = *stack.pc++;
815 if (NILP (TOP))
817 BYTE_CODE_QUIT;
818 stack.pc += op - 128;
820 else DISCARD (1);
821 break;
823 case BRgotoifnonnilelsepop:
824 MAYBE_GC ();
825 op = *stack.pc++;
826 if (!NILP (TOP))
828 BYTE_CODE_QUIT;
829 stack.pc += op - 128;
831 else DISCARD (1);
832 break;
834 case Breturn:
835 result = POP;
836 goto exit;
838 case Bdiscard:
839 DISCARD (1);
840 break;
842 case Bconstant2:
843 PUSH (vectorp[FETCH2]);
844 break;
846 case Bsave_excursion:
847 record_unwind_protect (save_excursion_restore,
848 save_excursion_save ());
849 break;
851 case Bsave_current_buffer:
852 case Bsave_current_buffer_1:
853 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
854 break;
856 case Bsave_window_excursion:
857 BEFORE_POTENTIAL_GC ();
858 TOP = Fsave_window_excursion (TOP);
859 AFTER_POTENTIAL_GC ();
860 break;
862 case Bsave_restriction:
863 record_unwind_protect (save_restriction_restore,
864 save_restriction_save ());
865 break;
867 case Bcatch:
869 Lisp_Object v1;
870 BEFORE_POTENTIAL_GC ();
871 v1 = POP;
872 TOP = internal_catch (TOP, Feval, v1);
873 AFTER_POTENTIAL_GC ();
874 break;
877 case Bunwind_protect:
878 /* The function record_unwind_protect can GC. */
879 BEFORE_POTENTIAL_GC ();
880 record_unwind_protect (0, POP);
881 AFTER_POTENTIAL_GC ();
882 (specpdl_ptr - 1)->symbol = Qnil;
883 break;
885 case Bcondition_case:
887 Lisp_Object v1;
888 v1 = POP;
889 v1 = Fcons (POP, v1);
890 BEFORE_POTENTIAL_GC ();
891 TOP = Fcondition_case (Fcons (TOP, v1));
892 AFTER_POTENTIAL_GC ();
893 break;
896 case Btemp_output_buffer_setup:
897 BEFORE_POTENTIAL_GC ();
898 CHECK_STRING (TOP, 0);
899 temp_output_buffer_setup (XSTRING (TOP)->data);
900 AFTER_POTENTIAL_GC ();
901 TOP = Vstandard_output;
902 break;
904 case Btemp_output_buffer_show:
906 Lisp_Object v1;
907 BEFORE_POTENTIAL_GC ();
908 v1 = POP;
909 temp_output_buffer_show (TOP);
910 TOP = v1;
911 /* pop binding of standard-output */
912 unbind_to (specpdl_ptr - specpdl - 1, Qnil);
913 AFTER_POTENTIAL_GC ();
914 break;
917 case Bnth:
919 Lisp_Object v1, v2;
920 BEFORE_POTENTIAL_GC ();
921 v1 = POP;
922 v2 = TOP;
923 CHECK_NUMBER (v2, 0);
924 AFTER_POTENTIAL_GC ();
925 op = XINT (v2);
926 immediate_quit = 1;
927 while (--op >= 0)
929 if (CONSP (v1))
930 v1 = XCDR (v1);
931 else if (!NILP (v1))
933 immediate_quit = 0;
934 BEFORE_POTENTIAL_GC ();
935 v1 = wrong_type_argument (Qlistp, v1);
936 AFTER_POTENTIAL_GC ();
937 immediate_quit = 1;
938 op++;
941 immediate_quit = 0;
942 if (CONSP (v1))
943 TOP = XCAR (v1);
944 else if (NILP (v1))
945 TOP = Qnil;
946 else
948 BEFORE_POTENTIAL_GC ();
949 Fcar (wrong_type_argument (Qlistp, v1));
950 AFTER_POTENTIAL_GC ();
952 break;
955 case Bsymbolp:
956 TOP = SYMBOLP (TOP) ? Qt : Qnil;
957 break;
959 case Bconsp:
960 TOP = CONSP (TOP) ? Qt : Qnil;
961 break;
963 case Bstringp:
964 TOP = STRINGP (TOP) ? Qt : Qnil;
965 break;
967 case Blistp:
968 TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
969 break;
971 case Bnot:
972 TOP = NILP (TOP) ? Qt : Qnil;
973 break;
975 case Bcons:
977 Lisp_Object v1;
978 v1 = POP;
979 TOP = Fcons (TOP, v1);
980 break;
983 case Blist1:
984 TOP = Fcons (TOP, Qnil);
985 break;
987 case Blist2:
989 Lisp_Object v1;
990 v1 = POP;
991 TOP = Fcons (TOP, Fcons (v1, Qnil));
992 break;
995 case Blist3:
996 DISCARD (2);
997 TOP = Flist (3, &TOP);
998 break;
1000 case Blist4:
1001 DISCARD (3);
1002 TOP = Flist (4, &TOP);
1003 break;
1005 case BlistN:
1006 op = FETCH;
1007 DISCARD (op - 1);
1008 TOP = Flist (op, &TOP);
1009 break;
1011 case Blength:
1012 BEFORE_POTENTIAL_GC ();
1013 TOP = Flength (TOP);
1014 AFTER_POTENTIAL_GC ();
1015 break;
1017 case Baref:
1019 Lisp_Object v1;
1020 BEFORE_POTENTIAL_GC ();
1021 v1 = POP;
1022 TOP = Faref (TOP, v1);
1023 AFTER_POTENTIAL_GC ();
1024 break;
1027 case Baset:
1029 Lisp_Object v1, v2;
1030 BEFORE_POTENTIAL_GC ();
1031 v2 = POP; v1 = POP;
1032 TOP = Faset (TOP, v1, v2);
1033 AFTER_POTENTIAL_GC ();
1034 break;
1037 case Bsymbol_value:
1038 BEFORE_POTENTIAL_GC ();
1039 TOP = Fsymbol_value (TOP);
1040 AFTER_POTENTIAL_GC ();
1041 break;
1043 case Bsymbol_function:
1044 BEFORE_POTENTIAL_GC ();
1045 TOP = Fsymbol_function (TOP);
1046 AFTER_POTENTIAL_GC ();
1047 break;
1049 case Bset:
1051 Lisp_Object v1;
1052 BEFORE_POTENTIAL_GC ();
1053 v1 = POP;
1054 TOP = Fset (TOP, v1);
1055 AFTER_POTENTIAL_GC ();
1056 break;
1059 case Bfset:
1061 Lisp_Object v1;
1062 BEFORE_POTENTIAL_GC ();
1063 v1 = POP;
1064 TOP = Ffset (TOP, v1);
1065 AFTER_POTENTIAL_GC ();
1066 break;
1069 case Bget:
1071 Lisp_Object v1;
1072 BEFORE_POTENTIAL_GC ();
1073 v1 = POP;
1074 TOP = Fget (TOP, v1);
1075 AFTER_POTENTIAL_GC ();
1076 break;
1079 case Bsubstring:
1081 Lisp_Object v1, v2;
1082 BEFORE_POTENTIAL_GC ();
1083 v2 = POP; v1 = POP;
1084 TOP = Fsubstring (TOP, v1, v2);
1085 AFTER_POTENTIAL_GC ();
1086 break;
1089 case Bconcat2:
1090 BEFORE_POTENTIAL_GC ();
1091 DISCARD (1);
1092 TOP = Fconcat (2, &TOP);
1093 AFTER_POTENTIAL_GC ();
1094 break;
1096 case Bconcat3:
1097 BEFORE_POTENTIAL_GC ();
1098 DISCARD (2);
1099 TOP = Fconcat (3, &TOP);
1100 AFTER_POTENTIAL_GC ();
1101 break;
1103 case Bconcat4:
1104 BEFORE_POTENTIAL_GC ();
1105 DISCARD (3);
1106 TOP = Fconcat (4, &TOP);
1107 AFTER_POTENTIAL_GC ();
1108 break;
1110 case BconcatN:
1111 op = FETCH;
1112 BEFORE_POTENTIAL_GC ();
1113 DISCARD (op - 1);
1114 TOP = Fconcat (op, &TOP);
1115 AFTER_POTENTIAL_GC ();
1116 break;
1118 case Bsub1:
1120 Lisp_Object v1;
1121 v1 = TOP;
1122 if (INTEGERP (v1))
1124 XSETINT (v1, XINT (v1) - 1);
1125 TOP = v1;
1127 else
1128 TOP = Fsub1 (v1);
1129 break;
1132 case Badd1:
1134 Lisp_Object v1;
1135 v1 = TOP;
1136 if (INTEGERP (v1))
1138 XSETINT (v1, XINT (v1) + 1);
1139 TOP = v1;
1141 else
1143 BEFORE_POTENTIAL_GC ();
1144 TOP = Fadd1 (v1);
1145 AFTER_POTENTIAL_GC ();
1147 break;
1150 case Beqlsign:
1152 Lisp_Object v1, v2;
1153 BEFORE_POTENTIAL_GC ();
1154 v2 = POP; v1 = TOP;
1155 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1, 0);
1156 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2, 0);
1157 AFTER_POTENTIAL_GC ();
1158 if (FLOATP (v1) || FLOATP (v2))
1160 double f1, f2;
1162 f1 = (FLOATP (v1) ? XFLOAT_DATA (v1) : XINT (v1));
1163 f2 = (FLOATP (v2) ? XFLOAT_DATA (v2) : XINT (v2));
1164 TOP = (f1 == f2 ? Qt : Qnil);
1166 else
1167 TOP = (XINT (v1) == XINT (v2) ? Qt : Qnil);
1168 break;
1171 case Bgtr:
1173 Lisp_Object v1;
1174 BEFORE_POTENTIAL_GC ();
1175 v1 = POP;
1176 TOP = Fgtr (TOP, v1);
1177 AFTER_POTENTIAL_GC ();
1178 break;
1181 case Blss:
1183 Lisp_Object v1;
1184 BEFORE_POTENTIAL_GC ();
1185 v1 = POP;
1186 TOP = Flss (TOP, v1);
1187 AFTER_POTENTIAL_GC ();
1188 break;
1191 case Bleq:
1193 Lisp_Object v1;
1194 BEFORE_POTENTIAL_GC ();
1195 v1 = POP;
1196 TOP = Fleq (TOP, v1);
1197 AFTER_POTENTIAL_GC ();
1198 break;
1201 case Bgeq:
1203 Lisp_Object v1;
1204 BEFORE_POTENTIAL_GC ();
1205 v1 = POP;
1206 TOP = Fgeq (TOP, v1);
1207 AFTER_POTENTIAL_GC ();
1208 break;
1211 case Bdiff:
1212 BEFORE_POTENTIAL_GC ();
1213 DISCARD (1);
1214 TOP = Fminus (2, &TOP);
1215 AFTER_POTENTIAL_GC ();
1216 break;
1218 case Bnegate:
1220 Lisp_Object v1;
1221 v1 = TOP;
1222 if (INTEGERP (v1))
1224 XSETINT (v1, - XINT (v1));
1225 TOP = v1;
1227 else
1229 BEFORE_POTENTIAL_GC ();
1230 TOP = Fminus (1, &TOP);
1231 AFTER_POTENTIAL_GC ();
1233 break;
1236 case Bplus:
1237 BEFORE_POTENTIAL_GC ();
1238 DISCARD (1);
1239 TOP = Fplus (2, &TOP);
1240 AFTER_POTENTIAL_GC ();
1241 break;
1243 case Bmax:
1244 BEFORE_POTENTIAL_GC ();
1245 DISCARD (1);
1246 TOP = Fmax (2, &TOP);
1247 AFTER_POTENTIAL_GC ();
1248 break;
1250 case Bmin:
1251 BEFORE_POTENTIAL_GC ();
1252 DISCARD (1);
1253 TOP = Fmin (2, &TOP);
1254 AFTER_POTENTIAL_GC ();
1255 break;
1257 case Bmult:
1258 BEFORE_POTENTIAL_GC ();
1259 DISCARD (1);
1260 TOP = Ftimes (2, &TOP);
1261 AFTER_POTENTIAL_GC ();
1262 break;
1264 case Bquo:
1265 BEFORE_POTENTIAL_GC ();
1266 DISCARD (1);
1267 TOP = Fquo (2, &TOP);
1268 AFTER_POTENTIAL_GC ();
1269 break;
1271 case Brem:
1273 Lisp_Object v1;
1274 BEFORE_POTENTIAL_GC ();
1275 v1 = POP;
1276 TOP = Frem (TOP, v1);
1277 AFTER_POTENTIAL_GC ();
1278 break;
1281 case Bpoint:
1283 Lisp_Object v1;
1284 XSETFASTINT (v1, PT);
1285 PUSH (v1);
1286 break;
1289 case Bgoto_char:
1290 BEFORE_POTENTIAL_GC ();
1291 TOP = Fgoto_char (TOP);
1292 AFTER_POTENTIAL_GC ();
1293 break;
1295 case Binsert:
1296 BEFORE_POTENTIAL_GC ();
1297 TOP = Finsert (1, &TOP);
1298 AFTER_POTENTIAL_GC ();
1299 break;
1301 case BinsertN:
1302 op = FETCH;
1303 BEFORE_POTENTIAL_GC ();
1304 DISCARD (op - 1);
1305 TOP = Finsert (op, &TOP);
1306 AFTER_POTENTIAL_GC ();
1307 break;
1309 case Bpoint_max:
1311 Lisp_Object v1;
1312 XSETFASTINT (v1, ZV);
1313 PUSH (v1);
1314 break;
1317 case Bpoint_min:
1319 Lisp_Object v1;
1320 XSETFASTINT (v1, BEGV);
1321 PUSH (v1);
1322 break;
1325 case Bchar_after:
1326 BEFORE_POTENTIAL_GC ();
1327 TOP = Fchar_after (TOP);
1328 AFTER_POTENTIAL_GC ();
1329 break;
1331 case Bfollowing_char:
1333 Lisp_Object v1;
1334 BEFORE_POTENTIAL_GC ();
1335 v1 = Ffollowing_char ();
1336 AFTER_POTENTIAL_GC ();
1337 PUSH (v1);
1338 break;
1341 case Bpreceding_char:
1343 Lisp_Object v1;
1344 BEFORE_POTENTIAL_GC ();
1345 v1 = Fprevious_char ();
1346 AFTER_POTENTIAL_GC ();
1347 PUSH (v1);
1348 break;
1351 case Bcurrent_column:
1353 Lisp_Object v1;
1354 BEFORE_POTENTIAL_GC ();
1355 XSETFASTINT (v1, current_column ());
1356 AFTER_POTENTIAL_GC ();
1357 PUSH (v1);
1358 break;
1361 case Bindent_to:
1362 BEFORE_POTENTIAL_GC ();
1363 TOP = Findent_to (TOP, Qnil);
1364 AFTER_POTENTIAL_GC ();
1365 break;
1367 case Beolp:
1368 PUSH (Feolp ());
1369 break;
1371 case Beobp:
1372 PUSH (Feobp ());
1373 break;
1375 case Bbolp:
1376 PUSH (Fbolp ());
1377 break;
1379 case Bbobp:
1380 PUSH (Fbobp ());
1381 break;
1383 case Bcurrent_buffer:
1384 PUSH (Fcurrent_buffer ());
1385 break;
1387 case Bset_buffer:
1388 BEFORE_POTENTIAL_GC ();
1389 TOP = Fset_buffer (TOP);
1390 AFTER_POTENTIAL_GC ();
1391 break;
1393 case Binteractive_p:
1394 PUSH (Finteractive_p ());
1395 break;
1397 case Bforward_char:
1398 BEFORE_POTENTIAL_GC ();
1399 TOP = Fforward_char (TOP);
1400 AFTER_POTENTIAL_GC ();
1401 break;
1403 case Bforward_word:
1404 BEFORE_POTENTIAL_GC ();
1405 TOP = Fforward_word (TOP);
1406 AFTER_POTENTIAL_GC ();
1407 break;
1409 case Bskip_chars_forward:
1411 Lisp_Object v1;
1412 BEFORE_POTENTIAL_GC ();
1413 v1 = POP;
1414 TOP = Fskip_chars_forward (TOP, v1);
1415 AFTER_POTENTIAL_GC ();
1416 break;
1419 case Bskip_chars_backward:
1421 Lisp_Object v1;
1422 BEFORE_POTENTIAL_GC ();
1423 v1 = POP;
1424 TOP = Fskip_chars_backward (TOP, v1);
1425 AFTER_POTENTIAL_GC ();
1426 break;
1429 case Bforward_line:
1430 BEFORE_POTENTIAL_GC ();
1431 TOP = Fforward_line (TOP);
1432 AFTER_POTENTIAL_GC ();
1433 break;
1435 case Bchar_syntax:
1436 BEFORE_POTENTIAL_GC ();
1437 CHECK_NUMBER (TOP, 0);
1438 AFTER_POTENTIAL_GC ();
1439 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (XINT (TOP))]);
1440 break;
1442 case Bbuffer_substring:
1444 Lisp_Object v1;
1445 BEFORE_POTENTIAL_GC ();
1446 v1 = POP;
1447 TOP = Fbuffer_substring (TOP, v1);
1448 AFTER_POTENTIAL_GC ();
1449 break;
1452 case Bdelete_region:
1454 Lisp_Object v1;
1455 BEFORE_POTENTIAL_GC ();
1456 v1 = POP;
1457 TOP = Fdelete_region (TOP, v1);
1458 AFTER_POTENTIAL_GC ();
1459 break;
1462 case Bnarrow_to_region:
1464 Lisp_Object v1;
1465 BEFORE_POTENTIAL_GC ();
1466 v1 = POP;
1467 TOP = Fnarrow_to_region (TOP, v1);
1468 AFTER_POTENTIAL_GC ();
1469 break;
1472 case Bwiden:
1473 BEFORE_POTENTIAL_GC ();
1474 PUSH (Fwiden ());
1475 AFTER_POTENTIAL_GC ();
1476 break;
1478 case Bend_of_line:
1479 BEFORE_POTENTIAL_GC ();
1480 TOP = Fend_of_line (TOP);
1481 AFTER_POTENTIAL_GC ();
1482 break;
1484 case Bset_marker:
1486 Lisp_Object v1, v2;
1487 BEFORE_POTENTIAL_GC ();
1488 v1 = POP;
1489 v2 = POP;
1490 TOP = Fset_marker (TOP, v2, v1);
1491 AFTER_POTENTIAL_GC ();
1492 break;
1495 case Bmatch_beginning:
1496 BEFORE_POTENTIAL_GC ();
1497 TOP = Fmatch_beginning (TOP);
1498 AFTER_POTENTIAL_GC ();
1499 break;
1501 case Bmatch_end:
1502 BEFORE_POTENTIAL_GC ();
1503 TOP = Fmatch_end (TOP);
1504 AFTER_POTENTIAL_GC ();
1505 break;
1507 case Bupcase:
1508 BEFORE_POTENTIAL_GC ();
1509 TOP = Fupcase (TOP);
1510 AFTER_POTENTIAL_GC ();
1511 break;
1513 case Bdowncase:
1514 BEFORE_POTENTIAL_GC ();
1515 TOP = Fdowncase (TOP);
1516 AFTER_POTENTIAL_GC ();
1517 break;
1519 case Bstringeqlsign:
1521 Lisp_Object v1;
1522 BEFORE_POTENTIAL_GC ();
1523 v1 = POP;
1524 TOP = Fstring_equal (TOP, v1);
1525 AFTER_POTENTIAL_GC ();
1526 break;
1529 case Bstringlss:
1531 Lisp_Object v1;
1532 BEFORE_POTENTIAL_GC ();
1533 v1 = POP;
1534 TOP = Fstring_lessp (TOP, v1);
1535 AFTER_POTENTIAL_GC ();
1536 break;
1539 case Bequal:
1541 Lisp_Object v1;
1542 v1 = POP;
1543 TOP = Fequal (TOP, v1);
1544 break;
1547 case Bnthcdr:
1549 Lisp_Object v1;
1550 BEFORE_POTENTIAL_GC ();
1551 v1 = POP;
1552 TOP = Fnthcdr (TOP, v1);
1553 AFTER_POTENTIAL_GC ();
1554 break;
1557 case Belt:
1559 Lisp_Object v1, v2;
1560 if (CONSP (TOP))
1562 /* Exchange args and then do nth. */
1563 BEFORE_POTENTIAL_GC ();
1564 v2 = POP;
1565 v1 = TOP;
1566 CHECK_NUMBER (v2, 0);
1567 AFTER_POTENTIAL_GC ();
1568 op = XINT (v2);
1569 immediate_quit = 1;
1570 while (--op >= 0)
1572 if (CONSP (v1))
1573 v1 = XCDR (v1);
1574 else if (!NILP (v1))
1576 immediate_quit = 0;
1577 BEFORE_POTENTIAL_GC ();
1578 v1 = wrong_type_argument (Qlistp, v1);
1579 AFTER_POTENTIAL_GC ();
1580 immediate_quit = 1;
1581 op++;
1584 immediate_quit = 0;
1585 if (CONSP (v1))
1586 TOP = XCAR (v1);
1587 else if (NILP (v1))
1588 TOP = Qnil;
1589 else
1591 BEFORE_POTENTIAL_GC ();
1592 Fcar (wrong_type_argument (Qlistp, v1));
1593 AFTER_POTENTIAL_GC ();
1596 else
1598 BEFORE_POTENTIAL_GC ();
1599 v1 = POP;
1600 TOP = Felt (TOP, v1);
1601 AFTER_POTENTIAL_GC ();
1603 break;
1606 case Bmember:
1608 Lisp_Object v1;
1609 BEFORE_POTENTIAL_GC ();
1610 v1 = POP;
1611 TOP = Fmember (TOP, v1);
1612 AFTER_POTENTIAL_GC ();
1613 break;
1616 case Bassq:
1618 Lisp_Object v1;
1619 BEFORE_POTENTIAL_GC ();
1620 v1 = POP;
1621 TOP = Fassq (TOP, v1);
1622 AFTER_POTENTIAL_GC ();
1623 break;
1626 case Bnreverse:
1627 BEFORE_POTENTIAL_GC ();
1628 TOP = Fnreverse (TOP);
1629 AFTER_POTENTIAL_GC ();
1630 break;
1632 case Bsetcar:
1634 Lisp_Object v1;
1635 BEFORE_POTENTIAL_GC ();
1636 v1 = POP;
1637 TOP = Fsetcar (TOP, v1);
1638 AFTER_POTENTIAL_GC ();
1639 break;
1642 case Bsetcdr:
1644 Lisp_Object v1;
1645 BEFORE_POTENTIAL_GC ();
1646 v1 = POP;
1647 TOP = Fsetcdr (TOP, v1);
1648 AFTER_POTENTIAL_GC ();
1649 break;
1652 case Bcar_safe:
1654 Lisp_Object v1;
1655 v1 = TOP;
1656 if (CONSP (v1))
1657 TOP = XCAR (v1);
1658 else
1659 TOP = Qnil;
1660 break;
1663 case Bcdr_safe:
1665 Lisp_Object v1;
1666 v1 = TOP;
1667 if (CONSP (v1))
1668 TOP = XCDR (v1);
1669 else
1670 TOP = Qnil;
1671 break;
1674 case Bnconc:
1675 BEFORE_POTENTIAL_GC ();
1676 DISCARD (1);
1677 TOP = Fnconc (2, &TOP);
1678 AFTER_POTENTIAL_GC ();
1679 break;
1681 case Bnumberp:
1682 TOP = (NUMBERP (TOP) ? Qt : Qnil);
1683 break;
1685 case Bintegerp:
1686 TOP = INTEGERP (TOP) ? Qt : Qnil;
1687 break;
1689 #ifdef BYTE_CODE_SAFE
1690 case Bset_mark:
1691 BEFORE_POTENTIAL_GC ();
1692 error ("set-mark is an obsolete bytecode");
1693 AFTER_POTENTIAL_GC ();
1694 break;
1695 case Bscan_buffer:
1696 BEFORE_POTENTIAL_GC ();
1697 error ("scan-buffer is an obsolete bytecode");
1698 AFTER_POTENTIAL_GC ();
1699 break;
1700 #endif
1702 case 0:
1703 abort ();
1705 case 255:
1706 default:
1707 #ifdef BYTE_CODE_SAFE
1708 if (op < Bconstant)
1710 abort ();
1712 if ((op -= Bconstant) >= const_length)
1714 abort ();
1716 PUSH (vectorp[op]);
1717 #else
1718 PUSH (vectorp[op - Bconstant]);
1719 #endif
1723 exit:
1725 byte_stack_list = byte_stack_list->next;
1727 /* Binds and unbinds are supposed to be compiled balanced. */
1728 if (specpdl_ptr - specpdl != count)
1729 #ifdef BYTE_CODE_SAFE
1730 error ("binding stack not balanced (serious byte compiler bug)");
1731 #else
1732 abort ();
1733 #endif
1735 return result;
1738 void
1739 syms_of_bytecode ()
1741 Qbytecode = intern ("byte-code");
1742 staticpro (&Qbytecode);
1744 defsubr (&Sbyte_code);
1746 #ifdef BYTE_CODE_METER
1748 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter,
1749 doc: /* A vector of vectors which holds a histogram of byte-code usage.
1750 \(aref (aref byte-code-meter 0) CODE) indicates how many times the byte
1751 opcode CODE has been executed.
1752 \(aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
1753 indicates how many times the byte opcodes CODE1 and CODE2 have been
1754 executed in succession. */);
1756 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on,
1757 doc: /* If non-nil, keep profiling information on byte code usage.
1758 The variable byte-code-meter indicates how often each byte opcode is used.
1759 If a symbol has a property named `byte-code-meter' whose value is an
1760 integer, it is incremented each time that symbol's function is called. */);
1762 byte_metering_on = 0;
1763 Vbyte_code_meter = Fmake_vector (make_number (256), make_number (0));
1764 Qbyte_code_meter = intern ("byte-code-meter");
1765 staticpro (&Qbyte_code_meter);
1767 int i = 256;
1768 while (i--)
1769 XVECTOR (Vbyte_code_meter)->contents[i] =
1770 Fmake_vector (make_number (256), make_number (0));
1772 #endif