Displaying 1 result from an estimated 1 matches for "thunk4095".
2014 Nov 29
3
[LLVMdev] Frontend: How to use Member to Function Pointer as callbacks
...s say 4096) -- it's
not per function signature, but global
- Define i8* thunkTargets[4096]
- Define i8* ThunkIdToFuncPtr[4096]
- Define 4096 funcs (not even sure how to do that with LLVM, might need to
emit assembly?)
Thunk0: jmp thunkTargets[0];
Thunk1: jmp thunkTargets[1];
...
Thunk4095: jmp thunkTargets[4095];
- When I call a C function from C# with a callback, what happens is:
- Find an unused slot in this thunk table (X)
- Register C# member to function pointer in ThunkIdToFuncPtr[X]
- Replace thunkTargets[X] with pointer address to
"RedirectMethodFuncWithIntParamet...