1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993 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
)
278 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
279 if (!XMARKBIT (*obj
))
285 if (!XMARKBIT (stack
->byte_string
))
287 mark_object (&stack
->byte_string
);
288 XMARK (stack
->byte_string
);
291 if (!XMARKBIT (stack
->constants
))
293 mark_object (&stack
->constants
);
294 XMARK (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
;
309 for (stack
= byte_stack_list
; stack
; stack
= stack
->next
)
311 for (obj
= stack
->bottom
; obj
<= stack
->top
; ++obj
)
314 XUNMARK (stack
->byte_string
);
315 XUNMARK (stack
->constants
);
317 if (stack
->byte_string_start
!= XSTRING (stack
->byte_string
)->data
)
319 int offset
= stack
->pc
- stack
->byte_string_start
;
320 stack
->byte_string_start
= XSTRING (stack
->byte_string
)->data
;
321 stack
->pc
= stack
->byte_string_start
+ offset
;
327 /* Fetch the next byte from the bytecode stream */
329 #define FETCH *stack.pc++
331 /* Fetch two bytes from the bytecode stream and make a 16-bit number
334 #define FETCH2 (op = FETCH, op + (FETCH << 8))
336 /* Push x onto the execution stack. This used to be #define PUSH(x)
337 (*++stackp = (x)) This oddity is necessary because Alliant can't be
338 bothered to compile the preincrement operator properly, as of 4/91.
341 #define PUSH(x) (top++, *top = (x))
343 /* Pop a value off the execution stack. */
347 /* Discard n values from the execution stack. */
349 #define DISCARD(n) (top -= (n))
351 /* Get the value which is at the top of the execution stack, but don't
356 /* Actions that must be performed before and after calling a function
359 #define BEFORE_POTENTIAL_GC() stack.top = top
360 #define AFTER_POTENTIAL_GC() stack.top = NULL
362 /* Garbage collect if we have consed enough since the last time.
363 We do this at every branch, to avoid loops that never GC. */
366 if (consing_since_gc > gc_cons_threshold) \
368 BEFORE_POTENTIAL_GC (); \
369 Fgarbage_collect (); \
370 AFTER_POTENTIAL_GC (); \
374 /* Check for jumping out of range. */
376 #ifdef BYTE_CODE_SAFE
378 #define CHECK_RANGE(ARG) \
379 if (ARG >= bytestr_length) abort ()
381 #else /* not BYTE_CODE_SAFE */
383 #define CHECK_RANGE(ARG)
385 #endif /* not BYTE_CODE_SAFE */
388 DEFUN ("byte-code", Fbyte_code
, Sbyte_code
, 3, 3, 0,
389 "Function used internally in byte-compiled code.\n\
390 The first argument, BYTESTR, is a string of byte code;\n\
391 the second, VECTOR, a vector of constants;\n\
392 the third, MAXDEPTH, the maximum stack depth used in this function.\n\
393 If the third argument is incorrect, Emacs may crash.")
394 (bytestr
, vector
, maxdepth
)
395 Lisp_Object bytestr
, vector
, maxdepth
;
397 int count
= specpdl_ptr
- specpdl
;
398 #ifdef BYTE_CODE_METER
403 /* Lisp_Object v1, v2; */
404 Lisp_Object
*vectorp
= XVECTOR (vector
)->contents
;
405 #ifdef BYTE_CODE_SAFE
406 int const_length
= XVECTOR (vector
)->size
;
409 int bytestr_length
= STRING_BYTES (XSTRING (bytestr
));
410 struct byte_stack stack
;
414 CHECK_STRING (bytestr
, 0);
415 if (!VECTORP (vector
))
416 vector
= wrong_type_argument (Qvectorp
, vector
);
417 CHECK_NUMBER (maxdepth
, 2);
419 stack
.byte_string
= bytestr
;
420 stack
.pc
= stack
.byte_string_start
= XSTRING (bytestr
)->data
;
421 stack
.constants
= vector
;
422 stack
.bottom
= (Lisp_Object
*) alloca (XFASTINT (maxdepth
)
423 * sizeof (Lisp_Object
));
424 top
= stack
.bottom
- 1;
426 stack
.next
= byte_stack_list
;
427 byte_stack_list
= &stack
;
429 #ifdef BYTE_CODE_SAFE
430 stacke
= stack
.bottom
- 1 + XFASTINT (maxdepth
);
435 #ifdef BYTE_CODE_SAFE
438 else if (top
< stack
.bottom
- 1)
442 #ifdef BYTE_CODE_METER
444 this_op
= op
= FETCH
;
445 METER_CODE (prev_op
, op
);
465 /* This seems to be the most frequently executed byte-code
466 among the Bvarref's, so avoid a goto here. */
476 v2
= XSYMBOL (v1
)->value
;
477 if (MISCP (v2
) || EQ (v2
, Qunbound
))
478 v2
= Fsymbol_value (v1
);
481 v2
= Fsymbol_value (v1
);
493 stack
.pc
= stack
.byte_string_start
+ op
;
507 BEFORE_POTENTIAL_GC ();
508 Fcar (wrong_type_argument (Qlistp
, v1
));
509 AFTER_POTENTIAL_GC ();
518 TOP
= EQ (v1
, TOP
) ? Qt
: Qnil
;
526 TOP
= Fmemq (TOP
, v1
);
540 BEFORE_POTENTIAL_GC ();
541 Fcdr (wrong_type_argument (Qlistp
, v1
));
542 AFTER_POTENTIAL_GC ();
564 Lisp_Object sym
, val
;
569 /* Inline the most common case. */
571 && !EQ (val
, Qunbound
)
572 && !MISCP (XSYMBOL (sym
)->value
)
573 /* I think this should either be checked in the byte
574 compiler, or there should be a flag indicating that
575 a symbol might be constant in Lisp_Symbol, instead
576 of checking this here over and over again. --gerd. */
579 && !(XSYMBOL (sym
)->name
->data
[0] == ':'
580 && EQ (XSYMBOL (sym
)->obarray
, initial_obarray
)
582 XSYMBOL (sym
)->value
= val
;
584 set_internal (sym
, val
, current_buffer
, 0);
596 /* ------------------ */
614 specbind (vectorp
[op
], POP
);
634 BEFORE_POTENTIAL_GC ();
636 #ifdef BYTE_CODE_METER
637 if (byte_metering_on
&& SYMBOLP (TOP
))
642 v2
= Fget (v1
, Qbyte_code_meter
);
644 && XINT (v2
) != ((1<<VALBITS
)-1))
646 XSETINT (v2
, XINT (v2
) + 1);
647 Fput (v1
, Qbyte_code_meter
, v2
);
651 TOP
= Ffuncall (op
+ 1, &TOP
);
652 AFTER_POTENTIAL_GC ();
672 BEFORE_POTENTIAL_GC ();
673 unbind_to (specpdl_ptr
- specpdl
- op
, Qnil
);
674 AFTER_POTENTIAL_GC ();
678 /* To unbind back to the beginning of this frame. Not used yet,
679 but will be needed for tail-recursion elimination. */
680 BEFORE_POTENTIAL_GC ();
681 unbind_to (count
, Qnil
);
682 AFTER_POTENTIAL_GC ();
688 op
= FETCH2
; /* pc = FETCH2 loses since FETCH2 contains pc++ */
690 stack
.pc
= stack
.byte_string_start
+ op
;
700 stack
.pc
= stack
.byte_string_start
+ op
;
704 case Bgotoifnilelsepop
:
711 stack
.pc
= stack
.byte_string_start
+ op
;
716 case Bgotoifnonnilelsepop
:
723 stack
.pc
= stack
.byte_string_start
+ op
;
731 stack
.pc
+= (int) *stack
.pc
- 127;
739 stack
.pc
+= (int) *stack
.pc
- 128;
749 stack
.pc
+= (int) *stack
.pc
- 128;
754 case BRgotoifnilelsepop
:
760 stack
.pc
+= op
- 128;
765 case BRgotoifnonnilelsepop
:
771 stack
.pc
+= op
- 128;
785 PUSH (vectorp
[FETCH2
]);
788 case Bsave_excursion
:
789 record_unwind_protect (save_excursion_restore
,
790 save_excursion_save ());
793 case Bsave_current_buffer
:
794 case Bsave_current_buffer_1
:
795 record_unwind_protect (set_buffer_if_live
, Fcurrent_buffer ());
798 case Bsave_window_excursion
:
799 BEFORE_POTENTIAL_GC ();
800 TOP
= Fsave_window_excursion (TOP
);
801 AFTER_POTENTIAL_GC ();
804 case Bsave_restriction
:
805 record_unwind_protect (save_restriction_restore
,
806 save_restriction_save ());
813 BEFORE_POTENTIAL_GC ();
814 TOP
= internal_catch (TOP
, Feval
, v1
);
815 AFTER_POTENTIAL_GC ();
819 case Bunwind_protect
:
820 record_unwind_protect (0, POP
);
821 (specpdl_ptr
- 1)->symbol
= Qnil
;
824 case Bcondition_case
:
828 v1
= Fcons (POP
, v1
);
829 BEFORE_POTENTIAL_GC ();
830 TOP
= Fcondition_case (Fcons (TOP
, v1
));
831 AFTER_POTENTIAL_GC ();
835 case Btemp_output_buffer_setup
:
836 BEFORE_POTENTIAL_GC ();
837 temp_output_buffer_setup (XSTRING (TOP
)->data
);
838 AFTER_POTENTIAL_GC ();
839 TOP
= Vstandard_output
;
842 case Btemp_output_buffer_show
:
846 BEFORE_POTENTIAL_GC ();
847 temp_output_buffer_show (TOP
);
849 /* pop binding of standard-output */
850 unbind_to (specpdl_ptr
- specpdl
- 1, Qnil
);
851 AFTER_POTENTIAL_GC ();
860 BEFORE_POTENTIAL_GC ();
861 CHECK_NUMBER (v2
, 0);
862 AFTER_POTENTIAL_GC ();
872 BEFORE_POTENTIAL_GC ();
873 v1
= wrong_type_argument (Qlistp
, v1
);
874 AFTER_POTENTIAL_GC ();
886 BEFORE_POTENTIAL_GC ();
887 Fcar (wrong_type_argument (Qlistp
, v1
));
888 AFTER_POTENTIAL_GC ();
894 TOP
= SYMBOLP (TOP
) ? Qt
: Qnil
;
898 TOP
= CONSP (TOP
) ? Qt
: Qnil
;
902 TOP
= STRINGP (TOP
) ? Qt
: Qnil
;
906 TOP
= CONSP (TOP
) || NILP (TOP
) ? Qt
: Qnil
;
910 TOP
= NILP (TOP
) ? Qt
: Qnil
;
917 TOP
= Fcons (TOP
, v1
);
922 TOP
= Fcons (TOP
, Qnil
);
929 TOP
= Fcons (TOP
, Fcons (v1
, Qnil
));
935 TOP
= Flist (3, &TOP
);
940 TOP
= Flist (4, &TOP
);
946 TOP
= Flist (op
, &TOP
);
957 TOP
= Faref (TOP
, v1
);
965 TOP
= Faset (TOP
, v1
, v2
);
970 TOP
= Fsymbol_value (TOP
);
973 case Bsymbol_function
:
974 TOP
= Fsymbol_function (TOP
);
981 TOP
= Fset (TOP
, v1
);
989 TOP
= Ffset (TOP
, v1
);
997 TOP
= Fget (TOP
, v1
);
1005 BEFORE_POTENTIAL_GC ();
1006 TOP
= Fsubstring (TOP
, v1
, v2
);
1007 AFTER_POTENTIAL_GC ();
1013 TOP
= Fconcat (2, &TOP
);
1018 TOP
= Fconcat (3, &TOP
);
1023 TOP
= Fconcat (4, &TOP
);
1029 TOP
= Fconcat (op
, &TOP
);
1038 XSETINT (v1
, XINT (v1
) - 1);
1052 XSETINT (v1
, XINT (v1
) + 1);
1064 BEFORE_POTENTIAL_GC ();
1065 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1
, 0);
1066 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2
, 0);
1067 AFTER_POTENTIAL_GC ();
1068 if (FLOATP (v1
) || FLOATP (v2
))
1072 f1
= (FLOATP (v1
) ? XFLOAT_DATA (v1
) : XINT (v1
));
1073 f2
= (FLOATP (v2
) ? XFLOAT_DATA (v2
) : XINT (v2
));
1074 TOP
= (f1
== f2
? Qt
: Qnil
);
1077 TOP
= (XINT (v1
) == XINT (v2
) ? Qt
: Qnil
);
1085 TOP
= Fgtr (TOP
, v1
);
1093 TOP
= Flss (TOP
, v1
);
1101 TOP
= Fleq (TOP
, v1
);
1109 TOP
= Fgeq (TOP
, v1
);
1115 TOP
= Fminus (2, &TOP
);
1124 XSETINT (v1
, - XINT (v1
));
1128 TOP
= Fminus (1, &TOP
);
1134 TOP
= Fplus (2, &TOP
);
1139 TOP
= Fmax (2, &TOP
);
1144 TOP
= Fmin (2, &TOP
);
1149 TOP
= Ftimes (2, &TOP
);
1154 TOP
= Fquo (2, &TOP
);
1161 TOP
= Frem (TOP
, v1
);
1168 XSETFASTINT (v1
, PT
);
1174 BEFORE_POTENTIAL_GC ();
1175 TOP
= Fgoto_char (TOP
);
1176 AFTER_POTENTIAL_GC ();
1180 BEFORE_POTENTIAL_GC ();
1181 TOP
= Finsert (1, &TOP
);
1182 AFTER_POTENTIAL_GC ();
1187 BEFORE_POTENTIAL_GC ();
1189 TOP
= Finsert (op
, &TOP
);
1190 AFTER_POTENTIAL_GC ();
1196 XSETFASTINT (v1
, ZV
);
1204 XSETFASTINT (v1
, BEGV
);
1210 TOP
= Fchar_after (TOP
);
1213 case Bfollowing_char
:
1216 v1
= Ffollowing_char ();
1221 case Bpreceding_char
:
1224 v1
= Fprevious_char ();
1229 case Bcurrent_column
:
1232 XSETFASTINT (v1
, current_column ());
1238 BEFORE_POTENTIAL_GC ();
1239 TOP
= Findent_to (TOP
, Qnil
);
1240 AFTER_POTENTIAL_GC ();
1259 case Bcurrent_buffer
:
1260 PUSH (Fcurrent_buffer ());
1264 BEFORE_POTENTIAL_GC ();
1265 TOP
= Fset_buffer (TOP
);
1266 AFTER_POTENTIAL_GC ();
1269 case Binteractive_p
:
1270 PUSH (Finteractive_p ());
1274 BEFORE_POTENTIAL_GC ();
1275 TOP
= Fforward_char (TOP
);
1276 AFTER_POTENTIAL_GC ();
1280 BEFORE_POTENTIAL_GC ();
1281 TOP
= Fforward_word (TOP
);
1282 AFTER_POTENTIAL_GC ();
1285 case Bskip_chars_forward
:
1289 BEFORE_POTENTIAL_GC ();
1290 TOP
= Fskip_chars_forward (TOP
, v1
);
1291 AFTER_POTENTIAL_GC ();
1295 case Bskip_chars_backward
:
1299 BEFORE_POTENTIAL_GC ();
1300 TOP
= Fskip_chars_backward (TOP
, v1
);
1301 AFTER_POTENTIAL_GC ();
1306 BEFORE_POTENTIAL_GC ();
1307 TOP
= Fforward_line (TOP
);
1308 AFTER_POTENTIAL_GC ();
1312 BEFORE_POTENTIAL_GC ();
1313 CHECK_NUMBER (TOP
, 0);
1314 AFTER_POTENTIAL_GC ();
1315 XSETFASTINT (TOP
, syntax_code_spec
[(int) SYNTAX (XINT (TOP
))]);
1318 case Bbuffer_substring
:
1322 BEFORE_POTENTIAL_GC ();
1323 TOP
= Fbuffer_substring (TOP
, v1
);
1324 AFTER_POTENTIAL_GC ();
1328 case Bdelete_region
:
1332 BEFORE_POTENTIAL_GC ();
1333 TOP
= Fdelete_region (TOP
, v1
);
1334 AFTER_POTENTIAL_GC ();
1338 case Bnarrow_to_region
:
1342 BEFORE_POTENTIAL_GC ();
1343 TOP
= Fnarrow_to_region (TOP
, v1
);
1344 AFTER_POTENTIAL_GC ();
1349 BEFORE_POTENTIAL_GC ();
1351 AFTER_POTENTIAL_GC ();
1355 BEFORE_POTENTIAL_GC ();
1356 TOP
= Fend_of_line (TOP
);
1357 AFTER_POTENTIAL_GC ();
1365 TOP
= Fset_marker (TOP
, v2
, v1
);
1369 case Bmatch_beginning
:
1370 TOP
= Fmatch_beginning (TOP
);
1374 TOP
= Fmatch_end (TOP
);
1378 TOP
= Fupcase (TOP
);
1382 TOP
= Fdowncase (TOP
);
1385 case Bstringeqlsign
:
1389 TOP
= Fstring_equal (TOP
, v1
);
1397 TOP
= Fstring_lessp (TOP
, v1
);
1405 TOP
= Fequal (TOP
, v1
);
1413 TOP
= Fnthcdr (TOP
, v1
);
1422 /* Exchange args and then do nth. */
1425 BEFORE_POTENTIAL_GC ();
1426 CHECK_NUMBER (v2
, 0);
1427 AFTER_POTENTIAL_GC ();
1434 else if (!NILP (v1
))
1437 BEFORE_POTENTIAL_GC ();
1438 v1
= wrong_type_argument (Qlistp
, v1
);
1439 AFTER_POTENTIAL_GC ();
1451 BEFORE_POTENTIAL_GC ();
1452 Fcar (wrong_type_argument (Qlistp
, v1
));
1453 AFTER_POTENTIAL_GC ();
1459 TOP
= Felt (TOP
, v1
);
1468 TOP
= Fmember (TOP
, v1
);
1476 TOP
= Fassq (TOP
, v1
);
1481 TOP
= Fnreverse (TOP
);
1488 TOP
= Fsetcar (TOP
, v1
);
1496 TOP
= Fsetcdr (TOP
, v1
);
1524 TOP
= Fnconc (2, &TOP
);
1528 TOP
= (NUMBERP (TOP
) ? Qt
: Qnil
);
1532 TOP
= INTEGERP (TOP
) ? Qt
: Qnil
;
1535 #ifdef BYTE_CODE_SAFE
1537 BEFORE_POTENTIAL_GC ();
1538 error ("set-mark is an obsolete bytecode");
1539 AFTER_POTENTIAL_GC ();
1542 BEFORE_POTENTIAL_GC ();
1543 error ("scan-buffer is an obsolete bytecode");
1544 AFTER_POTENTIAL_GC ();
1553 #ifdef BYTE_CODE_SAFE
1558 if ((op
-= Bconstant
) >= const_length
)
1564 PUSH (vectorp
[op
- Bconstant
]);
1571 byte_stack_list
= byte_stack_list
->next
;
1573 /* Binds and unbinds are supposed to be compiled balanced. */
1574 if (specpdl_ptr
- specpdl
!= count
)
1575 #ifdef BYTE_CODE_SAFE
1576 error ("binding stack not balanced (serious byte compiler bug)");
1587 Qbytecode
= intern ("byte-code");
1588 staticpro (&Qbytecode
);
1590 defsubr (&Sbyte_code
);
1592 #ifdef BYTE_CODE_METER
1594 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter
,
1595 "A vector of vectors which holds a histogram of byte-code usage.\n\
1596 (aref (aref byte-code-meter 0) CODE) indicates how many times the byte\n\
1597 opcode CODE has been executed.\n\
1598 (aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,\n\
1599 indicates how many times the byte opcodes CODE1 and CODE2 have been\n\
1600 executed in succession.");
1601 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on
,
1602 "If non-nil, keep profiling information on byte code usage.\n\
1603 The variable byte-code-meter indicates how often each byte opcode is used.\n\
1604 If a symbol has a property named `byte-code-meter' whose value is an\n\
1605 integer, it is incremented each time that symbol's function is called.");
1607 byte_metering_on
= 0;
1608 Vbyte_code_meter
= Fmake_vector (make_number (256), make_number (0));
1609 Qbyte_code_meter
= intern ("byte-code-meter");
1610 staticpro (&Qbyte_code_meter
);
1614 XVECTOR (Vbyte_code_meter
)->contents
[i
] =
1615 Fmake_vector (make_number (256), make_number (0));