This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [ast-optimizer-branch] simplifying C++
>>>>> "rth" == Richard Henderson <rth@redhat.com> writes:
rth> The difference would be: can you branch out of the "finally" part
rth> of the Java finally block?
Yes.
rth> Java has "synchronized" methods, which iirc grab a mutex
rth> associated with the object on entry to the function, and release
rth> it on exit. At heart this is just another cleanup-block with
rth> some specific function calls inside. However, this is
rth> interesting in that post-inlining we may be able to eliminate
rth> redundant locks.
Yes (you can also synchronize a block instead of the entire method).
Re-acquiring an already acquired lock is apparently a common operation
in Java. So this is a useful optimization to perform.
Tom