javaclass

Changeset

131:b220be071851
2005-01-18 Paul Boddie raw files shortlog changelog graph Fixed signed constant loading in bipush and sipush.
bytecode.py (file)
     1.1 --- a/bytecode.py	Fri Jan 14 01:34:24 2005 +0100
     1.2 +++ b/bytecode.py	Tue Jan 18 17:17:13 2005 +0100
     1.3 @@ -634,6 +634,9 @@
     1.4      else:
     1.5          return value
     1.6  
     1.7 +def signed1(value):
     1.8 +    return signed(value, 0x80)
     1.9 +
    1.10  def signed2(value):
    1.11      return signed(value, 0x8000)
    1.12  
    1.13 @@ -1161,7 +1164,7 @@
    1.14      bastore = aastore
    1.15  
    1.16      def bipush(self, arguments, program):
    1.17 -        program.load_const(arguments[0])
    1.18 +        program.load_const(signed1(arguments[0]))
    1.19  
    1.20      caload = aaload
    1.21      castore = aastore
    1.22 @@ -1872,7 +1875,7 @@
    1.23      sastore = lastore
    1.24  
    1.25      def sipush(self, arguments, program):
    1.26 -        program.load_const((arguments[0] << 8) + arguments[1])
    1.27 +        program.load_const(signed2((arguments[0] << 8) + arguments[1]))
    1.28  
    1.29      def swap(self, arguments, program):
    1.30          program.rot_two()