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