lua-users home
lua-l archive

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


Unfortunately, no sucess. I encapsulated basic blocks into functions
and add return statement instead of breaks. Exactly the same result.
As I am not sure of what to do next, please find here a dump of the
function I tried to compile. I just extracted it and made a
stand-alone file with it. Mike, if you have an idea of what is going
on.

Cheers,
Ben

On Wed, Jul 20, 2011 at 4:49 PM, Benjamin Segovia
<segovia.benjamin@gmail.com> wrote:
> Also, Robert, I will try your suggestion :-)
> I hope it will work ie replacing my hack (nested double loop) by the
> (function() ... end)() hack. Using a function for each loop body, I
> can replace breaks / continues by returns and remove one repeat ...
> until crap.
> I hope it will do the job :-)
> Otherwise, I will try to go through if/then/else code transform hell...
> So, also thanks for the suggestion :-)
>
> Ben
>
>
> On Wed, Jul 20, 2011 at 4:45 PM, Benjamin Segovia
> <segovia.benjamin@gmail.com> wrote:
>> Hmmm.
>> This is not really a if/then/else construct I need but really a
>> forward jump. Basically, it is a SIMD scatter/gather machine. Some
>> instructions inactivate lanes from the SIMD vector. In a block, if
>> your instruction currently deactivates all lanes, then you exit the
>> block, reset the mask you got before potentially modified by the
>> computations in the previous block. Then you check the current mask.
>> If it is still zero, then you exit the block ...
>>
>> Maybe to be more precise: the biggest issue basically is that I need
>> to emulate "continue" and "breaks" because the machine can execute
>> "continue" and "break" instructions natively.
>> Actually "continue" instructions are really the big problem, since
>> there is no continue in lua.
>>
>> Right now, I used a two-nested-loop hack to handle continue:
>>
>> repeat
>> local a_break_was_used_for_a_continue = false
>> repeat
>>
>> -- .... "CONTINUE"  instruction generates ->
>> a_break_was_used_for_a_continue = true
>> break
>> -- end of continue
>>
>> -- .... "BREAK" instruction generates ->
>> a_break_was_used_for_a_continue = false
>> break
>> -- end of break
>>
>> until true -- <- this is fake loop to early branch out (used for
>> breaks and continues)
>> if not a_break_was_used_for_a_continue then beak end
>> until false -- <- this is a real loop. Youhou!
>>
>> As you can see, the technique is easy to implement since regardless
>> where I am in the nested branches (like for example, deeply nested in
>> IFs), I can early out.
>> I am afraid that using only if/then/else to mask the code may be a
>> more serious code transform. Something similar to unstructured
>> branches to structures branches transform... ie not that easy to do
>> :-)
>>
>> I will try other things today.
>>
>> Thank you very much for your help
>>
>> Ben
>>
>>
>>
>> On Wed, Jul 20, 2011 at 2:52 PM, Mike Pall <mikelu-1107@mike.de> wrote:
>>> David Kastrup wrote:
>>>> Mike Pall <mikelu-1107@mike.de> writes:
>>>> > I do not see how that's different from doing it with a while loop.
>>>> > You'd need to nest them and close them with 'end' as well.
>>>>
>>>> No, you need just a single loop at a time that can deal with dozens of
>>>> "break" in there.
>>>
>>> Sure. But is that a realistic use case? If the VLIW code is
>>> generated from typical code in a high-level language, I doubt
>>> you'd see more than a handful of these. Nesting (say) 100
>>> if/then/else is no problem.
>>>
>>> --Mike
>>>
>>>
>>
>

Attachment: no_compiled_trace.tgz
Description: GNU Zip compressed data