[all-commits] [llvm/llvm-project] a01f77: [ORC] Add MethodWrapperHandler utility for Wrapper...
lhames via All-commits
all-commits at lists.llvm.org
Wed Sep 15 21:50:35 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a01f772d19d53976a6d6e0eed684440e4f2cc9da
https://github.com/llvm/llvm-project/commit/a01f772d19d53976a6d6e0eed684440e4f2cc9da
Author: Lang Hames <lhames at gmail.com>
Date: 2021-09-16 (Thu, 16 Sep 2021)
Changed paths:
M llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
M llvm/unittests/ExecutionEngine/Orc/WrapperFunctionUtilsTest.cpp
Log Message:
-----------
[ORC] Add MethodWrapperHandler utility for WrapperFunction.
MethodWrapperHandler removes some of the boilerplate when writing wrapper
functions to wrap method calls. It can be used as a handler for wrapper
functions whose first argument is an ExecutorAddress: the address is cast to a
pointer of the given class type, then the given method function pointer is
called on that object pointer (passing the rest of the arguments).
E.g.
class MyClass {
public:
void myMethod(uint32_t, bool) { ... }
};
// SPS Method signature for myMethod -- note MyClass object address as first
// argument.
using SPSMyMethodWrapperSignature =
SPSTuple<SPSExecutorAddress, uint32_t, bool>;
// Wrapper function for myMethod.
WrapperFunctionResult
myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSMyMethodWrapperSignature>::handle(
ArgData, ArgSize, makeMethodWrapperHandler(&MyClass::myMethod));
}
More information about the All-commits
mailing list