full-stack-hello
full-stack-hello copied to clipboard
Exception handling mechanism discussion
At the moment, DIV and MOD considers divide-by-zero (I'll call it as DBZ from now on) as unimplemented.
We are in need of an exception handling mechanism when DBZ happens.
I can think of a few ways now:
- Add a (typical) exception handling callback (like ISR) like general CPUs do.
- Add a global flag that can be set when DBZ happens and code can explicitly check the flag after a DIV or MOD operation is performed.
The considerations that I can think of by now. They are tradeoffs during most of the time.
A. Speed B. VM Complexity C. Support of higher level semantics, such as C++ Exception