don't use pic->rescue stack in with-exception-handler
This commit is contained in:
		
							parent
							
								
									f6f695fa56
								
							
						
					
					
						commit
						6448a36db5
					
				
							
								
								
									
										19
									
								
								src/error.c
								
								
								
								
							
							
						
						
									
										19
									
								
								src/error.c
								
								
								
								
							|  | @ -127,19 +127,16 @@ pic_error_with_exception_handler(pic_state *pic) | ||||||
| 
 | 
 | ||||||
|   pic_get_args(pic, "ll", &handler, &thunk); |   pic_get_args(pic, "ll", &handler, &thunk); | ||||||
| 
 | 
 | ||||||
|   if (pic->ridx >= pic->rlen) { |   pic_try { | ||||||
| 
 |     v = pic_apply_argv(pic, thunk, 0); | ||||||
| #if DEBUG |  | ||||||
|     puts("rescue realloced"); |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
|     pic->rlen *= 2; |  | ||||||
|     pic->rescue = (struct pic_proc **)pic_realloc(pic, pic->rescue, sizeof(struct pic_proc *) * pic->rlen); |  | ||||||
|   } |   } | ||||||
|   pic->rescue[pic->ridx++] = handler; |   pic_catch { | ||||||
|  |     struct pic_error *e = pic->err; | ||||||
| 
 | 
 | ||||||
|   v = pic_apply_argv(pic, thunk, 0); |     pic->err = NULL; | ||||||
|   pic->ridx--; |     v = pic_apply_argv(pic, handler, 1, pic_obj_value(e)); | ||||||
|  |     pic_errorf(pic, "error handler returned ~s, by error ~s", v, pic_obj_value(e)); | ||||||
|  |   } | ||||||
|   return v; |   return v; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Yuichi Nishiwaki
						Yuichi Nishiwaki