Mercurial > projects > ldc
comparison runtime/internal/eh.d @ 741:4ac97ec7c18e
Applied easy part from wilsonk's x86-64 patch in #107
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Thu, 30 Oct 2008 11:08:34 +0100 |
parents | 6aaa3d3c1183 |
children | 661384d6a936 |
comparison
equal
deleted
inserted
replaced
740:96484f5bf5af | 741:4ac97ec7c18e |
---|---|
12 // current EH implementation works on x86 | 12 // current EH implementation works on x86 |
13 // if it has a working unwind runtime | 13 // if it has a working unwind runtime |
14 version(X86) { | 14 version(X86) { |
15 version(linux) version=X86_UNWIND; | 15 version(linux) version=X86_UNWIND; |
16 version(darwin) version=X86_UNWIND; | 16 version(darwin) version=X86_UNWIND; |
17 } | |
18 version(X86_64) { | |
19 version(linux) version=X86_UNWIND; | |
17 } | 20 } |
18 | 21 |
19 private extern(C) void abort(); | 22 private extern(C) void abort(); |
20 private extern(C) int printf(char*, ...); | 23 private extern(C) int printf(char*, ...); |
21 private extern(C) int vprintf(char*, va_list va); | 24 private extern(C) int vprintf(char*, va_list va); |
166 | 169 |
167 // | 170 // |
168 // x86 unwind specific implementation of personality function | 171 // x86 unwind specific implementation of personality function |
169 // and helpers | 172 // and helpers |
170 // | 173 // |
171 version(X86_UNWIND) | 174 version(X86_UNWIND) |
172 { | 175 { |
173 | 176 |
174 // the personality routine gets called by the unwind handler and is responsible for | 177 // the personality routine gets called by the unwind handler and is responsible for |
175 // reading the EH tables and deciding what to do | 178 // reading the EH tables and deciding what to do |
176 extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions, ulong exception_class, _Unwind_Exception* exception_info, _Unwind_Context_Ptr context) | 179 extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions, ulong exception_class, _Unwind_Exception* exception_info, _Unwind_Context_Ptr context) |
294 } | 297 } |
295 | 298 |
296 // These are the register numbers for SetGR that | 299 // These are the register numbers for SetGR that |
297 // llvm's eh.exception and eh.selector intrinsics | 300 // llvm's eh.exception and eh.selector intrinsics |
298 // will pick up. | 301 // will pick up. |
299 // Found by trial-and-error and probably platform dependent! | 302 // Found by trial-and-error :/ |
300 private int eh_exception_regno = 0; | 303 version (X86_64) |
301 private int eh_selector_regno = 2; | 304 { |
305 private int eh_exception_regno = 3; | |
306 private int eh_selector_regno = 1; | |
307 } else { | |
308 private int eh_exception_regno = 0; | |
309 private int eh_selector_regno = 2; | |
310 } | |
302 | 311 |
303 private _Unwind_Reason_Code _d_eh_install_catch_context(_Unwind_Action actions, ptrdiff_t switchval, ulong landing_pad, _d_exception* exception_struct, _Unwind_Context_Ptr context) | 312 private _Unwind_Reason_Code _d_eh_install_catch_context(_Unwind_Action actions, ptrdiff_t switchval, ulong landing_pad, _d_exception* exception_struct, _Unwind_Context_Ptr context) |
304 { | 313 { |
305 debug(EH_personality) printf("Found catch clause!\n"); | 314 debug(EH_personality) printf("Found catch clause!\n"); |
306 | 315 |