How are exceptions actually implemented in assembly?

hungjunglu hungjunglu at yahoo.com
Wed Jan 23 11:58:57 EST 2002


Ha! Searching in Google with the keywords: "c++ exception handling 
performance impact" yields plenty of hits. :)

So, exception handling indeed uses propagation of calling stacks all 
the way down to the smallest code blocks. Hence, bloating up code 
size, and slow down execution speed.

Exception handling then indeed is also an "aspect", then. (a) Before 
executing the block (this is the "before advice"): it puts an extra 
item in the calling stack, so if there is an exception, the code 
block can assign a value to this stack item. (b) if there is an 
exception throwing, the C++ code line assigns a value to the 
exception item, and returns. (yikes... code bloating here, too.) (c) 
After executing the block (this is the "after advice"), we check the 
exception item in the stack, if not good, we handle it appropriately 
by calling the exception handling code block.

OK, fair enough. Exception handling is an "aspect". :)

Hung Jung






More information about the Python-list mailing list