1.1 --- a/javaclass/bytecode.py Sun Jan 23 21:32:42 2005 +0100
1.2 +++ b/javaclass/bytecode.py Sun Jan 23 23:52:39 2005 +0100
1.3 @@ -37,6 +37,9 @@
1.4 # A stack of exception block handler pointers.
1.5 self.exception_handlers = []
1.6
1.7 + # A list of exception offset details.
1.8 + self.exception_offsets = []
1.9 +
1.10 # A dictionary mapping labels to jump instructions referencing such labels.
1.11 self.jumps = {}
1.12
1.13 @@ -294,10 +297,13 @@
1.14 current_exception_start = self.blocks.pop()
1.15 # Convert the "lazy" absolute value.
1.16 current_exception_target = self.exception_handlers.pop()
1.17 - target = current_exception_target.get_value()
1.18 - #print "*", current_exception_start, target
1.19 # NOTE: Using 3 as the assumed length of the SETUP_* instruction.
1.20 - self._rewrite_value(current_exception_start + 1, target - current_exception_start - 3)
1.21 + self.exception_offsets.append((current_exception_start + 1, current_exception_target, current_exception_start))
1.22 +
1.23 + def end_exceptions(self):
1.24 + for position, exception_target, exception_start in self.exception_offsets:
1.25 + #print "*", exception_start, exception_target.get_value()
1.26 + self._rewrite_value(position, exception_target.get_value() - exception_start - 3)
1.27
1.28 def start_handler(self, exc_name, class_file):
1.29
1.30 @@ -816,6 +822,10 @@
1.31
1.32 self.java_position = next_java_position
1.33
1.34 + # Tidy up exceptions.
1.35 +
1.36 + program.end_exceptions()
1.37 +
1.38 def process_bytecode(self, mnemonic, number_of_arguments, code, program):
1.39
1.40 """