bobjervis / parasol

The Parasol Language and related core development tools
Apache License 2.0
2 stars 2 forks source link

try / catch #18

Closed bobjervis closed 8 years ago

bobjervis commented 8 years ago

Complete implementation of try / catch

  1. Generation of catch clauses and finally clauses This entails implementing the 'deferTry' method to create a list of 'try' cleanup to perform at end of function. It also entails implementing 'JSR/RET' combination for finally clauses.
  2. Creation of Exception class - shared with C++ runtime. This entails implementing the class itself as well as an 'isa' method to use during the catch handlers.
  3. Implementation of throw This entails verifying the correctness of exception tables and the stack walk as well as the dispatching and resolution of exception handling itself (esp. stack synchronization).
bobjervis commented 8 years ago

Ironically, when I wrote a test, it turns out I needed to get 'throw' working before I could really test the other stuff. So, I got throw working well enough to get things going. The exception tables are correct for my test case and the code created the Exception object, called down into the C++ runtime and did the stack walk.

It found the correct handler and dispatched to it. Too bad the code generator gave it the wrong address and ended up restarting the program (now dubbed 'Groundhog Day').

bobjervis commented 8 years ago

Stack walking is working well enough to get thrown exceptions caught by the 'unhandled exception' handler.

Thrown exception leak the memory used to hold the exception and also do not dispatch correctly if there are specific exceptions to be caught.

bobjervis commented 8 years ago

There are still some memory leak issues around destructors getting scheduled and the introduction of appropriate finally blocks (under the hood), but that work should be tracked under other issues as bugs.