Rewriting byte codes

Erik Corry erik at
Mon Apr 1 21:38:57 PST 2002

On Tue, Apr 02, 2002 at 02:48:36AM +0200, Artur Biesiadowski wrote:
> Erik Corry wrote:
>>> AFAIK, hotspot stops thread, replaces closest safe points with some trap 
>>> and let thread run until it hit one. Then it restores original 
>>> instruction and voila.
>> This sounds pretty ugly to me, since it involves lots of writing
>> to the instruction stream with corresponding I-cache flushes etc.
> I think that I-cache flush penalty is neglible compared to cost of 
> switching threads few times and performing gc. We are talking about 
> extra 20-50 cycles and gc will take about 1ms minimum (which gives about 
> 1000000 cycles).

The real cost of an I-cache flush isn't the 20-50 cycles it
takes to flush the I-cache, it's the time it takes to refill
it again from L2.  But it's probably the right tactic anyhow.
The alternative is to put checks in at every safe point so
you can just set a global instead of having to rewrite code.

Erik Corry erik at

More information about the kaffe mailing list