brownplt / pyret-lang

The Pyret language.
Other
1.06k stars 106 forks source link

Convert from exceptions to (un)tagged-unions #674

Open blerner opened 8 years ago

blerner commented 8 years ago

Currently our stack safety behavior relies on thrown exceptions that are caught and rehandled at every single stack frame. Since exceptions are a known trigger for JS JITs to de-optimize code, we ought to try to eliminate them.

Since Cont exceptions are already not valid Pyret values, we don't really need to change our representations. We just need to change the try/catch mechanism to be an if test at the end of the switch statement in every Pyret function. Additionally, we need to consider how this impacts safeCall, which probably does need to keep its try/catch, in case raw JS functions throw an exception that needs to be converted into a Pyret error.

blerner commented 7 years ago

This is the point of the return-stack branch, right?