comparison src/bytecode.c @ 16815:9e0f59154164

(HANDLE_RELOCATION): New macro. (MAYBE_GC): Call HANDLE_RELOCATION. Swallow following semicolon. (Fbyte_code): Use HANDLE_RELOCATION.
author Richard M. Stallman <rms@gnu.org>
date Thu, 02 Jan 1997 20:50:51 +0000
parents 79ea730b7e20
children 045ae402e927
comparison
equal deleted inserted replaced
16814:fdda5e6e6fe8 16815:9e0f59154164
254 /* Garbage collect if we have consed enough since the last time. 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. */ 255 We do this at every branch, to avoid loops that never GC. */
256 256
257 #define MAYBE_GC() \ 257 #define MAYBE_GC() \
258 if (consing_since_gc > gc_cons_threshold) \ 258 if (consing_since_gc > gc_cons_threshold) \
259 Fgarbage_collect (); 259 { \
260 Fgarbage_collect (); \
261 HANDLE_RELOCATION (); \
262 } \
263 else
264
265 /* Relocate BYTESTR if there has been a GC recently. */
266 #define HANDLE_RELOCATION() \
267 if (! EQ (string_saved, bytestr)) \
268 { \
269 pc = pc - XSTRING (string_saved)->data + XSTRING (bytestr)->data; \
270 string_saved = bytestr; \
271 } \
272 else
260 273
261 /* Check for jumping out of range. */ 274 /* Check for jumping out of range. */
262 #define CHECK_RANGE(ARG) \ 275 #define CHECK_RANGE(ARG) \
263 if (ARG >= bytestr_length) abort () 276 if (ARG >= bytestr_length) abort ()
264 277
321 if (stackp < stack) 334 if (stackp < stack)
322 error ("Byte code stack underflow (byte compiler bug), pc %d", 335 error ("Byte code stack underflow (byte compiler bug), pc %d",
323 pc - XSTRING (string_saved)->data); 336 pc - XSTRING (string_saved)->data);
324 #endif 337 #endif
325 338
326 if (! EQ (string_saved, bytestr)) 339 /* Update BYTESTR if we had a garbage collection. */
327 { 340 HANDLE_RELOCATION ();
328 pc = pc - XSTRING (string_saved)->data + XSTRING (bytestr)->data;
329 string_saved = bytestr;
330 }
331 341
332 #ifdef BYTE_CODE_METER 342 #ifdef BYTE_CODE_METER
333 prev_op = this_op; 343 prev_op = this_op;
334 this_op = op = FETCH; 344 this_op = op = FETCH;
335 METER_CODE (prev_op, op); 345 METER_CODE (prev_op, op);