[J3] Exception handling in one Ada processor
Van Snyder
van.snyder at jpl.nasa.gov
Thu Jul 25 00:32:53 EDT 2019
I've just had some correspondence from the developer of Janus/Ada.
He told me that having exception handlers in a program increases the
binary image size. The fixed amount of increase, due to the presence of
exception handling in the language, consists of a small runtime library
component. The rest of the increase is code in exception handlers. If
there are no handlers, there is no code to implement them, and the
binary image size increase is limited to the runtime library component.
The Ada specification of exception handling does not introduce sequence
points. He wrote that in
A := <expr1>;
B := <expr2>;
if an exception occurs during evaluation of <expr1>, there is no
guarantee that <expr2> was not evaluated or that B was not updated, and
if an exception occurs during evaluation of <expr2> there is no
guarantee that <expr1> was evaluated and A updated. The processor is
able to re-order those statements, according to the usual rules that
would apply in the absence of exception handling facilities.
Loop-invariant calculations could be hoisted out of loops. The only
restriction on code motion is that code inside one begin ... handle ...
end block cannot be moved outside the block (or into it).
He continued
I think such a rule is absolutely required if exceptions are
implemented (at least with any sort of language-defined checks
like bounds checks or overflow checks). Otherwise, the code has
to be compiled in a strict order which would make most
optimizations impossible (and even dead code elimination).
*That* would be a problem!
If C++ exception handling has different effects, we definitely should
not copy it. It should serve primarily as a cautionary tale.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190724/053d3cf6/attachment.html>
More information about the J3
mailing list