1 class MixedJava { 2 native_boolean(boolean p0)3 native static boolean native_boolean(boolean p0); native_byte(byte p0)4 native static byte native_byte(byte p0); native_char(char p0)5 native static char native_char(char p0); native_short(short p0)6 native static short native_short(short p0); native_int(int p0)7 native static int native_int(int p0); native_long(long p0)8 native static long native_long(long p0); 9 test_boolean()10 public static void test_boolean(){ 11 boolean l0 = true; 12 // false 13 l0 = native_boolean(l0); 14 // true 15 l0 = native_boolean(l0); 16 // false 17 l0 = native_boolean(l0); 18 // true 19 l0 = native_boolean(l0); 20 break_(); 21 } 22 test_byte()23 public static void test_byte(){ 24 byte b0, b1, b2; 25 // (10 + 10) + 10 = 30 26 b0 = 10; 27 b1 = native_byte(b0); 28 b2 = (byte) (b0 + b1); 29 // (-128 + -128) + -128 = -128 mod 256 30 b0 = -128; 31 b1 = native_byte(b0); 32 b2 = (byte) (b0 + b1); 33 // (0 + 0) + 0 = 0 34 b0 = 0; 35 b1 = native_byte(b0); 36 b2 = (byte) (b0 + b1); 37 break_(); 38 } 39 test_char()40 public static void test_char(){ 41 char c0, c1, c2; 42 // (10 + 1) + 10 = 21 43 c0 = 10; 44 c1 = native_char(c0); 45 c2 = (char) (c0 + c1); 46 // (0x10000 - 1) + 1 = 0x10000 = 0 mod 2**16 47 c0 = 0x10000-1; 48 c1 = native_char(c0); 49 // (0 + 1) + 1 50 c0 = 0; 51 c1 = native_char(c0); 52 c2 = (char) (c0 + c1); 53 break_(); 54 } 55 test_short()56 public static void test_short(){ 57 short s0, s1, s2; 58 // (0x4000 / 4) = 0x1000 59 s0 = 0x4000; 60 s1 = native_short(s0); 61 // (-0x4000 / 4) = -0x1000 = 0x10fff 62 s0 = -0x4000; 63 s1 = native_short(s0); 64 // (32 / 4) + 3 = 11 65 s0 = 32; 66 s1 = native_short(s0); 67 s2 = (short) (s1 + 3); 68 // (0 / 4) = 0 69 s0 = 0; 70 s1 = native_short(s0); 71 break_(); 72 } 73 test_int()74 public static void test_int(){ 75 int i0, i1, i2; 76 // -10 77 i0 = 10; 78 i1 = native_int(i0); 79 // -0 80 i0 = 0; 81 i1 = native_int(i0); 82 // -0x7fffffff => 0x80000001 83 i0 = 0x7fffffff; 84 i1 = native_int(i0); 85 // -0x80000000 - 1 => 0x7fffffff 86 i0 = -2147483648; 87 i1 = i0 - 1; 88 break_(); 89 } 90 test_long()91 public static void test_long(){ 92 long l0, l1, l2; 93 // -3 + 2 = -1 => 0xffffffffffffffff 94 l0 = -3; 95 l1 = native_long(l0); 96 // -1 + 2 = 1 97 l0 = -1; 98 l1 = native_long(l0); 99 break_(); 100 } 101 102 /* 103 * MISC 104 */ 105 106 static { 107 System.loadLibrary("MixedJava"); 108 } 109 main(String[] args)110 public static void main(String[] args) throws Exception { 111 112 } 113 break_()114 public static void break_(){ 115 /* Add an additional basic block to the function, so the results 116 * of the last statements are not deleted when returning. 117 */ 118 } 119 120 } 121