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