help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [PATCH 2/2] jit: Resume the method _after_ the inte


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [PATCH 2/2] jit: Resume the method _after_ the interrupt check
Date: Tue, 07 Jan 2014 11:49:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 03/01/2014 20:15, Holger Hans Peter Freyther ha scritto:
> On Mon, Dec 23, 2013 at 10:32:41PM +0100, Holger Hans Peter Freyther wrote:
> 
> Good Evening,
> 
>>>  st> a := 0. p := [a := 3] newProcess
>>>
>>> The code does not get across Dictionary>>findIndex: (Dictionary.st:588).
>>
>>
>> translate_method()
>> ...
>>             if (!lbl_define (*this_label))
>>             {
>>               define_ip_map_entry (bp - bc);
>>               emit_interrupt_check (JIT_NOREG, bp - bc);
>>             }
>>
>>
>> Dictionary>>#findIndex: 
> 
>>
>> An instance of MethodContext
>>   parent: Dictionary(HashedCollection)>>findIndexOrNil: (HashedColl.st:359)
>>   nativeIP: 0
> 
> 
> ^^^^ this is the hint. the returned native_ip was not satisfying
> the IS_INT test. This means I had to move the jit_align(2) _after_
> the ip storing.

More precisely, just before the jit_get_label().

> I think this code can be quite fragile when porting
> to other architectures?!

Most other architectures (all other architectures supported by
lightning, at least) do not have instructions that aren't naturally
aligned.  That is, 4-byte instructions are 4-aligned.

It can break only on x86, as you experienced, but jit_align() takes care
of it.

I guess Thumb would be a problem, since the length of the instruction is
encoded in the bottom bit of PC: bit 0 = 0 means the 4-byte ARM
instruction set, bit 0 = 1 means the 2-byte Thumb instruction set.
GET_CONTEXT_IP and GET_NATIVE_IP would not work in that case.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]