comparison tango/lib/compiler/llvmdc/eh.d @ 319:e9c93739bc4c trunk

[svn r340] Rework exception handling to work with nested tryfinally and trycatch.
author ChristianK
date Sat, 05 Jul 2008 10:22:56 +0200
parents 8e570dbe4087
children 5bea8a1ef905
comparison
equal deleted inserted replaced
318:8e570dbe4087 319:e9c93739bc4c
2 * Temporary exception handling stubs 2 * Temporary exception handling stubs
3 */ 3 */
4 4
5 import util.console; 5 import util.console;
6 6
7 //debug = EH_personality; 7 // debug = EH_personality;
8 8
9 private extern(C) void abort(); 9 private extern(C) void abort();
10 private extern(C) int printf(char*, ...); 10 private extern(C) int printf(char*, ...);
11 11
12 // D runtime functions 12 // D runtime functions
249 if(actions & _Unwind_Action.SEARCH_PHASE) 249 if(actions & _Unwind_Action.SEARCH_PHASE)
250 return _Unwind_Reason_Code.HANDLER_FOUND; 250 return _Unwind_Reason_Code.HANDLER_FOUND;
251 251
252 else if(actions & _Unwind_Action.HANDLER_PHASE) 252 else if(actions & _Unwind_Action.HANDLER_PHASE)
253 { 253 {
254 debug(EH_personality) printf("Setting switch value to: %d!\n", switchval);
254 _Unwind_SetGR(context, eh_exception_regno, cast(ulong)cast(void*)(exception_struct.exception_object)); 255 _Unwind_SetGR(context, eh_exception_regno, cast(ulong)cast(void*)(exception_struct.exception_object));
255 _Unwind_SetGR(context, eh_selector_regno, switchval); 256 _Unwind_SetGR(context, eh_selector_regno, switchval);
256 _Unwind_SetIP(context, landing_pad); 257 _Unwind_SetIP(context, landing_pad);
257 return _Unwind_Reason_Code.INSTALL_CONTEXT; 258 return _Unwind_Reason_Code.INSTALL_CONTEXT;
258 } 259 }
267 return _Unwind_Reason_Code.CONTINUE_UNWIND; 268 return _Unwind_Reason_Code.CONTINUE_UNWIND;
268 269
269 debug(EH_personality) printf("Calling cleanup routine...\n"); 270 debug(EH_personality) printf("Calling cleanup routine...\n");
270 271
271 _Unwind_SetGR(context, eh_exception_regno, cast(ulong)exception_struct); 272 _Unwind_SetGR(context, eh_exception_regno, cast(ulong)exception_struct);
273 _Unwind_SetGR(context, eh_selector_regno, 0);
272 _Unwind_SetIP(context, landing_pad); 274 _Unwind_SetIP(context, landing_pad);
273 return _Unwind_Reason_Code.INSTALL_CONTEXT; 275 return _Unwind_Reason_Code.INSTALL_CONTEXT;
274 } 276 }
275 277
276 private void _d_getLanguageSpecificTables(_Unwind_Context_Ptr context, ref ubyte* callsite, ref ubyte* action, ref ClassInfo* ci) 278 private void _d_getLanguageSpecificTables(_Unwind_Context_Ptr context, ref ubyte* callsite, ref ubyte* action, ref ClassInfo* ci)