0
|
1 /* Execution of byte code produced by bytecomp.el.
|
|
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; 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. */
|
|
20
|
|
21 /* Synched up with: Mule 2.0, FSF 19.30. */
|
|
22
|
|
23 /* Authorship:
|
|
24
|
|
25 FSF: long ago.
|
|
26
|
|
27 hacked on by jwz@lucid.com 17-jun-91
|
|
28 o added a compile-time switch to turn on simple sanity checking;
|
|
29 o put back the obsolete byte-codes for error-detection;
|
|
30 o added a new instruction, unbind_all, which I will use for
|
|
31 tail-recursion elimination;
|
|
32 o made temp_output_buffer_show be called with the right number
|
|
33 of args;
|
|
34 o made the new bytecodes be called with args in the right order;
|
|
35 o added metering support.
|
|
36
|
|
37 by Hallvard:
|
|
38 o added relative jump instructions;
|
|
39 o all conditionals now only do QUIT if they jump.
|
|
40 */
|
|
41
|
|
42 #include <config.h>
|
|
43 #include "lisp.h"
|
|
44 #include "buffer.h"
|
|
45 #include "syntax.h"
|
|
46
|
|
47 /*
|
|
48 * define BYTE_CODE_SAFE to enable some minor sanity checking (useful for
|
|
49 * debugging the byte compiler...) Somewhat surprisingly, defining this
|
|
50 * makes Fbyte_code about 8% slower.
|
|
51 *
|
|
52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
|
|
53 */
|
|
54 /* #define BYTE_CODE_SAFE */
|
|
55 /* #define BYTE_CODE_METER */
|
|
56
|
|
57
|
|
58 #ifdef BYTE_CODE_METER
|
|
59
|
|
60 Lisp_Object Vbyte_code_meter, Qbyte_code_meter;
|
|
61 int byte_metering_on;
|
|
62
|
|
63 #define METER_2(code1, code2) \
|
|
64 XINT (XVECTOR (vector_data (XVECTOR (Vbyte_code_meter))[(code1)]) \
|
|
65 ->contents[(code2)])
|
|
66
|
|
67 #define METER_1(code) METER_2 (0, (code))
|
|
68
|
|
69 #define METER_CODE(last_code, this_code) \
|
|
70 { \
|
|
71 if (byte_metering_on) \
|
|
72 { \
|
|
73 if (METER_1 (this_code) != ((1<<VALBITS)-1)) \
|
|
74 METER_1 (this_code)++; \
|
|
75 if (last_code \
|
|
76 && METER_2 (last_code, this_code) != ((1<<VALBITS)-1))\
|
|
77 METER_2 (last_code, this_code)++; \
|
|
78 } \
|
|
79 }
|
|
80
|
|
81 #endif /* no BYTE_CODE_METER */
|
|
82
|
|
83
|
|
84 Lisp_Object Qbyte_code;
|
|
85
|
|
86 /* Byte codes: */
|
|
87
|
|
88 #define Bvarref 010
|
|
89 #define Bvarset 020
|
|
90 #define Bvarbind 030
|
|
91 #define Bcall 040
|
|
92 #define Bunbind 050
|
|
93
|
|
94 #define Bnth 070
|
|
95 #define Bsymbolp 071
|
|
96 #define Bconsp 072
|
|
97 #define Bstringp 073
|
|
98 #define Blistp 074
|
|
99 #define Beq 075
|
|
100 #define Bmemq 076
|
|
101 #define Bnot 077
|
|
102 #define Bcar 0100
|
|
103 #define Bcdr 0101
|
|
104 #define Bcons 0102
|
|
105 #define Blist1 0103
|
|
106 #define Blist2 0104
|
|
107 #define Blist3 0105
|
|
108 #define Blist4 0106
|
|
109 #define Blength 0107
|
|
110 #define Baref 0110
|
|
111 #define Baset 0111
|
|
112 #define Bsymbol_value 0112
|
|
113 #define Bsymbol_function 0113
|
|
114 #define Bset 0114
|
|
115 #define Bfset 0115
|
|
116 #define Bget 0116
|
|
117 #define Bsubstring 0117
|
|
118 #define Bconcat2 0120
|
|
119 #define Bconcat3 0121
|
|
120 #define Bconcat4 0122
|
|
121 #define Bsub1 0123
|
|
122 #define Badd1 0124
|
|
123 #define Beqlsign 0125
|
|
124 #define Bgtr 0126
|
|
125 #define Blss 0127
|
|
126 #define Bleq 0130
|
|
127 #define Bgeq 0131
|
|
128 #define Bdiff 0132
|
|
129 #define Bnegate 0133
|
|
130 #define Bplus 0134
|
|
131 #define Bmax 0135
|
|
132 #define Bmin 0136
|
|
133 #define Bmult 0137
|
|
134
|
|
135 #define Bpoint 0140
|
|
136 #define Bmark 0141 /* no longer generated as of v18 */
|
|
137 #define Bgoto_char 0142
|
|
138 #define Binsert 0143
|
|
139 #define Bpoint_max 0144
|
|
140 #define Bpoint_min 0145
|
|
141 #define Bchar_after 0146
|
|
142 #define Bfollowing_char 0147
|
|
143 #define Bpreceding_char 0150
|
|
144 #define Bcurrent_column 0151
|
|
145 #define Bindent_to 0152
|
|
146 #define Bscan_buffer 0153 /* No longer generated as of v18 */
|
|
147 #define Beolp 0154
|
|
148 #define Beobp 0155
|
|
149 #define Bbolp 0156
|
|
150 #define Bbobp 0157
|
|
151 #define Bcurrent_buffer 0160
|
|
152 #define Bset_buffer 0161
|
|
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 */
|
|
156
|
|
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
|
|
166 #define Bwiden 0176
|
|
167 #define Bend_of_line 0177
|
|
168
|
|
169 #define Bconstant2 0201
|
|
170 #define Bgoto 0202
|
|
171 #define Bgotoifnil 0203
|
|
172 #define Bgotoifnonnil 0204
|
|
173 #define Bgotoifnilelsepop 0205
|
|
174 #define Bgotoifnonnilelsepop 0206
|
|
175 #define Breturn 0207
|
|
176 #define Bdiscard 0210
|
|
177 #define Bdup 0211
|
|
178
|
|
179 #define Bsave_excursion 0212
|
|
180 #define Bsave_window_excursion 0213
|
|
181 #define Bsave_restriction 0214
|
|
182 #define Bcatch 0215
|
|
183
|
|
184 #define Bunwind_protect 0216
|
|
185 #define Bcondition_case 0217
|
|
186 #define Btemp_output_buffer_setup 0220
|
|
187 #define Btemp_output_buffer_show 0221
|
|
188
|
|
189 #define Bunbind_all 0222
|
|
190
|
|
191 #define Bset_marker 0223
|
|
192 #define Bmatch_beginning 0224
|
|
193 #define Bmatch_end 0225
|
|
194 #define Bupcase 0226
|
|
195 #define Bdowncase 0227
|
|
196
|
|
197 #define Bstringeqlsign 0230
|
|
198 #define Bstringlss 0231
|
|
199 #define Bequal 0232
|
|
200 #define Bnthcdr 0233
|
|
201 #define Belt 0234
|
|
202 #define Bmember 0235
|
|
203 #define Bassq 0236
|
|
204 #define Bnreverse 0237
|
|
205 #define Bsetcar 0240
|
|
206 #define Bsetcdr 0241
|
|
207 #define Bcar_safe 0242
|
|
208 #define Bcdr_safe 0243
|
|
209 #define Bnconc 0244
|
|
210 #define Bquo 0245
|
|
211 #define Brem 0246
|
|
212 #define Bnumberp 0247
|
|
213 #define Bintegerp 0250
|
|
214
|
|
215 #define BRgoto 0252
|
|
216 #define BRgotoifnil 0253
|
|
217 #define BRgotoifnonnil 0254
|
|
218 #define BRgotoifnilelsepop 0255
|
|
219 #define BRgotoifnonnilelsepop 0256
|
|
220
|
|
221 #define BlistN 0257
|
|
222 #define BconcatN 0260
|
|
223 #define BinsertN 0261
|
|
224
|
|
225 #define Bconstant 0300
|
|
226 #define CONSTANTLIM 0100
|
|
227
|
|
228 /* Fetch the next byte from the bytecode stream */
|
|
229
|
|
230 #ifdef V20_SLOW_WAY
|
|
231 #define FETCH (massaged_code[pc++])
|
|
232 #else /* !V20_SLOW_WAY */
|
|
233 #define FETCH *pc++
|
|
234 #endif /* !V20_SLOW_WAY */
|
|
235
|
|
236 /* Fetch two bytes from the bytecode stream
|
|
237 and make a 16-bit number out of them */
|
|
238
|
|
239 #define FETCH2 (op = FETCH, op + (FETCH << 8))
|
|
240
|
|
241 /* Push x onto the execution stack. */
|
|
242
|
|
243 /* This used to be #define PUSH(x) (*++stackp = (x))
|
|
244 This oddity is necessary because Alliant can't be bothered to
|
|
245 compile the preincrement operator properly, as of 4/91. -JimB */
|
|
246 #define PUSH(x) (stackp++, *stackp = (x))
|
|
247
|
|
248 /* Pop a value off the execution stack. */
|
|
249
|
|
250 #define POP (*stackp--)
|
|
251
|
|
252 /* Discard n values from the execution stack. */
|
|
253
|
|
254 #define DISCARD(n) (stackp -= (n))
|
|
255
|
|
256 /* Get the value which is at the top of the execution stack,
|
|
257 but don't pop it. */
|
|
258
|
|
259 #define TOP (*stackp)
|
|
260
|
20
|
261 DEFUN ("byte-code", Fbyte_code, 3, 3, 0, /*
|
0
|
262 Function used internally in byte-compiled code.
|
|
263 The first argument is a string of byte code; the second, a vector of constants;
|
|
264 the third, the maximum stack depth used in this function.
|
|
265 If the third argument is incorrect, Emacs may crash.
|
20
|
266 */
|
|
267 (bytestr, vector, maxdepth))
|
0
|
268 {
|
|
269 /* This function can GC */
|
|
270 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
271 int speccount = specpdl_depth ();
|
|
272 #ifdef BYTE_CODE_METER
|
|
273 int this_op = 0;
|
|
274 int prev_op;
|
|
275 #endif
|
|
276 REGISTER int op;
|
|
277 #ifdef V20_SLOW_WAY
|
|
278 int pc;
|
|
279 #else /* !V20_SLOW_WAY */
|
|
280 REGISTER Bufbyte *pc;
|
|
281 #endif /* !V20_SLOW_WAY */
|
|
282 Lisp_Object *stack;
|
|
283 REGISTER Lisp_Object *stackp;
|
|
284 Lisp_Object *stacke;
|
|
285 REGISTER Lisp_Object v1, v2;
|
|
286 REGISTER Lisp_Object *vectorp = vector_data (XVECTOR (vector));
|
|
287 #ifdef BYTE_CODE_SAFE
|
|
288 REGISTER int const_length = vector_length (XVECTOR (vector));
|
|
289 #endif
|
|
290 #ifdef V20_SLOW_WAY
|
|
291 REGISTER Emchar *massaged_code;
|
|
292 int massaged_code_len;
|
|
293 #else /* !V20_SLOW_WAY */
|
|
294 /* Cached address of beginning of string, valid if BYTESTR data not
|
|
295 relocated. */
|
|
296 REGISTER Bufbyte *strbeg;
|
|
297 REGISTER struct Lisp_String *detagged_string;
|
|
298 #endif /* !V20_SLOW_WAY */
|
|
299
|
|
300 CHECK_STRING (bytestr);
|
|
301 if (!VECTORP (vector))
|
|
302 vector = wrong_type_argument (Qvectorp, vector);
|
|
303 CHECK_NATNUM (maxdepth);
|
|
304
|
|
305 stackp = (Lisp_Object *) alloca (XINT (maxdepth) * sizeof (Lisp_Object));
|
|
306 memset (stackp, 0, XINT (maxdepth) * sizeof (Lisp_Object));
|
|
307 GCPRO3 (bytestr, vector, *stackp);
|
|
308 gcpro3.nvars = XINT (maxdepth);
|
|
309
|
|
310 --stackp;
|
|
311 stack = stackp;
|
|
312 stacke = stackp + XINT (maxdepth);
|
|
313
|
|
314 #ifdef V20_SLOW_WAY
|
|
315 /* Initialize the pc-register and convert the string into a fixed-width
|
|
316 format for easier processing. */
|
|
317 massaged_code =
|
|
318 (Emchar *) alloca (sizeof (Emchar) *
|
|
319 (1 + string_char_length (XSTRING (bytestr))));
|
|
320 massaged_code_len =
|
16
|
321 convert_bufbyte_string_into_emchar_string (XSTRING_DATA (bytestr),
|
|
322 XSTRING_LENGTH (bytestr),
|
0
|
323 massaged_code);
|
|
324 massaged_code[massaged_code_len] = 0;
|
|
325 pc = 0;
|
|
326 #else /* !V20_SLOW_WAY */
|
|
327 /* Initialize the pc-pointer by fetching from the string. */
|
|
328 detagged_string = XSTRING (bytestr);
|
|
329 pc = string_data (detagged_string);
|
|
330 strbeg = pc;
|
|
331 #endif /* !V20_SLOW_WAY */
|
|
332
|
|
333 while (1)
|
|
334 {
|
|
335 #ifdef BYTE_CODE_SAFE
|
|
336 if (stackp > stacke)
|
|
337 error ("Byte code stack overflow (byte compiler bug), pc %d, depth %d",
|
|
338 #ifdef V20_SLOW_WAY
|
|
339 pc, stacke - stackp);
|
|
340 #else /* !V20_SLOW_WAY */
|
|
341 pc - string_data (detagged_string), stacke - stackp);
|
|
342 #endif /* !V20_SLOW_WAY */
|
|
343 if (stackp < stack)
|
|
344 error ("Byte code stack underflow (byte compiler bug), pc %d",
|
|
345 #ifdef V20_SLOW_WAY
|
|
346 pc);
|
|
347 #else /* !V20_SLOW_WAY */
|
|
348 pc - string_data (detagged_string));
|
|
349 #endif /* !V20_SLOW_WAY */
|
|
350 #endif
|
|
351
|
|
352 #ifndef V20_SLOW_WAY
|
|
353 if (strbeg != string_data (detagged_string))
|
|
354 {
|
|
355 pc = pc - strbeg + string_data (detagged_string);
|
|
356 strbeg = string_data (detagged_string);
|
|
357 }
|
|
358 #endif /* !V20_SLOW_WAY */
|
|
359
|
|
360 #ifdef BYTE_CODE_METER
|
|
361 prev_op = this_op;
|
|
362 this_op = op = FETCH;
|
|
363 METER_CODE (prev_op, op);
|
|
364 switch (op)
|
|
365 #else
|
|
366 switch (op = FETCH)
|
|
367 #endif
|
|
368 {
|
|
369 case Bvarref+6:
|
|
370 op = FETCH;
|
|
371 goto varref;
|
|
372
|
|
373 case Bvarref+7:
|
|
374 op = FETCH2;
|
|
375 goto varref;
|
|
376
|
|
377 case Bvarref: case Bvarref+1: case Bvarref+2: case Bvarref+3:
|
|
378 case Bvarref+4: case Bvarref+5:
|
|
379 op = op - Bvarref;
|
|
380 varref:
|
|
381 v1 = vectorp[op];
|
|
382 if (!SYMBOLP (v1))
|
|
383 v2 = Fsymbol_value (v1);
|
|
384 else
|
|
385 {
|
|
386 v2 = XSYMBOL (v1)->value;
|
|
387 if (SYMBOL_VALUE_MAGIC_P (v2))
|
|
388 v2 = Fsymbol_value (v1);
|
|
389 }
|
|
390 PUSH (v2);
|
|
391 break;
|
|
392
|
|
393 case Bvarset+6:
|
|
394 op = FETCH;
|
|
395 goto varset;
|
|
396
|
|
397 case Bvarset+7:
|
|
398 op = FETCH2;
|
|
399 goto varset;
|
|
400
|
|
401 case Bvarset: case Bvarset+1: case Bvarset+2: case Bvarset+3:
|
|
402 case Bvarset+4: case Bvarset+5:
|
|
403 op -= Bvarset;
|
|
404 varset:
|
|
405 Fset (vectorp[op], POP);
|
|
406 break;
|
|
407
|
|
408 case Bvarbind+6:
|
|
409 op = FETCH;
|
|
410 goto varbind;
|
|
411
|
|
412 case Bvarbind+7:
|
|
413 op = FETCH2;
|
|
414 goto varbind;
|
|
415
|
|
416 case Bvarbind: case Bvarbind+1: case Bvarbind+2: case Bvarbind+3:
|
|
417 case Bvarbind+4: case Bvarbind+5:
|
|
418 op -= Bvarbind;
|
|
419 varbind:
|
|
420 specbind (vectorp[op], POP);
|
|
421 break;
|
|
422
|
|
423 case Bcall+6:
|
|
424 op = FETCH;
|
|
425 goto docall;
|
|
426
|
|
427 case Bcall+7:
|
|
428 op = FETCH2;
|
|
429 goto docall;
|
|
430
|
|
431 case Bcall: case Bcall+1: case Bcall+2: case Bcall+3:
|
|
432 case Bcall+4: case Bcall+5:
|
|
433 op -= Bcall;
|
|
434 docall:
|
|
435 DISCARD (op);
|
|
436 #ifdef BYTE_CODE_METER
|
|
437 if (byte_metering_on && SYMBOLP (TOP))
|
|
438 {
|
|
439 v1 = TOP;
|
|
440 v2 = Fget (v1, Qbyte_code_meter, Qnil);
|
|
441 if (INTP (v2)
|
|
442 && XINT (v2) != ((1<<VALBITS)-1))
|
|
443 {
|
|
444 XSETINT (v2, XINT (v2) + 1);
|
|
445 Fput (v1, Qbyte_code_meter, v2);
|
|
446 }
|
|
447 }
|
16
|
448 #endif /* BYTE_CODE_METER */
|
0
|
449 TOP = Ffuncall (op + 1, &TOP);
|
|
450 break;
|
|
451
|
|
452 case Bunbind+6:
|
|
453 op = FETCH;
|
|
454 goto dounbind;
|
|
455
|
|
456 case Bunbind+7:
|
|
457 op = FETCH2;
|
|
458 goto dounbind;
|
|
459
|
|
460 case Bunbind: case Bunbind+1: case Bunbind+2: case Bunbind+3:
|
|
461 case Bunbind+4: case Bunbind+5:
|
|
462 op -= Bunbind;
|
|
463 dounbind:
|
|
464 unbind_to (specpdl_depth () - op, Qnil);
|
|
465 break;
|
|
466
|
|
467 case Bunbind_all:
|
|
468 /* To unbind back to the beginning of this frame. Not used yet,
|
|
469 but will be needed for tail-recursion elimination. */
|
|
470 unbind_to (speccount, Qnil);
|
|
471 break;
|
|
472
|
|
473 case Bgoto:
|
|
474 QUIT;
|
|
475 op = FETCH2; /* pc = FETCH2 loses since FETCH2 contains pc++ */
|
|
476 #ifdef V20_SLOW_WAY
|
|
477 pc = op;
|
|
478 #else /* !V20_SLOW_WAY */
|
|
479 pc = string_data (detagged_string) + op;
|
|
480 #endif /* !V20_SLOW_WAY */
|
|
481 break;
|
|
482
|
|
483 case Bgotoifnil:
|
|
484 op = FETCH2;
|
|
485 if (NILP (POP))
|
|
486 {
|
|
487 QUIT;
|
|
488 #ifdef V20_SLOW_WAY
|
|
489 pc = op;
|
|
490 #else /* !V20_SLOW_WAY */
|
|
491 pc = string_data (detagged_string) + op;
|
|
492 #endif /* !V20_SLOW_WAY */
|
|
493 }
|
|
494 break;
|
|
495
|
|
496 case Bgotoifnonnil:
|
|
497 op = FETCH2;
|
|
498 if (!NILP (POP))
|
|
499 {
|
|
500 QUIT;
|
|
501 #ifdef V20_SLOW_WAY
|
|
502 pc = op;
|
|
503 #else /* !V20_SLOW_WAY */
|
|
504 pc = string_data (detagged_string) + op;
|
|
505 #endif /* !V20_SLOW_WAY */
|
|
506 }
|
|
507 break;
|
|
508
|
|
509 case Bgotoifnilelsepop:
|
|
510 op = FETCH2;
|
|
511 if (NILP (TOP))
|
|
512 {
|
|
513 QUIT;
|
|
514 #ifdef V20_SLOW_WAY
|
|
515 pc = op;
|
|
516 #else /* !V20_SLOW_WAY */
|
|
517 pc = string_data (detagged_string) + op;
|
|
518 #endif /* !V20_SLOW_WAY */
|
|
519 }
|
|
520 else DISCARD (1);
|
|
521 break;
|
|
522
|
|
523 case Bgotoifnonnilelsepop:
|
|
524 op = FETCH2;
|
|
525 if (!NILP (TOP))
|
|
526 {
|
|
527 QUIT;
|
|
528 #ifdef V20_SLOW_WAY
|
|
529 pc = op;
|
|
530 #else /* !V20_SLOW_WAY */
|
|
531 pc = string_data (detagged_string) + op;
|
|
532 #endif /* !V20_SLOW_WAY */
|
|
533 }
|
|
534 else DISCARD (1);
|
|
535 break;
|
|
536
|
|
537 case BRgoto:
|
|
538 QUIT;
|
|
539 #ifdef V20_SLOW_WAY
|
|
540 pc += massaged_code[pc] - 127;
|
|
541 #else /* !V20_SLOW_WAY */
|
|
542 /* pc += *pc - 127; */
|
|
543 pc = (unsigned char *) ((unsigned long) pc + *pc - 127);
|
|
544 #endif /* !V20_SLOW_WAY */
|
|
545 break;
|
|
546
|
|
547 case BRgotoifnil:
|
|
548 if (NILP (POP))
|
|
549 {
|
|
550 QUIT;
|
|
551 #ifdef V20_SLOW_WAY
|
|
552 pc += massaged_code[pc] - 128;
|
|
553 #else /* !V20_SLOW_WAY */
|
|
554 /* pc += *pc - 128; */
|
|
555 pc = (unsigned char *) ((unsigned long) pc + *pc - 128);
|
|
556 #endif /* !V20_SLOW_WAY */
|
|
557 }
|
|
558 pc++;
|
|
559 break;
|
|
560
|
|
561 case BRgotoifnonnil:
|
|
562 if (!NILP (POP))
|
|
563 {
|
|
564 QUIT;
|
|
565 #ifdef V20_SLOW_WAY
|
|
566 pc += massaged_code[pc] - 128;
|
|
567 #else /* !V20_SLOW_WAY */
|
|
568 /* pc += *pc - 128; */
|
|
569 pc = (unsigned char *) ((unsigned long) pc + *pc - 128);
|
|
570 #endif /* !V20_SLOW_WAY */
|
|
571 }
|
|
572 pc++;
|
|
573 break;
|
|
574
|
|
575 case BRgotoifnilelsepop:
|
|
576 op = FETCH;
|
|
577 if (NILP (TOP))
|
|
578 {
|
|
579 QUIT;
|
|
580 #ifdef V20_SLOW_WAY
|
|
581 pc += op - 128;
|
|
582 #else /* !V20_SLOW_WAY */
|
|
583 /* pc += op - 128; */
|
|
584 pc = (unsigned char *) ((unsigned long) pc + op - 128);
|
|
585 #endif /* !V20_SLOW_WAY */
|
|
586 }
|
|
587 else DISCARD (1);
|
|
588 break;
|
|
589
|
|
590 case BRgotoifnonnilelsepop:
|
|
591 op = FETCH;
|
|
592 if (!NILP (TOP))
|
|
593 {
|
|
594 QUIT;
|
|
595 #ifdef V20_SLOW_WAY
|
|
596 pc += op - 128;
|
|
597 #else /* !V20_SLOW_WAY */
|
|
598 /* pc += op - 128; */
|
|
599 pc = (unsigned char *) ((unsigned long) pc + op - 128);
|
|
600 #endif /* !V20_SLOW_WAY */
|
|
601 }
|
|
602 else DISCARD (1);
|
|
603 break;
|
|
604
|
|
605 case Breturn:
|
|
606 v1 = POP;
|
|
607 goto exit;
|
|
608
|
|
609 case Bdiscard:
|
|
610 DISCARD (1);
|
|
611 break;
|
|
612
|
|
613 case Bdup:
|
|
614 v1 = TOP;
|
|
615 PUSH (v1);
|
|
616 break;
|
|
617
|
|
618 case Bconstant2:
|
|
619 PUSH (vectorp[FETCH2]);
|
|
620 break;
|
|
621
|
|
622 case Bsave_excursion:
|
|
623 record_unwind_protect (save_excursion_restore,
|
|
624 save_excursion_save ());
|
|
625 break;
|
|
626
|
|
627 case Bsave_window_excursion:
|
|
628 {
|
|
629 int count = specpdl_depth ();
|
|
630 record_unwind_protect (save_window_excursion_unwind,
|
|
631 Fcurrent_window_configuration (Qnil));
|
|
632 TOP = Fprogn (TOP);
|
|
633 unbind_to (count, Qnil);
|
|
634 break;
|
|
635 }
|
|
636
|
|
637 case Bsave_restriction:
|
|
638 record_unwind_protect (save_restriction_restore,
|
|
639 save_restriction_save ());
|
|
640 break;
|
|
641
|
|
642 case Bcatch:
|
|
643 v1 = POP;
|
|
644 TOP = internal_catch (TOP, Feval, v1, 0);
|
|
645 break;
|
|
646
|
|
647 case Bunwind_protect:
|
|
648 record_unwind_protect (Fprogn, POP);
|
|
649 break;
|
|
650
|
|
651 case Bcondition_case:
|
|
652 v1 = POP; /* handlers */
|
|
653 v2 = POP; /* bodyform */
|
|
654 TOP = Fcondition_case_3 (v2, TOP, v1);
|
|
655 break;
|
|
656
|
|
657 case Btemp_output_buffer_setup:
|
16
|
658 temp_output_buffer_setup ((char *) XSTRING_DATA (TOP));
|
0
|
659 TOP = Vstandard_output;
|
|
660 break;
|
|
661
|
|
662 case Btemp_output_buffer_show:
|
|
663 v1 = POP;
|
|
664 temp_output_buffer_show (TOP, Qnil);
|
|
665 TOP = v1;
|
|
666 /* GAG ME!! */
|
|
667 /* pop binding of standard-output */
|
|
668 unbind_to (specpdl_depth() - 1, Qnil);
|
|
669 break;
|
|
670
|
|
671 case Bnth:
|
|
672 v1 = POP;
|
|
673 v2 = TOP;
|
|
674 /* nth_entry: */
|
|
675 CHECK_INT (v2);
|
|
676 op = XINT (v2);
|
|
677 while (--op >= 0)
|
|
678 {
|
|
679 if (CONSP (v1))
|
|
680 v1 = XCDR (v1);
|
|
681 else if (!NILP (v1))
|
|
682 {
|
|
683 v1 = wrong_type_argument (Qlistp, v1);
|
|
684 op++;
|
|
685 }
|
|
686 QUIT;
|
|
687 }
|
|
688 goto docar;
|
|
689
|
|
690 case Bsymbolp:
|
|
691 TOP = ((SYMBOLP (TOP)) ? Qt : Qnil);
|
|
692 break;
|
|
693
|
|
694 case Bconsp:
|
|
695 TOP = ((CONSP (TOP)) ? Qt : Qnil);
|
|
696 break;
|
|
697
|
|
698 case Bstringp:
|
|
699 TOP = ((STRINGP (TOP)) ? Qt : Qnil);
|
|
700 break;
|
|
701
|
|
702 case Blistp:
|
|
703 TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
|
|
704 break;
|
|
705
|
|
706 case Beq:
|
|
707 v1 = POP;
|
|
708 TOP = ((HACKEQ_UNSAFE (v1, TOP)) ? Qt : Qnil);
|
|
709 break;
|
|
710
|
|
711 case Bmemq:
|
|
712 v1 = POP;
|
|
713 TOP = Fmemq (TOP, v1);
|
|
714 break;
|
|
715
|
|
716 case Bnot:
|
|
717 TOP = NILP (TOP) ? Qt : Qnil;
|
|
718 break;
|
|
719
|
|
720 case Bcar:
|
|
721 v1 = TOP;
|
|
722 docar:
|
|
723 if (CONSP (v1)) TOP = XCAR (v1);
|
|
724 else if (NILP (v1)) TOP = Qnil;
|
|
725 else Fcar (wrong_type_argument (Qlistp, v1));
|
|
726 break;
|
|
727
|
|
728 case Bcdr:
|
|
729 v1 = TOP;
|
|
730 if (CONSP (v1)) TOP = XCDR (v1);
|
|
731 else if (NILP (v1)) TOP = Qnil;
|
|
732 else Fcdr (wrong_type_argument (Qlistp, v1));
|
|
733 break;
|
|
734
|
|
735 case Bcons:
|
|
736 v1 = POP;
|
|
737 TOP = Fcons (TOP, v1);
|
|
738 break;
|
|
739
|
|
740 case Blist1:
|
|
741 TOP = Fcons (TOP, Qnil);
|
|
742 break;
|
|
743
|
|
744 case Blist2:
|
|
745 v1 = POP;
|
|
746 TOP = Fcons (TOP, Fcons (v1, Qnil));
|
|
747 break;
|
|
748
|
|
749 case Blist3:
|
|
750 DISCARD (2);
|
|
751 TOP = Flist (3, &TOP);
|
|
752 break;
|
|
753
|
|
754 case Blist4:
|
|
755 DISCARD (3);
|
|
756 TOP = Flist (4, &TOP);
|
|
757 break;
|
|
758
|
|
759 case BlistN:
|
|
760 op = FETCH;
|
|
761 DISCARD (op - 1);
|
|
762 TOP = Flist (op, &TOP);
|
|
763 break;
|
|
764
|
|
765 case Blength:
|
|
766 TOP = Flength (TOP);
|
|
767 break;
|
|
768
|
|
769 case Baref:
|
|
770 v1 = POP;
|
|
771 TOP = Faref (TOP, v1);
|
|
772 break;
|
|
773
|
|
774 case Baset:
|
|
775 v2 = POP; v1 = POP;
|
|
776 TOP = Faset (TOP, v1, v2);
|
|
777 break;
|
|
778
|
|
779 case Bsymbol_value:
|
|
780 TOP = Fsymbol_value (TOP);
|
|
781 break;
|
|
782
|
|
783 case Bsymbol_function:
|
|
784 TOP = Fsymbol_function (TOP);
|
|
785 break;
|
|
786
|
|
787 case Bset:
|
|
788 v1 = POP;
|
|
789 TOP = Fset (TOP, v1);
|
|
790 break;
|
|
791
|
|
792 case Bfset:
|
|
793 v1 = POP;
|
|
794 TOP = Ffset (TOP, v1);
|
|
795 break;
|
|
796
|
|
797 case Bget:
|
|
798 v1 = POP;
|
|
799 TOP = Fget (TOP, v1, Qnil);
|
|
800 break;
|
|
801
|
|
802 case Bsubstring:
|
|
803 v2 = POP; v1 = POP;
|
|
804 TOP = Fsubstring (TOP, v1, v2);
|
|
805 break;
|
|
806
|
|
807 case Bconcat2:
|
|
808 DISCARD (1);
|
|
809 TOP = Fconcat (2, &TOP);
|
|
810 break;
|
|
811
|
|
812 case Bconcat3:
|
|
813 DISCARD (2);
|
|
814 TOP = Fconcat (3, &TOP);
|
|
815 break;
|
|
816
|
|
817 case Bconcat4:
|
|
818 DISCARD (3);
|
|
819 TOP = Fconcat (4, &TOP);
|
|
820 break;
|
|
821
|
|
822 case BconcatN:
|
|
823 op = FETCH;
|
|
824 DISCARD (op - 1);
|
|
825 TOP = Fconcat (op, &TOP);
|
|
826 break;
|
|
827
|
|
828 case Bsub1:
|
|
829 v1 = TOP;
|
|
830 if (INTP (v1))
|
|
831 {
|
|
832 XSETINT (v1, XINT (v1) - 1);
|
|
833 TOP = v1;
|
|
834 }
|
|
835 else
|
|
836 TOP = Fsub1 (v1);
|
|
837 break;
|
|
838
|
|
839 case Badd1:
|
|
840 v1 = TOP;
|
|
841 if (INTP (v1))
|
|
842 {
|
|
843 XSETINT (v1, XINT (v1) + 1);
|
|
844 TOP = v1;
|
|
845 }
|
|
846 else
|
|
847 TOP = Fadd1 (v1);
|
|
848 break;
|
|
849
|
|
850 case Beqlsign:
|
|
851 v2 = POP; v1 = TOP;
|
|
852 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (v1);
|
|
853 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (v2);
|
|
854 #ifdef LISP_FLOAT_TYPE
|
|
855 if (FLOATP (v1) || FLOATP (v2))
|
|
856 {
|
|
857 double f1, f2;
|
|
858
|
|
859 f1 = (FLOATP (v1) ? float_data (XFLOAT (v1)) : XINT (v1));
|
|
860 f2 = (FLOATP (v2) ? float_data (XFLOAT (v2)) : XINT (v2));
|
|
861 TOP = (f1 == f2 ? Qt : Qnil);
|
|
862 }
|
|
863 else
|
16
|
864 #endif /* LISP_FLOAT_TYPE */
|
0
|
865 TOP = (XINT (v1) == XINT (v2) ? Qt : Qnil);
|
|
866 break;
|
|
867
|
|
868 case Bgtr:
|
|
869 v1 = POP;
|
|
870 TOP = Fgtr (TOP, v1);
|
|
871 break;
|
|
872
|
|
873 case Blss:
|
|
874 v1 = POP;
|
|
875 TOP = Flss (TOP, v1);
|
|
876 break;
|
|
877
|
|
878 case Bleq:
|
|
879 v1 = POP;
|
|
880 TOP = Fleq (TOP, v1);
|
|
881 break;
|
|
882
|
|
883 case Bgeq:
|
|
884 v1 = POP;
|
|
885 TOP = Fgeq (TOP, v1);
|
|
886 break;
|
|
887
|
|
888 case Bdiff:
|
|
889 DISCARD (1);
|
|
890 TOP = Fminus (2, &TOP);
|
|
891 break;
|
|
892
|
|
893 case Bnegate:
|
|
894 v1 = TOP;
|
|
895 if (INTP (v1))
|
|
896 {
|
|
897 XSETINT (v1, - XINT (v1));
|
|
898 TOP = v1;
|
|
899 }
|
|
900 else
|
|
901 TOP = Fminus (1, &TOP);
|
|
902 break;
|
|
903
|
|
904 case Bplus:
|
|
905 DISCARD (1);
|
|
906 TOP = Fplus (2, &TOP);
|
|
907 break;
|
|
908
|
|
909 case Bmax:
|
|
910 DISCARD (1);
|
|
911 TOP = Fmax (2, &TOP);
|
|
912 break;
|
|
913
|
|
914 case Bmin:
|
|
915 DISCARD (1);
|
|
916 TOP = Fmin (2, &TOP);
|
|
917 break;
|
|
918
|
|
919 case Bmult:
|
|
920 DISCARD (1);
|
|
921 TOP = Ftimes (2, &TOP);
|
|
922 break;
|
|
923
|
|
924 case Bquo:
|
|
925 DISCARD (1);
|
|
926 TOP = Fquo (2, &TOP);
|
|
927 break;
|
|
928
|
|
929 case Brem:
|
|
930 v1 = POP;
|
|
931 TOP = Frem (TOP, v1);
|
|
932 break;
|
|
933
|
|
934 case Bpoint:
|
|
935 v1 = make_int (BUF_PT (current_buffer));
|
|
936 PUSH (v1);
|
|
937 break;
|
|
938
|
|
939 case Bgoto_char:
|
|
940 TOP = Fgoto_char (TOP, Fcurrent_buffer ());
|
|
941 break;
|
|
942
|
|
943 case Binsert:
|
|
944 TOP = Finsert (1, &TOP);
|
|
945 break;
|
|
946
|
|
947 case BinsertN:
|
|
948 op = FETCH;
|
|
949 DISCARD (op - 1);
|
|
950 TOP = Finsert (op, &TOP);
|
|
951 break;
|
|
952
|
|
953 case Bpoint_max:
|
|
954 v1 = make_int (BUF_ZV (current_buffer));
|
|
955 PUSH (v1);
|
|
956 break;
|
|
957
|
|
958 case Bpoint_min:
|
|
959 v1 = make_int (BUF_BEGV (current_buffer));
|
|
960 PUSH (v1);
|
|
961 break;
|
|
962
|
|
963 case Bchar_after:
|
|
964 TOP = Fchar_after (TOP, Fcurrent_buffer ());
|
|
965 break;
|
|
966
|
|
967 case Bfollowing_char:
|
|
968 v1 = Ffollowing_char (Fcurrent_buffer ());
|
|
969 PUSH (v1);
|
|
970 break;
|
|
971
|
|
972 case Bpreceding_char:
|
|
973 v1 = Fpreceding_char (Fcurrent_buffer ());
|
|
974 PUSH (v1);
|
|
975 break;
|
|
976
|
|
977 case Bcurrent_column:
|
|
978 v1 = make_int (current_column (current_buffer));
|
|
979 PUSH (v1);
|
|
980 break;
|
|
981
|
|
982 case Bindent_to:
|
|
983 TOP = Findent_to (TOP, Qnil, Fcurrent_buffer ());
|
|
984 break;
|
|
985
|
|
986 case Beolp:
|
|
987 PUSH (Feolp (Fcurrent_buffer ()));
|
|
988 break;
|
|
989
|
|
990 case Beobp:
|
|
991 PUSH (Feobp (Fcurrent_buffer ()));
|
|
992 break;
|
|
993
|
|
994 case Bbolp:
|
|
995 PUSH (Fbolp (Fcurrent_buffer ()));
|
|
996 break;
|
|
997
|
|
998 case Bbobp:
|
|
999 PUSH (Fbobp (Fcurrent_buffer ()));
|
|
1000 break;
|
|
1001
|
|
1002 case Bcurrent_buffer:
|
|
1003 PUSH (Fcurrent_buffer ());
|
|
1004 break;
|
|
1005
|
|
1006 case Bset_buffer:
|
|
1007 TOP = Fset_buffer (TOP);
|
|
1008 break;
|
|
1009
|
|
1010 case Bread_char:
|
|
1011 PUSH (call0 (Qread_char));
|
|
1012 QUIT;
|
|
1013 break;
|
|
1014
|
|
1015 case Binteractive_p:
|
|
1016 PUSH (Finteractive_p ());
|
|
1017 break;
|
|
1018
|
|
1019 case Bforward_char:
|
|
1020 TOP = Fforward_char (TOP, Fcurrent_buffer ());
|
|
1021 break;
|
|
1022
|
|
1023 case Bforward_word:
|
|
1024 TOP = Fforward_word (TOP, Fcurrent_buffer ());
|
|
1025 break;
|
|
1026
|
|
1027 case Bskip_chars_forward:
|
|
1028 v1 = POP;
|
|
1029 TOP = Fskip_chars_forward (TOP, v1, Fcurrent_buffer ());
|
|
1030 break;
|
|
1031
|
|
1032 case Bskip_chars_backward:
|
|
1033 v1 = POP;
|
|
1034 TOP = Fskip_chars_backward (TOP, v1, Fcurrent_buffer ());
|
|
1035 break;
|
|
1036
|
|
1037 case Bforward_line:
|
|
1038 TOP = Fforward_line (TOP, Fcurrent_buffer ());
|
|
1039 break;
|
|
1040
|
|
1041 case Bchar_syntax:
|
|
1042 CHECK_CHAR_COERCE_INT (TOP);
|
|
1043 TOP = make_char (syntax_code_spec
|
16
|
1044 [(int) SYNTAX
|
|
1045 (current_buffer->syntax_table,
|
|
1046 XCHAR (TOP))]);
|
0
|
1047 break;
|
|
1048
|
|
1049 case Bbuffer_substring:
|
|
1050 v1 = POP;
|
|
1051 TOP = Fbuffer_substring (TOP, v1, Fcurrent_buffer ());
|
|
1052 break;
|
|
1053
|
|
1054 case Bdelete_region:
|
|
1055 v1 = POP;
|
|
1056 TOP = Fdelete_region (TOP, v1, Fcurrent_buffer ());
|
|
1057 break;
|
|
1058
|
|
1059 case Bnarrow_to_region:
|
|
1060 v1 = POP;
|
|
1061 TOP = Fnarrow_to_region (TOP, v1, Fcurrent_buffer ());
|
|
1062 break;
|
|
1063
|
|
1064 case Bwiden:
|
|
1065 PUSH (Fwiden (Fcurrent_buffer ()));
|
|
1066 break;
|
|
1067
|
|
1068 case Bend_of_line:
|
|
1069 TOP = Fend_of_line (TOP, Fcurrent_buffer ());
|
|
1070 break;
|
|
1071
|
|
1072 case Bset_marker:
|
|
1073 v1 = POP;
|
|
1074 v2 = POP;
|
|
1075 TOP = Fset_marker (TOP, v2, v1);
|
|
1076 break;
|
|
1077
|
|
1078 case Bmatch_beginning:
|
|
1079 TOP = Fmatch_beginning (TOP);
|
|
1080 break;
|
|
1081
|
|
1082 case Bmatch_end:
|
|
1083 TOP = Fmatch_end (TOP);
|
|
1084 break;
|
|
1085
|
|
1086 case Bupcase:
|
|
1087 TOP = Fupcase (TOP, Fcurrent_buffer ());
|
|
1088 break;
|
|
1089
|
|
1090 case Bdowncase:
|
|
1091 TOP = Fdowncase (TOP, Fcurrent_buffer ());
|
|
1092 break;
|
|
1093
|
|
1094 case Bstringeqlsign:
|
|
1095 v1 = POP;
|
|
1096 TOP = Fstring_equal (TOP, v1);
|
|
1097 break;
|
|
1098
|
|
1099 case Bstringlss:
|
|
1100 v1 = POP;
|
|
1101 TOP = Fstring_lessp (TOP, v1);
|
|
1102 break;
|
|
1103
|
|
1104 case Bequal:
|
|
1105 v1 = POP;
|
|
1106 TOP = Fequal (TOP, v1);
|
|
1107 break;
|
|
1108
|
|
1109 case Bnthcdr:
|
|
1110 v1 = POP;
|
|
1111 TOP = Fnthcdr (TOP, v1);
|
|
1112 break;
|
|
1113
|
|
1114 case Belt:
|
|
1115 #if 0
|
|
1116 /* probably this code is OK, but nth_entry is commented
|
|
1117 out above --ben */
|
|
1118 if (XTYPE (TOP) == Lisp_Cons)
|
|
1119 {
|
|
1120 /* Exchange args and then do nth. */
|
|
1121 v2 = POP;
|
|
1122 v1 = TOP;
|
|
1123 goto nth_entry;
|
|
1124 }
|
|
1125 #endif
|
|
1126 v1 = POP;
|
|
1127 TOP = Felt (TOP, v1);
|
|
1128 break;
|
|
1129
|
|
1130 case Bmember:
|
|
1131 v1 = POP;
|
|
1132 TOP = Fmember (TOP, v1);
|
|
1133 break;
|
|
1134
|
|
1135 case Bassq:
|
|
1136 v1 = POP;
|
|
1137 TOP = Fassq (TOP, v1);
|
|
1138 break;
|
|
1139
|
|
1140 case Bnreverse:
|
|
1141 TOP = Fnreverse (TOP);
|
|
1142 break;
|
|
1143
|
|
1144 case Bsetcar:
|
|
1145 v1 = POP;
|
|
1146 TOP = Fsetcar (TOP, v1);
|
|
1147 break;
|
|
1148
|
|
1149 case Bsetcdr:
|
|
1150 v1 = POP;
|
|
1151 TOP = Fsetcdr (TOP, v1);
|
|
1152 break;
|
|
1153
|
|
1154 case Bcar_safe:
|
|
1155 v1 = TOP;
|
|
1156 if (CONSP (v1))
|
|
1157 TOP = XCAR (v1);
|
|
1158 else
|
|
1159 TOP = Qnil;
|
|
1160 break;
|
|
1161
|
|
1162 case Bcdr_safe:
|
|
1163 v1 = TOP;
|
|
1164 if (CONSP (v1))
|
|
1165 TOP = XCDR (v1);
|
|
1166 else
|
|
1167 TOP = Qnil;
|
|
1168 break;
|
|
1169
|
|
1170 case Bnconc:
|
|
1171 DISCARD (1);
|
|
1172 TOP = Fnconc (2, &TOP);
|
|
1173 break;
|
|
1174
|
|
1175 case Bnumberp:
|
|
1176 TOP = ((INT_OR_FLOATP (TOP)) ? Qt : Qnil);
|
|
1177 break;
|
|
1178
|
|
1179 case Bintegerp:
|
|
1180 TOP = ((INTP (TOP)) ? Qt : Qnil);
|
|
1181 break;
|
|
1182
|
|
1183 #ifdef BYTE_CODE_SAFE
|
|
1184 case Bset_mark:
|
|
1185 error ("set-mark is an obsolete bytecode");
|
|
1186 break;
|
|
1187 case Bscan_buffer:
|
|
1188 error ("scan-buffer is an obsolete bytecode");
|
|
1189 break;
|
|
1190 case Bmark:
|
|
1191 error ("mark is an obsolete bytecode");
|
|
1192 break;
|
|
1193 #endif
|
|
1194
|
|
1195 default:
|
|
1196 #ifdef BYTE_CODE_SAFE
|
|
1197 if (op < Bconstant)
|
|
1198 error ("unknown bytecode %d (byte compiler bug)", op);
|
|
1199 if ((op -= Bconstant) >= const_length)
|
|
1200 error ("no constant number %d (byte compiler bug)", op);
|
|
1201 PUSH (vectorp[op]);
|
|
1202 #else
|
|
1203 PUSH (vectorp[op - Bconstant]);
|
|
1204 #endif
|
|
1205 }
|
|
1206 }
|
|
1207
|
|
1208 exit:
|
|
1209 UNGCPRO;
|
|
1210 /* Binds and unbinds are supposed to be compiled balanced. */
|
|
1211 if (specpdl_depth() != speccount)
|
|
1212 /* FSF: abort() if BYTE_CODE_SAFE not defined */
|
|
1213 error ("binding stack not balanced (serious byte compiler bug)");
|
|
1214 return v1;
|
|
1215 }
|
|
1216
|
|
1217 void
|
|
1218 syms_of_bytecode (void)
|
|
1219 {
|
|
1220 defsymbol (&Qbyte_code, "byte-code");
|
20
|
1221 DEFSUBR (Fbyte_code);
|
0
|
1222 #ifdef BYTE_CODE_METER
|
|
1223 defsymbol (&Qbyte_code_meter, "byte-code-meter");
|
|
1224 #endif
|
|
1225 }
|
|
1226
|
|
1227 void
|
|
1228 vars_of_bytecode (void)
|
|
1229 {
|
|
1230 #ifdef BYTE_CODE_METER
|
|
1231
|
|
1232 DEFVAR_LISP ("byte-code-meter", &Vbyte_code_meter /*
|
|
1233 A vector of vectors which holds a histogram of byte-code usage.
|
|
1234 (aref (aref byte-code-meter 0) CODE) indicates how many times the byte
|
|
1235 opcode CODE has been executed.
|
|
1236 (aref (aref byte-code-meter CODE1) CODE2), where CODE1 is not 0,
|
|
1237 indicates how many times the byte opcodes CODE1 and CODE2 have been
|
|
1238 executed in succession.
|
|
1239 */ );
|
|
1240 DEFVAR_BOOL ("byte-metering-on", &byte_metering_on /*
|
|
1241 If non-nil, keep profiling information on byte code usage.
|
|
1242 The variable byte-code-meter indicates how often each byte opcode is used.
|
|
1243 If a symbol has a property named `byte-code-meter' whose value is an
|
|
1244 integer, it is incremented each time that symbol's function is called.
|
|
1245 */ );
|
|
1246
|
|
1247 byte_metering_on = 0;
|
|
1248 Vbyte_code_meter = make_vector (256, Qzero);
|
|
1249 {
|
|
1250 int i = 256;
|
|
1251 while (i--)
|
|
1252 vector_data (XVECTOR (Vbyte_code_meter))[i] =
|
|
1253 make_vector (256, Qzero);
|
|
1254 }
|
|
1255 #endif
|
|
1256 }
|