Mad-Pascal
Mad-Pascal copied to clipboard
[Optimizing] Extra jump to the correct part of the procedure when there are sub-functions in the function/procedure.
We have such a piece of code:
Procedure myProc();
Function myFunc:byte;
Begin
{ some code here }
End;
Begin
{ some code here }
End;
Begin
myProc;
End.
Its result after compilation is more or less as follows:
{...}
.local MYPROC
jmp l_xxx
.local MYFUNC
{ assembled code of function myFunc() }
rts
.endl
l_xxx
{ assembled code of procedure myProc() }
rts
.endl
{...}
{ somewhere in code }
jmp MYPROC
{...}
Now, when the program makes a jump to the procedure myProc
it jumps to the address where jmp l_xxx
is, and not, to the address where the label l_xxx
points to.
I can understand that this JMP l_xxx
may be due to some compiler rules - forgive me, I don't know anything about compilers :) However, in time-critical situations, this jump is precious cycles.
My question. Would it be possible to optimise this phenomenon? :)
I'll honestly say that even during debugging, it can mess with my head a bit ;) and I won't mention the precious cycles ;)
3 cycles ? really ?
And you are asking for 3 cycles? Seriously? ;)
For my side, really really :D
Don't be like a clerk sending you back to a room where they have to tell you where to go.