# HG changeset patch # User Paul Boddie # Date 1216588586 -7200 # Node ID d4dd63e66f6cd71bc5de5d5d3aa5647e1c8278bb # Parent 3bf7d0e10c17985a78c1e725a729d17ff4a26f12 Introduced a separate StoreException instruction. Tidied the instruction docstrings to be more explicit about the instruction inputs. diff -r 3bf7d0e10c17 -r d4dd63e66f6c micropython/ast.py --- a/micropython/ast.py Sat Jul 19 21:26:47 2008 +0200 +++ b/micropython/ast.py Sun Jul 20 23:16:26 2008 +0200 @@ -310,7 +310,7 @@ "Return whether 'instruction' can use simple input from the current value." return isinstance(instruction, ( - StoreTemp, StoreFrame, StoreResult, RaiseException, # as the value being stored + StoreTemp, StoreFrame, StoreResult, StoreException, # as the value being stored LoadAddressContext, LoadAttr, LoadAttrIndex, # as the object being referenced StoreAttr, StoreAttrIndex # as the object being referenced )) @@ -780,6 +780,7 @@ self.new_op(LoadResult()) self.load_builtin("TypeError", node) + self.new_op(StoreException()) self.new_op(RaiseException()) self.set_label(continue_label) @@ -943,6 +944,7 @@ # Raise a TypeError. self.load_builtin("TypeError", node) + self.new_op(StoreException()) self.new_op(RaiseException()) self.set_label(end_label) @@ -1068,6 +1070,7 @@ self.set_label(type_error_label) self.load_builtin("TypeError", node) + self.new_op(StoreException()) self.new_op(RaiseException()) self.set_label(end_label) @@ -1439,6 +1442,7 @@ self.discard_temp(temp_arg) + self.new_op(StoreException()) self.new_op(RaiseException()) def visitReturn(self, node): @@ -1508,7 +1512,7 @@ # Unhandled exceptions. - self.new_op(LoadException()) + #self.new_op(LoadException()) self.new_op(RaiseException()) # Optional else clause. diff -r 3bf7d0e10c17 -r d4dd63e66f6c micropython/rsvp.py --- a/micropython/rsvp.py Sat Jul 19 21:26:47 2008 +0200 +++ b/micropython/rsvp.py Sun Jul 20 23:16:26 2008 +0200 @@ -152,31 +152,31 @@ # Access within an invocation frame. -class LoadName(FR): "Load the object from the given local attribute/variable." -class StoreName(FR): "Store the object in the given local attribute/variable." -class LoadTemp(Immediate): "Load the object from the given temporary location." -class StoreTemp(Immediate): "Store the object in the given temporary location." +class LoadName(FR): "Load the current value from the given local attribute/variable." +class StoreName(FR): "Store the source value into the given local attribute/variable." +class LoadTemp(Immediate): "Load the current value from the given temporary location." +class StoreTemp(Immediate): "Store the current value into the given temporary location." # Access to static data. -class LoadAddress(Address): "Load the object from the given fixed attribute address." -class StoreAddress(Address): "Store an object in the given fixed attribute address." -class LoadAddressContext(Address): "Load the object from the given fixed attribute address, changing the context." +class LoadAddress(Address): "Load the current value from the given fixed attribute address." +class StoreAddress(Address): "Store the source value into the given fixed attribute address." +class LoadAddressContext(Address): "Load the current value from the given fixed attribute address, making the current value the context." class MakeObject(Instruction): "Make a new object. There isn't a complementary DropObject." # Access to address-relative data. -class LoadAttr(AR): "Load the object from the given attribute." -class StoreAttr(AR): "Store an object in the given attribute." -class LoadAttrIndex(Immediate): "Load the object for the attribute with the given index." +class LoadAttr(AR): "Load into the current value the given attribute of the object referenced by the current value." +class StoreAttr(AR): "Store the source value into the given attribute of the object referenced by the current value." +class LoadAttrIndex(Immediate): "Load into the current value the attribute of the current value with the given index." class StoreAttrIndex(Immediate): "Store an object in the attribute with the given index." # Access to invocation frames in preparation. class MakeFrame(Instruction): "Make a new invocation frame." class DropFrame(Instruction): "Drop an invocation frame." -class StoreFrame(Immediate): "Store an argument for the parameter with the given position." -class StoreFrameIndex(Immediate): "Store an argument for the parameter with the given index." +class StoreFrame(Immediate): "Store the current value as an argument for the parameter with the given position." +class StoreFrameIndex(Immediate): "Store the current value as an argument for the parameter with the given index." class LoadCallable(Instruction): "Load the target of an invocation." class LoadContext(Instruction): "Load the context of an invocation." class CheckFrame(Instruction): "Check the invocation frame and context for the target." @@ -186,8 +186,8 @@ class JumpWithFrame(Instruction): "Jump, adopting the invocation frame, to the callable found as the current value." class Return(Instruction): "Return from a subprogram." -class LoadResult(Instruction): "Load a returned value." -class StoreResult(Instruction): "Store a value to be returned." +class LoadResult(Instruction): "Load into the current value a returned value." +class StoreResult(Instruction): "Store the current value as a value to be returned." # Branch-related instructions. @@ -198,10 +198,11 @@ # Exception-related instructions, using a special exception "register". class LoadException(Instruction): "Load the raised exception." -class RaiseException(Instruction): "Raise an exception." -class CheckException(Instruction): "Check the raised exception against another." +class StoreException(Instruction): "Store the current object in the exception register." +class RaiseException(Instruction): "Raise an exception, jumping to the active handler." class PushHandler(Address): "Push an exception handler onto the handler stack." class PopHandler(Instruction): "Pop an exception handler from the handler stack." +class CheckException(Instruction): "Check the raised exception against another." # General instructions.