Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/10/07 10:40
Read: times


 
#146831 - void-void function pointers need not be slow
Responding to: ???'s previous message
This depends on the used compiler of course, but especially function pointers to void-void functions need not be slow on an 8051. There are no parameters that need to be put on the stack and accessed there. Only the call needs to be a bit different but can be as small as the following:
    lcall Foo          ;normal call to function

    mov dpl,LOW(pFoo)  ;load dptr with function pointer
    mov dph,HIGH(pFoo)
    lcall Trampoline   ;call the trampoline to make it a call
    ...
Trampoline:
    clr a
    jmp @a+dptr

Even when there are parameters and a return value, as long as they can be passed in registers the performance penalty is very low.

Maarten

List of 11 messages in thread
TopicAuthorDate
C : pointers of function und pointers of pointers            01/01/70 00:00      
   Function pointers and stuff            01/01/70 00:00      
   Parameter passing in C            01/01/70 00:00      
   C FAQ            01/01/70 00:00      
   Function pointer demo            01/01/70 00:00      
      Heads up            01/01/70 00:00      
         True            01/01/70 00:00      
            I use function pointers all the time            01/01/70 00:00      
               void-void function pointers need not be slow            01/01/70 00:00      
                  correct, with a caveat            01/01/70 00:00      
   thank you all.            01/01/70 00:00      

Back to Subject List