Internal and External truncation conditions

Remi Forax forax at
Sun Feb 10 09:33:24 PST 2013

On 02/10/2013 03:42 PM, Doug Lea wrote:
> On 02/10/13 09:28, Remi Forax wrote:
>> yes, you can it's exactly what j.l.i.SwitchPoint does.
>> Note that we can't transform the whole pipeline to a method handle 
>> tree because
>> we have no loopy method handle now, but if we have that, you can 
>> create a method
>> handle tree corresponding to the pipeline and when the code will be 
>> JITed, with
>> the new lambda form it will, the check will disappear and if a user 
>> calls cancl,
>> the JITed code will be trashed and the execution will go back into the
>> interpreter that will do the check.
> Which amounts to, at best, an approximation of the rare-trap mechanics
> that would be used for explicit check in user code if the handles
> are fully resolved?

It depends what handles fully resolved mean and how the loopy method 
handle is implemented.
If it's implemented like OSR, there is a check when interpreting the 
code just before doing the backward jump. When JITed, there is no 
supplementary cost because the JIT has to insert a GC safepoint check (a 
read to a well known page) and the cancellation mechanism can re-use the 
very same read.

> -Doug


More information about the lambda-libs-spec-observers mailing list