diff options
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 49 |
1 files changed, 5 insertions, 44 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 55789b41ad9..86d44aba46b 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -296,7 +296,7 @@ enum byte_code_op | |||
| 296 | }; | 296 | }; |
| 297 | 297 | ||
| 298 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ | 298 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ |
| 299 | #define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK) | 299 | #define BYTE_MAINTAIN_TOP BYTE_CODE_SAFE |
| 300 | 300 | ||
| 301 | /* Structure describing a value stack used during byte-code execution | 301 | /* Structure describing a value stack used during byte-code execution |
| 302 | in Fbyte_code. */ | 302 | in Fbyte_code. */ |
| @@ -319,12 +319,6 @@ struct byte_stack | |||
| 319 | Lisp_Object byte_string; | 319 | Lisp_Object byte_string; |
| 320 | const unsigned char *byte_string_start; | 320 | const unsigned char *byte_string_start; |
| 321 | 321 | ||
| 322 | #if BYTE_MARK_STACK | ||
| 323 | /* The vector of constants used during byte-code execution. Storing | ||
| 324 | this here protects it from GC because mark_byte_stack marks it. */ | ||
| 325 | Lisp_Object constants; | ||
| 326 | #endif | ||
| 327 | |||
| 328 | /* Next entry in byte_stack_list. */ | 322 | /* Next entry in byte_stack_list. */ |
| 329 | struct byte_stack *next; | 323 | struct byte_stack *next; |
| 330 | }; | 324 | }; |
| @@ -332,46 +326,16 @@ struct byte_stack | |||
| 332 | /* A list of currently active byte-code execution value stacks. | 326 | /* A list of currently active byte-code execution value stacks. |
| 333 | Fbyte_code adds an entry to the head of this list before it starts | 327 | Fbyte_code adds an entry to the head of this list before it starts |
| 334 | processing byte-code, and it removes the entry again when it is | 328 | processing byte-code, and it removes the entry again when it is |
| 335 | done. Signaling an error truncates the list analogous to | 329 | done. Signaling an error truncates the list. */ |
| 336 | gcprolist. */ | ||
| 337 | 330 | ||
| 338 | struct byte_stack *byte_stack_list; | 331 | struct byte_stack *byte_stack_list; |
| 339 | 332 | ||
| 340 | 333 | ||
| 341 | /* Mark objects on byte_stack_list. Called during GC. */ | 334 | /* Relocate program counters in the stacks on byte_stack_list. Called |
| 342 | 335 | when GC has completed. */ | |
| 343 | #if BYTE_MARK_STACK | ||
| 344 | void | ||
| 345 | mark_byte_stack (void) | ||
| 346 | { | ||
| 347 | struct byte_stack *stack; | ||
| 348 | Lisp_Object *obj; | ||
| 349 | |||
| 350 | for (stack = byte_stack_list; stack; stack = stack->next) | ||
| 351 | { | ||
| 352 | /* If STACK->top is null here, this means there's an opcode in | ||
| 353 | Fbyte_code that wasn't expected to GC, but did. To find out | ||
| 354 | which opcode this is, record the value of `stack', and walk | ||
| 355 | up the stack in a debugger, stopping in frames of Fbyte_code. | ||
| 356 | The culprit is found in the frame of Fbyte_code where the | ||
| 357 | address of its local variable `stack' is equal to the | ||
| 358 | recorded value of `stack' here. */ | ||
| 359 | eassert (stack->top); | ||
| 360 | |||
| 361 | for (obj = stack->bottom; obj <= stack->top; ++obj) | ||
| 362 | mark_object (*obj); | ||
| 363 | |||
| 364 | mark_object (stack->byte_string); | ||
| 365 | mark_object (stack->constants); | ||
| 366 | } | ||
| 367 | } | ||
| 368 | #endif | ||
| 369 | |||
| 370 | /* Unmark objects in the stacks on byte_stack_list. Relocate program | ||
| 371 | counters. Called when GC has completed. */ | ||
| 372 | 336 | ||
| 373 | void | 337 | void |
| 374 | unmark_byte_stack (void) | 338 | relocate_byte_stack (void) |
| 375 | { | 339 | { |
| 376 | struct byte_stack *stack; | 340 | struct byte_stack *stack; |
| 377 | 341 | ||
| @@ -554,9 +518,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 554 | 518 | ||
| 555 | stack.byte_string = bytestr; | 519 | stack.byte_string = bytestr; |
| 556 | stack.pc = stack.byte_string_start = SDATA (bytestr); | 520 | stack.pc = stack.byte_string_start = SDATA (bytestr); |
| 557 | #if BYTE_MARK_STACK | ||
| 558 | stack.constants = vector; | ||
| 559 | #endif | ||
| 560 | if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) | 521 | if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) |
| 561 | memory_full (SIZE_MAX); | 522 | memory_full (SIZE_MAX); |
| 562 | top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); | 523 | top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); |