On Jan 29, 3:47 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> I'm not sure about DalvikVM, but some compilers take advantage of
> 'final'.
>
> E.g.
> Final variables can be put in registers of the CPU without worrying
> that they may change during execution (constantly moving variable-
> values back and forth from memory to registers could be omitted for
> 'final' vars).


Variables that don't change can be given special treatment.  However,
any compiler worthy of the name will figure this out automatically --
it's one of the things that falls out of SSA form (see e.g.
http://en.wikipedia.org/wiki/Static_single_assignment_form ).
Explicitly labeling a local variable as "final" isn't necessary,
because any compiler sophisticated enough to make use of that fact
should also be sophisticated enough to figure it out for itself.

Using final on classes, methods, and fields is more interesting.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to