Re: A83: calls


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

Re: A83: calls





>> >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

Well I put in that last "ret" myself to show the program's path and thats why
I put (first time), (second time) and even so, the program would never carry
out that "ret" anyway, but besides that, I think Not that it would all use
that one "ret" at the end to correctly go through all the calls and finally
exit from the program. The part I was emphasizing by this, is that after it
"ret"s  _From_ "call second_label" in there, the next line of code is "call
third_label" and that's where the loop is created... =P
																	--Jason K.


Follow-Ups: