Integer widening operators: some preliminary statistics.
Ruslan Shevchenko
rssh at gradsoft.com.ua
Thu Apr 23 22:42:56 PDT 2009
>
Results for open JDK:
all bit ands : 6853
widening operator (semantics) : 1098
widening operator (syntax) : 1959
(i.e. near 1/6 or 1/7 of all bit-ands)
all catchs : 8404
all ifs : 28494
all integer literals : 124355
big integer literals(undescores) : 4066
byte literal : 1454
catch in finally : 103
elvis : 877
instanceof switch : 318
loop with remove : 62
multi catch : 411
object switch : 1363
rethrow clause : 3264
string in switch : 445
> Good day, Bruce.
>
> Some data about integer widening operator:
> http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000906.html
>
> 3 checks was implemented:
> 1. model check for expression like ($x && 0xff) or (0xff & $x) where $x
> must have a type byte (original request). This check named as "widening
> operator (semantics)"
>
> 2. syntax check for expression like ($x && 0xff) or (0xff & $x) where $x
> can have any type. This check named as "widening operator (syntax)"
>
> Example of second but not first:
> <pre>
> public static short reverseBytes(short s) {
> return (short) (((s & 0xff) << 8) | ((s & 0xff00) >> 8));
> }
> </pre>
> <pre>
> byte[] nounce = new byte[24];
> for (int i=0;i<8;i++)
> {
> nounce[i]=(byte)(ts&0xff);
> ts=ts>>8;
> nounce[8+i]=(byte)(sk&0xff);
> sk=sk>>8;
> }
> </pre>
>
> 3. count of all expressions with bitwise and. (names as all bit ands)
>
> Than, results for jetty was:
>
> all bit ands : 121
> widening operator (semantics) : 10
> widening operator (syntax) : 20
>
> // some other counts, to compare with:
> rethrow clause : 34
> string in switch : 19
>
> hibernate does not use bitwise and at all.
> gwt-users have 2 entries of syntax pattern (actually this is reverseBytes
> function).
>
> Result for jdk I will publish tomorrow, when ones will be ready.
>
> It was preliminary data (one from 3 packages use 'bitwise and') more
> statistics and some analysis will be available throught few days (with
> data about for-s and ERP in dataset).
>
> Best Regards !
>
>
>
>
>
>
>
More information about the coin-dev
mailing list