Thu, 30 Jul 2009 10:29:53 +0100
6827648: Extremely slow compilation time for visitor pattern code + generics
Summary: Javac unnecessarily recomputates type-substitutions multiple times
Reviewed-by: jjg
duke@1 | 1 | /** |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 4759494 4986256 |
duke@1 | 4 | * @compile/ref=DivZero.noLint.out -XDstdout -XDrawDiagnostics DivZero.java |
duke@1 | 5 | * @compile/ref=DivZero.lint.out -XDstdout -Xlint:divzero -XDrawDiagnostics DivZero.java |
duke@1 | 6 | * @compile/ref=DivZero.lint.out -XDstdout -Xlint:all,-path -XDrawDiagnostics DivZero.java |
duke@1 | 7 | */ |
duke@1 | 8 | |
duke@1 | 9 | class DivZero |
duke@1 | 10 | { |
duke@1 | 11 | public static final int ONE = 1; |
duke@1 | 12 | |
duke@1 | 13 | public int i1 = 1 / 0; |
duke@1 | 14 | public static final int i2 = 1 / 0; |
duke@1 | 15 | |
duke@1 | 16 | public int i3 = 1 % 0; |
duke@1 | 17 | public static final int i4 = 1 % 0; |
duke@1 | 18 | |
duke@1 | 19 | public static final int i5 = 1 / (1 - 1); |
duke@1 | 20 | public static final int i6 = 1 / (ONE - 1); |
duke@1 | 21 | public static final int i7 = 1 / (ONE - ONE); |
duke@1 | 22 | |
duke@1 | 23 | public static final int i8 = 1 % (1 - 1); |
duke@1 | 24 | public static final int i9 = 1 % (ONE - 1); |
duke@1 | 25 | public static final int i10 = 1 % (ONE - ONE); |
duke@1 | 26 | |
duke@1 | 27 | public static final long ONEL = 1L; |
duke@1 | 28 | |
duke@1 | 29 | public long l1 = 1L / 0L; |
duke@1 | 30 | public static final long l2 = 1L / 0L; |
duke@1 | 31 | |
duke@1 | 32 | public long l3 = 1L % 0L; |
duke@1 | 33 | public static final long l4 = 1L % 0L; |
duke@1 | 34 | |
duke@1 | 35 | public static final long l5 = 1L / (1L - 1L); |
duke@1 | 36 | public static final long l6 = 1L / (ONEL - 1L); |
duke@1 | 37 | public static final long l7 = 1L / (ONEL - ONEL); |
duke@1 | 38 | |
duke@1 | 39 | public static final long l8 = 1L % (1L - 1L); |
duke@1 | 40 | public static final long l9 = 1L % (ONEL - 1L); |
duke@1 | 41 | public static final long l10 = 1L % (ONEL - ONEL); |
duke@1 | 42 | |
duke@1 | 43 | |
duke@1 | 44 | static void m() { |
duke@1 | 45 | int mi1 = 1 / 0; |
duke@1 | 46 | int mi2 = 1 % 0; |
duke@1 | 47 | |
duke@1 | 48 | mi1 /= 0; |
duke@1 | 49 | mi1 %= 0; |
duke@1 | 50 | |
duke@1 | 51 | long ml1 = 1L / 0L; |
duke@1 | 52 | long ml2 = 1L % 0L; |
duke@1 | 53 | |
duke@1 | 54 | ml1 /= 0L; |
duke@1 | 55 | ml1 %= 0L; |
duke@1 | 56 | } |
duke@1 | 57 | } |
duke@1 | 58 | |
duke@1 | 59 | @SuppressWarnings("divzero") |
duke@1 | 60 | class DivZero2 |
duke@1 | 61 | { |
duke@1 | 62 | public static final int ONE = 1; |
duke@1 | 63 | |
duke@1 | 64 | public int i1 = 1 / 0; |
duke@1 | 65 | public static final int i2 = 1 / 0; |
duke@1 | 66 | |
duke@1 | 67 | public int i3 = 1 % 0; |
duke@1 | 68 | public static final int i4 = 1 % 0; |
duke@1 | 69 | |
duke@1 | 70 | public static final int i5 = 1 / (1 - 1); |
duke@1 | 71 | public static final int i6 = 1 / (ONE - 1); |
duke@1 | 72 | public static final int i7 = 1 / (ONE - ONE); |
duke@1 | 73 | |
duke@1 | 74 | public static final int i8 = 1 % (1 - 1); |
duke@1 | 75 | public static final int i9 = 1 % (ONE - 1); |
duke@1 | 76 | public static final int i10 = 1 % (ONE - ONE); |
duke@1 | 77 | |
duke@1 | 78 | public static final long ONEL = 1L; |
duke@1 | 79 | |
duke@1 | 80 | public long l1 = 1L / 0L; |
duke@1 | 81 | public static final long l2 = 1L / 0L; |
duke@1 | 82 | |
duke@1 | 83 | public long l3 = 1L % 0L; |
duke@1 | 84 | public static final long l4 = 1L % 0L; |
duke@1 | 85 | |
duke@1 | 86 | public static final long l5 = 1L / (1L - 1L); |
duke@1 | 87 | public static final long l6 = 1L / (ONEL - 1L); |
duke@1 | 88 | public static final long l7 = 1L / (ONEL - ONEL); |
duke@1 | 89 | |
duke@1 | 90 | public static final long l8 = 1L % (1L - 1L); |
duke@1 | 91 | public static final long l9 = 1L % (ONEL - 1L); |
duke@1 | 92 | public static final long l10 = 1L % (ONEL - ONEL); |
duke@1 | 93 | |
duke@1 | 94 | |
duke@1 | 95 | static void m() { |
duke@1 | 96 | int mi1 = 1 / 0; |
duke@1 | 97 | int mi2 = 1 % 0; |
duke@1 | 98 | |
duke@1 | 99 | mi1 /= 0; |
duke@1 | 100 | mi1 %= 0; |
duke@1 | 101 | |
duke@1 | 102 | long ml1 = 1L / 0L; |
duke@1 | 103 | long ml2 = 1L % 0L; |
duke@1 | 104 | |
duke@1 | 105 | ml1 /= 0L; |
duke@1 | 106 | ml1 %= 0L; |
duke@1 | 107 | } |
duke@1 | 108 | } |
duke@1 | 109 | |
duke@1 | 110 | class DivZero3 |
duke@1 | 111 | { |
duke@1 | 112 | @SuppressWarnings("divzero") |
duke@1 | 113 | public int i1 = 1 / 0; |
duke@1 | 114 | @SuppressWarnings("divzero") |
duke@1 | 115 | public static final int i2 = 1 / 0; |
duke@1 | 116 | |
duke@1 | 117 | @SuppressWarnings("divzero") |
duke@1 | 118 | public int i3 = 1 % 0; |
duke@1 | 119 | @SuppressWarnings("divzero") |
duke@1 | 120 | public static final int i4 = 1 % 0; |
duke@1 | 121 | |
duke@1 | 122 | @SuppressWarnings("divzero") |
duke@1 | 123 | public long l1 = 1L / 0L; |
duke@1 | 124 | @SuppressWarnings("divzero") |
duke@1 | 125 | public static final long l2 = 1L / 0L; |
duke@1 | 126 | |
duke@1 | 127 | @SuppressWarnings("divzero") |
duke@1 | 128 | public long l3 = 1L % 0L; |
duke@1 | 129 | @SuppressWarnings("divzero") |
duke@1 | 130 | public static final long l4 = 1L % 0L; |
duke@1 | 131 | |
duke@1 | 132 | |
duke@1 | 133 | @SuppressWarnings("divzero") |
duke@1 | 134 | static void m() { |
duke@1 | 135 | int mi1 = 1 / 0; |
duke@1 | 136 | int mi2 = 1 % 0; |
duke@1 | 137 | |
duke@1 | 138 | mi1 /= 0; |
duke@1 | 139 | mi1 %= 0; |
duke@1 | 140 | |
duke@1 | 141 | long ml1 = 1L / 0L; |
duke@1 | 142 | long ml2 = 1L % 0L; |
duke@1 | 143 | |
duke@1 | 144 | ml1 /= 0L; |
duke@1 | 145 | ml1 %= 0L; |
duke@1 | 146 | } |
duke@1 | 147 | } |