class initialization check overhead

Jeff Sturm jsturm@one-point.com
Wed Oct 30 10:33:00 GMT 2002


On Wed, 30 Oct 2002 shudo@computer.org wrote:
> > This writes NOP instructions over the original call.  It did not prove
> > enormously helpful.  The real problem must be the memory and register
> > clobbers associated with a call, disrupting the instruction pipeline:
>
> There may be other problems including atomicity of the code patching.
> If there are threads just fetching around the code being patched,
> such threads can read inconsistent code just being modified.
> AFAIK, IBM JDK, Intel ORP and shuJIT take care of the consistency.
> Rewriting 1 byte is safe, but we have to give care to 2 byte
> rewriting, for example, by using XCHG instruction instead of MOV.

Good point.  I got away with it because that code is inherently
single-threaded.

My INT3 patch rewrites only one byte, but it makes the code undebuggable,
and probably only works on GNU/Linux for x86.

Anyway, I've satisifed myself now that these tricks aren't going to yield
any impressive speedup.  Kresten's suggestion is reasonable (and
portable).

Jeff




More information about the Java mailing list