On Sep 5, 8:38 pm, msg555 <
msg...@gmail.com> wrote:
> It seems there is room for a post processing bytecode optimizing tool
> if one hasn't been made. Any thoughts?
Try running dx with "--no-locals --positions=important", or pass in
code that was built without "-g". If there's no debug info to
preserve, the dx optimizer is a bit more aggressive about crunching
stuff out.
public class Ack {
public void splat() {
int i;
i = 1; i = 1; i = 1; i = 1; i = 1;
i = 1; i = 1; i = 1; i = 1; i = 1;
}
}
With "javac -g":
000110: 1210 | 0000: const/4 v0, #int 1 // #1
000112: 1210 | 0001: const/4 v0, #int 1 // #1
000114: 1210 | 0002: const/4 v0, #int 1 // #1
000116: 1210 | 0003: const/4 v0, #int 1 // #1
000118: 1210 | 0004: const/4 v0, #int 1 // #1
00011a: 1210 | 0005: const/4 v0, #int 1 // #1
00011c: 1210 | 0006: const/4 v0, #int 1 // #1
00011e: 1210 | 0007: const/4 v0, #int 1 // #1
000120: 1210 | 0008: const/4 v0, #int 1 // #1
000122: 1210 | 0009: const/4 v0, #int 1 // #1
000124: 0e00 | 000a: return-void
Without "-g":
000100: 0e00 | 0000: return-void
> Also, why was it necessary to add access$xxx methods? Is this
> something that happens at javac time or dx time? Does it somehow make
> validation easier if inner classes aren't accessing members of their
> parents directly? (are there other cases where this is used?)
That's a javac thing. Inner and outer classes have no special
relationship once the compiler is done, but the compiler gives them
special treatment for access to private methods and fields. The
compiler generates synthetic access methods to get at the private
bits.