1.1 --- a/javaclass/bytecode.py Sun Feb 13 19:10:25 2005 +0100
1.2 +++ b/javaclass/bytecode.py Sun Feb 13 22:39:06 2005 +0100
1.3 @@ -862,9 +862,7 @@
1.4 """
1.5
1.6 if number_of_arguments is not None:
1.7 - arguments = []
1.8 - for j in range(0, number_of_arguments):
1.9 - arguments.append(ord(code[self.java_position + 1 + j]))
1.10 + arguments = [ord(b) for b in code[self.java_position + 1:self.java_position + 1 + number_of_arguments]]
1.11
1.12 # Call the handler.
1.13
1.14 @@ -1101,8 +1099,8 @@
1.15 d, r = divmod(self.java_position + 1, 4)
1.16 to_boundary = (4 - r) % 4
1.17 code = code[to_boundary:]
1.18 - default = classfile.u4(code[0:4])
1.19 - npairs = classfile.u4(code[4:8])
1.20 + default = classfile.s4(code[0:4])
1.21 + npairs = classfile.s4(code[4:8])
1.22 print default, npairs
1.23 return to_boundary + 8 + npairs * 8
1.24
1.25 @@ -1111,9 +1109,9 @@
1.26 d, r = divmod(self.java_position + 1, 4)
1.27 to_boundary = (4 - r) % 4
1.28 code = code[to_boundary:]
1.29 - default = classfile.u4(code[0:4])
1.30 - low = classfile.u4(code[4:8])
1.31 - high = classfile.u4(code[8:12])
1.32 + default = classfile.s4(code[0:4])
1.33 + low = classfile.s4(code[4:8])
1.34 + high = classfile.s4(code[8:12])
1.35 print default, low, high
1.36 return to_boundary + 12 + (high - low + 1) * 4
1.37
1.38 @@ -1125,6 +1123,8 @@
1.39 print "(setup_finally %s)" % target
1.40 def end_exception(self):
1.41 print "(end_exception)"
1.42 + def end_exceptions(self):
1.43 + print "(end_exceptions)"
1.44 def start_handler(self, exc_name, class_file):
1.45 print "(start_handler %s)" % exc_name
1.46 def pop_block(self):
1.47 @@ -1796,8 +1796,8 @@
1.48 # Get the pertinent arguments.
1.49
1.50 code = code[to_boundary:]
1.51 - default = classfile.u4(code[0:4])
1.52 - npairs = classfile.u4(code[4:8])
1.53 + default = classfile.s4(code[0:4])
1.54 + npairs = classfile.s4(code[4:8])
1.55
1.56 # Process the pairs.
1.57 # NOTE: This is not the most optimal implementation.
1.58 @@ -1820,7 +1820,7 @@
1.59 program.start_label("end")
1.60 program.pop_top() # Stack: key
1.61 # Update the index.
1.62 - pair_index += 4
1.63 + pair_index += 8
1.64
1.65 # Generate the default.
1.66
1.67 @@ -2038,7 +2038,12 @@
1.68
1.69 translator = BytecodeTranslator(self.class_file)
1.70 writer = BytecodeWriter()
1.71 - translator.process(method, writer)
1.72 + try:
1.73 + translator.process(method, writer)
1.74 + except:
1.75 + print "Translation error in", str(self.class_file.this_class.get_name()), str(method.get_name())
1.76 + disassemble(self.class_file, method)
1.77 + raise
1.78 return translator, writer
1.79
1.80 def make_method(self, real_method_name, methods, global_names):
2.1 --- a/javaclass/classhook.py Sun Feb 13 19:10:25 2005 +0100
2.2 +++ b/javaclass/classhook.py Sun Feb 13 22:39:06 2005 +0100
2.3 @@ -234,6 +234,7 @@
2.4 find_module method produces such a list.
2.5 """
2.6
2.7 + #print "load_module", name
2.8 module = self._not_java_module(name, stuff)
2.9 if module is not None:
2.10 return module
2.11 @@ -302,6 +303,7 @@
2.12 for class_filename in self.hooks.matching(filename, os.extsep + "class", archive):
2.13 s = self.hooks.read(class_filename, archive)
2.14 class_file = classfile.ClassFile(s)
2.15 + #print "Translating", str(class_file.this_class.get_name())
2.16 translator = bytecode.ClassTranslator(class_file)
2.17 external_names += translator.process(global_names)
2.18