lightning
[Top][All Lists]
Advanced

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

Re: Atomic operations


From: Paulo César Pereira de Andrade
Subject: Re: Atomic operations
Date: Tue, 16 Aug 2022 15:16:07 -0300

Em sáb., 13 de ago. de 2022 às 17:15, Marc Nieper-Wißkirchen
<marc.nieper+gnu@gmail.com> escreveu:
>
> Hi Paulo!
>
> Am Fr., 12. Aug. 2022 um 19:01 Uhr schrieb Paulo César Pereira de Andrade 
> <paulo.cesar.pereira.de.andrade@gmail.com>:
>
> [...]
>
>> > However, an instruction that can be used to embed data is of higher 
>> > priority for me.  Would this be implemented with the various is, ic, ... 
>> > macros in each jit-XXX-cpu.c?  After such an instruction, would the 
>> > alignment have to be adjusted, or is it done by lightning automatically on 
>> > those ports where instructions have to be aligned?
>>
>>   A good name for it could be jit_embed(void *data, jit_int32_t length);
>> And just memcpy the data verbatim. It would be required to keep a
>> copy of the argument until code is finally emitted.
>>   Should not embed more than jit_get_max_instr() bytes, that is basically
>> JIT_MAX_INSTR. Otherwise, it might end up writing code out of bounds.
>>   Alignment is not automatically done before emitting code, so, it should
>> keep code aligned.
>>   There is a, far more complicated than needed, example in jit_arm.c,
>> basically in _flush_consts() it does:
>>     jit_memcpy(_jitc->consts.data, _jitc->consts.values, _jitc->consts.size);
>>     _jit->pc.w += _jitc->consts.size;
>
>
> Thank you for this information.  Where do I find/how do I determine the 
> alignment that is needed?  In _flush_consts () in jit_arm.c, an alignment of 
> 32-bit seems to be maintained.

  It is to avoid issues when mixing thumb and arm instruction sets. It is
possible to have libraries in thumb mode, and jit in arm mode. Thumb
instructions can be 16 bit aligned.



reply via email to

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