Re: A83: calls


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

Re: A83: calls




Jkhum98@aol.com wrote:
> 
> >Actually, that piece of code would work just fine. Only, if some more
> >instructions were inserted there would be a possibility that they executed
> >twice or something like that. But this piece of code would work fine. =)
> >
> >Linus
> 
> Your right that it would need some more code to be useful (even though its an
> exmaple) but _Actually_ wouldnt the calc just go into an endless loop like
> this...?
>                                                                                                                         --Jason K.
> 
> (I hope all the spaces and tabs I did come out right on the screen ;)
> 
>      first_label:
>                 call second_label
> |-->    (second return spot)
> |                |
> |               V
> |     second_label:
> |               call third label        ---     |
> |  |--->(first return spot)     |
> |  |             |                                      |
> |  |            V                                       |
> |  |    third_label:    <-----  |
> |  |----        ret      (first time)
> |-----  ret  (second time)

That last ret wasnt in his code..    but even with it it would not be
endless..
that last ret will never be executed.  he will ret three times  on the
same ret back to the respective returnspots, 
and then the fourth time it would end the program...
like this:

calls second -> calls third ->ret to after call third -> rets to after
call second -> calls third -> rets to after call third -> ret and end
program.

everytime on the same ret..

//Olle


References: