-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forbid hook routines raising exceptions #1236
forbid hook routines raising exceptions #1236
Commits on Mar 12, 2024
-
specify that hooks must not raise exceptions
The beginning of a language specification test category dedicated to hooks is added. At the moment, only the exception-effect-related behaviour is covered.
Configuration menu - View commit details
-
Copy full SHA for c4b6fb3 - Browse repository at this point
Copy the full SHA c4b6fb3View commit details -
sempass2: ensure that hooks don't raise exceptions
The procedure symbol is also marked with the `sfNeverRaises` flag, so that defects are prevented from escaping at run-time (they're not tracked at compile-time). A new report is added: `rsemHooksCannotRaise`.
Configuration menu - View commit details
-
Copy full SHA for 3e52eaa - Browse repository at this point
Copy the full SHA 3e52eaaView commit details -
liftdestructors: remove "raises" tracking
Lifting/synthesizing hooks no longer needs to track whether an exception is possible.
Configuration menu - View commit details
-
Copy full SHA for 65adcae - Browse repository at this point
Copy the full SHA 65adcaeView commit details -
injectdestructors: always use unchecked calls for hooks
They're guaranteed to not require exception propagation, so a normal `mnkCall` can always be used. The comment detailing the now-resolved problem with hooks that raise is also removed.
Configuration menu - View commit details
-
Copy full SHA for 7786e11 - Browse repository at this point
Copy the full SHA 7786e11View commit details -
mirgen: implement "never raises" handling
If a procedure is flagged with `sfNeverRaises`, the body is wrapped in a catch-all exception handler, where the new `nimUnhandledException` runtime procedure is invoked from the handler. If the handler is not actually used, `cgirgen`'s unreachable code elimination automatically eliminates it again. Implementing this in `mirgen` ensures consistent behaviour across all backends.
Configuration menu - View commit details
-
Copy full SHA for e493a2a - Browse repository at this point
Copy the full SHA e493a2aView commit details -
implement
nimUnhandledException
for C and JavaScriptFor the VM, it's not as simple as for the other two, so the implementation is still missing.
Configuration menu - View commit details
-
Copy full SHA for 8110d6a - Browse repository at this point
Copy the full SHA 8110d6aView commit details -
orc:
GC_fullCollect
doesn't raiseThe trace hooks were considered to be able to raise exceptions and have effects, but this is no longer the case, so the pointer can be safely cast to procedural values without.
Configuration menu - View commit details
-
Copy full SHA for e8a94e7 - Browse repository at this point
Copy the full SHA e8a94e7View commit details -
tasks: mark
destroy
callback as not raisingThe callback is only used internally, so this does not constitute a breaking change of the `Task` API.
Configuration menu - View commit details
-
Copy full SHA for 6482de5 - Browse repository at this point
Copy the full SHA 6482de5View commit details -
Three individual tests need to be adjusted to the language change: * `tnew` and `gctest use `debugEcho` instead of `write` (the former has no effects) * `tarcmisc` has to cast away the raise effects of `Stream.close` for now
Configuration menu - View commit details
-
Copy full SHA for 0cb2a24 - Browse repository at this point
Copy the full SHA 0cb2a24View commit details -
tests: update
--expandArc
-using testsHooks not being considered as potentially raising is visible in the pretty-printed MIR output.
Configuration menu - View commit details
-
Copy full SHA for 9b22cf4 - Browse repository at this point
Copy the full SHA 9b22cf4View commit details
Commits on Mar 15, 2024
-
tests: fix specification tests for JS
Reporting of unhandled exceptions doesn't include a trailing ':' in the displayed message if there's no exception message. A message is now set on the raised defect, which, besides resulting in consistent output, also helps makes sure that the correct defect is reported.
Configuration menu - View commit details
-
Copy full SHA for 4725095 - Browse repository at this point
Copy the full SHA 4725095View commit details -
implement
nimUnhandledException
for the VMThe procedure is implemented as a syscall (`vmops`), which raises the existing `vmEvtUnhandledException` VM event, thus terminating the VM right away. Since syscall implementations are currently unable to create a stack- trace, no stack-trace is passed along, which `compilerbridge.buildError` now accounts for (by creating the stack- trace itself). This is somewhat hack-y.
Configuration menu - View commit details
-
Copy full SHA for ef88fcc - Browse repository at this point
Copy the full SHA ef88fccView commit details -
Configuration menu - View commit details
-
Copy full SHA for dd4db85 - Browse repository at this point
Copy the full SHA dd4db85View commit details -
jssys: properly terminate when using node.js
While not possible directly with JavaScript, node.js provides `process.exit`, which allows terminating in case of an unhandled exception.
Configuration menu - View commit details
-
Copy full SHA for 0643d4d - Browse repository at this point
Copy the full SHA 0643d4dView commit details