equal
deleted
inserted
replaced
39 |
39 |
40 /** |
40 /** |
41 * True if a value can be stacked as the source type and unstacked as the |
41 * True if a value can be stacked as the source type and unstacked as the |
42 * destination type, without violating the JVM's type consistency. |
42 * destination type, without violating the JVM's type consistency. |
43 * |
43 * |
44 * @param call the type of a stacked value |
44 * @param src the type of a stacked value |
45 * @param recv the type by which we'd like to treat it |
45 * @param dst the type by which we'd like to treat it |
46 * @return whether the retyping can be done without motion or reformatting |
46 * @return whether the retyping can be done without motion or reformatting |
47 */ |
47 */ |
48 public static boolean isNullConversion(Class<?> src, Class<?> dst) { |
48 public static boolean isNullConversion(Class<?> src, Class<?> dst) { |
49 if (src == dst) return true; |
49 if (src == dst) return true; |
50 // Verifier allows any interface to be treated as Object: |
50 // Verifier allows any interface to be treated as Object: |
65 return dw.bitWidth() > sw.bitWidth(); |
65 return dw.bitWidth() > sw.bitWidth(); |
66 } |
66 } |
67 |
67 |
68 /** |
68 /** |
69 * Specialization of isNullConversion to reference types. |
69 * Specialization of isNullConversion to reference types. |
70 |
70 * @param src the type of a stacked value |
71 * @param call the type of a stacked value |
71 * @param dst the reference type by which we'd like to treat it |
72 * @param recv the reference type by which we'd like to treat it |
|
73 * @return whether the retyping can be done without a cast |
72 * @return whether the retyping can be done without a cast |
74 */ |
73 */ |
75 public static boolean isNullReferenceConversion(Class<?> src, Class<?> dst) { |
74 public static boolean isNullReferenceConversion(Class<?> src, Class<?> dst) { |
76 assert(!dst.isPrimitive()); |
75 assert(!dst.isPrimitive()); |
77 if (dst.isInterface()) return true; // verifier allows this |
76 if (dst.isInterface()) return true; // verifier allows this |