02-25-2010 10:22 AM
@LMcRae: May I ask what video you watched?
02-25-2010 10:34 AM
I thought I would do some test running javac myself and using javap to view the results. I came across this statement in the ant docs for javac
Indicates whether source should be compiled with optimization; defaults to off. Note that this flag is just ignored by Sun's javac starting with JDK 1.3 (since compile-time optimization is unnecessary).
After doing some tests it does seem to be ignored. Bear with me since the bulk of my experience is with game consoles and PCs, but the bytecode that javac emits is very different from the final rapc. The rapc version has all these isreal and iipush. I suspect that this has to do with a JVM that primarily uses ints so it has to flag values as being float?
02-25-2010 12:03 PM
OK so I was off a couple versions off with the javac optimization flag.
isreal would most likely determine if the floating point is Infinity or NaN. What it does with it I don't know.
You are correct with what iipush does; for example in your first post you have:
float xhalf = 0.5f * x;
If you take 0.5f and convert it to an IEEE format integer it produces 0x3F000000, in big-endian format (almost the standard for mobile devices) that is 0x0000003F, or to put in iipush format: iipush 00 00 00 3F, the same format that you have in the bytecode format.