A Tango Fibers question and a functional programming anecdote.

downs default_357-line at yahoo.de
Sun Oct 28 04:05:50 PDT 2007


Jarrett Billingsley wrote:
> I'm not knowledgeable, but you said ECX/EDX and it triggered something in my 
> brain.  Sure enough, according to the D 1.0 ABI, "EAX, ECX, EDX are scratch 
> registers and can be destroyed by a function."  So they don't have to be 
> preserved because you're allowed to do anything with them.
> 

Removed the push for ECX and EDX ( the others are used internally ). It
seems to work. Many thanks! :)

Still runs somewhat slower than Fibers, though. I can't imagine why.
Also, oddly, GDC doesn't allow me to push EBP in -O mode and D inline
assembly. Works in native GCC assembly. *Very* odd.

> As for nothing but ST(0-7) being preserved on Windows.. no clue.
> 

Aww. Still thanks for answering. I'm sure somebody will know it.

>>> ["Load ", "Prefetch ", "Prefetch "] /zip/ ([0, 1, 2] /map/ (&info
>> /rfix/ currentComic /fix/ (&subtract!(int) /fix/ currentStrip))) /map/
>> &concat!(string) /zip/ [&update, &prefetch /fix/ (currentStrip-1),
>> &prefetch /fix/ (currentStrip-2)] /map/ &Pool.addTask;
> 
>>> ["Load ", "Prefetch ", "Prefetch "] /zip/ (
>>>   [0, 1, 2] /map/ (
>>>     &info /rfix/ currentComic /fix/ (
>>>       &subtract!(int) /fix/ currentStrip
>>>       )
>>>     )
>>>   )
>>>   /map/ &concat!(string) /zip/ [
>>>     &update,
>>>     &prefetch /fix/ (currentStrip-1),
>>>     &prefetch /fix/ (currentStrip-2)
>>>   ] /map/ &Pool.addTask;
>>>
> 
> Why/how do you write code like this?  Is it some kind of thing in your brain 
> that makes you think about everything inside out?  Stop it.  Please.  For 
> all our brains' sakes. 
> 
> 

:evil cackle:
Braaaaaaaaaaaaaaains!


Actually, it started out with a piece of code that looked like this

>
> Pool.addTask("Load "~info(), &update);
> Pool.addTask("Prefetch "~info(), &update);
> Pool.addTask("Prefetch "~info(), &update);
>

Clearly, the addTask is redundant here.
I replaced it with

>
> [stuple("Load "~info(), &update), stuple...] /map/ &Pool.addTask;
>

Somebody in IRC pointed out that the stuple was redundant.
He must feel horrible for indirectly causing this.

>
> ["Load "~info, ...] /zip/ [&update, ...] /map/ &Pool.addTask;
>

Then I noticed the info calls were also redundant. It went kinda out of
control after that. You know the result. :)

 --downs



More information about the Digitalmars-d mailing list