by Barb Knox <see@[EMAIL PROTECTED]
>
Sep 13, 2007 at 08:33 PM
In article <Hl0Gi.6837$cy3.591@[EMAIL PROTECTED]
>,
Joshua Cranmer <Pidgeot18@[EMAIL PROTECTED]
> wrote:
> I have noticed a few times that Java implements synchronized blocks
thusly:
>
> aload 4
> dup
> astore 5
> monitorenter
> [ various instructions ]
> aload 5
> monitorexit
>
> Why does it duplicate the variable when running synchronized blocks?
Because you might have code like this:
synchronized (something) {
...
something := somethingElse;
...
}
--
---------------------------
| BBB b \ Barbara at LivingHistory stop co stop uk
| B B aa rrr b |
| BBB a a r bbb | Quidquid latine dictum sit,
| B B a a r b b | altum viditur.
| BBB aa a r bbb |
-----------------------------