Bjarke Walling wrote:> Another option I'm thinking about is creating a runtime that, when > initialized, compiles the DWARF information to native code. It could > create an Instruction Pointer lookup hash table associated with unwind > actions.JIT-compiling the unwinder data, yes. Given that the unwinder data is, basically, the source for a specialized bytecode interpreter I can't see any reason this wouldn't work.> Maybe libgcc/libunwind does this already?It doesn't. Andrew.
Hi Andrew, On Tue, Mar 3, 2009 at 2:40 PM, Andrew Haley <aph at redhat.com> wrote:> JIT-compiling the unwinder data, yes. Given that the unwinder data > is, basically, the source for a specialized bytecode interpreter I > can't see any reason this wouldn't work.I might look into that. It will be a good challenge to understand the EH data in detail and program my own stack unwinding routine. If it works out I can think of how to do most of the work compile-time. I still don't see the complexities in stack unwinding: Restore caller registers, remove the frame, lookup next frame, etc. The complexity might be in the details of course. If I start implementing my own unwinding routine I can prove myself wrong in how easy I think it is. It would be nice with a suite of test cases that use invoke/unwind in various situations (complex stack frames, simple stack frames, unwind as the first thing/last thing/middle of function, unwind few/many frames, etc.) I can run this suite to see if and where my runtime fails. I'm not sure such a thing exists? Even with the test suite I would have to run it using different compiler settings and optimisations. Bjarke Walling
Hello,> still don't see the complexities in stack unwinding: Restore caller > registers, remove the frame, lookup next frame, etc.This is not enough for C++, for example. You would need to run destructors, be able to propagate exception object upper, do a type- based catch, etc. You might want to read http://www.codesourcery.com/public/cxx-abi/abi-eh.html Also, studying libgcc unwinding runtime and different personality functions is a good start.> It would be nice with a suite of test cases that use invoke/unwind in > various situations (complex stack frames, simple stack frames, unwind > as the first thing/last thing/middle of function, unwind few/many > frames, etc.) I can run this suite to see if and where my runtime > fails. I'm not sure such a thing exists?gcc testsuite has some amount of such tests. --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University