Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 1,806
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: VM Byte code optimizations

@LMcRae: May I ask what video you watched?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: VM Byte code optimizations

 

http://developer.android.com/videos/index.html#v=ptjedOZEXPM

 

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

 

optimize

 

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?

Highlighted
Developer
Posts: 1,806
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: VM Byte code optimizations

Thank you.

 

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.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.