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