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