Ticket #804: RT_63592.patch
File RT_63592.patch, 3.2 KB (added by NotFound, 13 years ago) |
---|
-
src/exceptions.c
343 343 344 344 Parrot_runloop *return_point = interp->current_runloop; 345 345 RunProfile * const profile = interp->profile; 346 opcode_t *address; 346 347 PMC * const handler = 347 348 Parrot_cx_find_handler_local(interp, exception); 348 349 … … 384 385 } 385 386 386 387 /* Run the handler. */ 387 Parrot_runops_fromc_args(interp, handler, "vP", exception);388 389 /* After handling a C exception, you don't want to resume at the point390 * where the C exception was thrown. You want to resume the next outer391 * runloop. */392 longjmp(return_point->resume, 1);388 address = VTABLE_invoke(interp, handler, NULL); 389 if (PMC_cont(handler)->current_results) 390 address = pass_exception_args(interp, "P", address, 391 CONTEXT(interp), exception); 392 return_point->newoffset = address; 393 longjmp(return_point->resume, 2); 393 394 } 394 395 395 396 /* -
src/call/ops.c
88 88 #endif 89 89 { 90 90 new_runloop_jump_point(interp); 91 if (setjmp(interp->current_runloop->resume)) { 92 /* an exception was handled */ 93 if (STACKED_EXCEPTIONS) 94 free_runloop_jump_point(interp); 91 reenter: 92 switch (setjmp(interp->current_runloop->resume)) { 93 case 1: 94 /* an exception was handled */ 95 if (STACKED_EXCEPTIONS) 96 free_runloop_jump_point(interp); 95 97 96 interp->current_runloop_level = our_runloop_level - 1;97 interp->current_runloop_id = old_runloop_id;98 interp->current_runloop_level = our_runloop_level - 1; 99 interp->current_runloop_id = old_runloop_id; 98 100 99 101 #if RUNLOOP_TRACE 100 fprintf(stderr, "[handled exception; back to loop %d, level %d]\n",101 interp->current_runloop_id, interp->current_runloop_level);102 fprintf(stderr, "[handled exception; back to loop %d, level %d]\n", 103 interp->current_runloop_id, interp->current_runloop_level); 102 104 #endif 103 return; 105 return; 106 case 2: 107 /* Reenter the runloop from a exception thrown from C 108 * with a pir handler */ 109 offset = interp->current_runloop->newoffset - interp->code->base.data; 110 goto reenter; 111 default: 112 break; 104 113 } 105 114 } 106 115 -
include/parrot/interpreter.h
292 292 typedef struct parrot_runloop_t { 293 293 Parrot_jump_buff resume; /* jmp_buf */ 294 294 struct parrot_runloop_t *prev; /* interpreter's runloop jump buffer stack */ 295 opcode_t *newoffset; /* Used in exception handling */ 295 296 } parrot_runloop_t; 296 297 297 298 typedef parrot_runloop_t Parrot_runloop;