Replies: 1 comment
-
And a typical use case ... align CODE_ALIGNMENT
; just being silly, creating different sized functions
Grape MakeFunctions
mov eax,0
retn
Molly MakeFunctions
xor qword [rdx*8+rbx+0x1234567],-0x01234568
push 1
pop rax
retn
Jovial MakeFunctions
retn
Yellow MakeFunctions
mov ax,3
retn
Bacon MakeFunctions
mov al,4
retn
?End MakeFunctions
; functions can be called directly from internal code:
call Yellow
; or they can be called dynamically by index:
YELLOW := 3
fNum dd YELLOW
CallFunction [fNum] A nice additional feature would be to generate the indices/names file for external use. Support an index offset to allow [-128,127] values - for small Of course, it's possible to wrap this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes we want to expose a complex interface with reduced communication bandwidth - similar to a demultiplexer in electronics. Compilers typically generate a vector table of functions and expose a
this
pointer for external use. We also see this in COM, where an object pointer leads to a vector table of functions and object data.Another technique eliminates the vector table by spacing functions and just exporting function indices. This is particularly advantageous in assembly - given the control available. Here is a macro to simplify execution of this model.
Beta Was this translation helpful? Give feedback.
All reactions