Nп/п : 24 из 93
 От   : none) (albert                       2:5075/128        17 июл 23 19:37:58
 К    : none) (albert                                         17 июл 23 20:54:12
 Тема : Re: tail call optimisation, lisp implemented in Forth
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
4fa4ffc1
@REPLY:
93b6a1f6
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:

@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
In article ,
none) (albert  wrote:
>I`m following the instructions of mal (clojure)
>    https://github.com/kanaka/mal
>
>The instruction in mal step 5 :
>Several of the special forms that you have defined in EVAL end up
>calling back into EVAL. For those forms that call EVAL as the last
>thing that they do before returning (tail call) you will just loop
>back to the beginning of eval rather than calling it again.
>

>Nesting is accomplished by storing SI in the return stack
>pointed to by the EBP register.
>These are the instructions.
>
>DOCOL:  LEA     EBP,[EBP - (CW*(1))]                     ; *
>        MOV     [EBP],ESI                                ; *
>         MOV     ESI,[EAX+(CW*(D_HOFFSET - C_HOFFSET))]  ; *
>        LODSD                  ; NEXT
>        JMP     DWORD[EAX]
>
>Nesting is  marked with *.

This must be, of course:
DOCOL:  LEA     EBP,[EBP - (CW*(1))]                     ; *
        MOV     [EBP],ESI                                ; *
        MOV     ESI,[EAX+(CW*(D_HOFFSET - C_HOFFSET))]
        LODSD                  ; NEXT
        JMP     DWORD[EAX]

(EAX points to the header and ESI must be loaded anew.)

>
>How cool is that!
>
>Groetjes Albert
-- 
Don`t praise the day before the evening. One swallow doesn`t make spring.
You must not say "hey" before you have crossed the bridge. Don`t sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning.            - the Wise from Antrim -
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: KPN B.V. (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх