mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[ORC] Switch from uint8_t to char buffers for TargetProcessControl::runWrapper.
This matches WrapperFunctionResult's char buffer, cutting down on the number of pointer casts needed.
This commit is contained in:
parent
20998194c9
commit
9d62b78ea1
@ -356,7 +356,7 @@ public:
|
||||
|
||||
Expected<shared::WrapperFunctionResult>
|
||||
runWrapper(JITTargetAddress WrapperFnAddr,
|
||||
ArrayRef<uint8_t> ArgBuffer) override {
|
||||
ArrayRef<char> ArgBuffer) override {
|
||||
DEBUG_WITH_TYPE("orc", {
|
||||
dbgs() << "Running as wrapper function "
|
||||
<< formatv("{0:x16}", WrapperFnAddr) << " with "
|
||||
|
@ -58,6 +58,11 @@ public:
|
||||
static const char *getName() { return "void"; }
|
||||
};
|
||||
|
||||
template <> class SerializationTypeName<char> {
|
||||
public:
|
||||
static const char *getName() { return "char"; }
|
||||
};
|
||||
|
||||
template <> class SerializationTypeName<int8_t> {
|
||||
public:
|
||||
static const char *getName() { return "int8_t"; }
|
||||
|
@ -358,7 +358,7 @@ public:
|
||||
class RunWrapper
|
||||
: public shared::RPCFunction<RunWrapper,
|
||||
shared::WrapperFunctionResult(
|
||||
JITTargetAddress, std::vector<uint8_t>)> {
|
||||
JITTargetAddress, std::vector<char>)> {
|
||||
public:
|
||||
static const char *getName() { return "RunWrapper"; }
|
||||
};
|
||||
@ -580,14 +580,12 @@ private:
|
||||
ProgramNameOverride);
|
||||
}
|
||||
|
||||
shared::WrapperFunctionResult
|
||||
runWrapper(JITTargetAddress WrapperFnAddr,
|
||||
const std::vector<uint8_t> &ArgBuffer) {
|
||||
shared::WrapperFunctionResult runWrapper(JITTargetAddress WrapperFnAddr,
|
||||
const std::vector<char> &ArgBuffer) {
|
||||
using WrapperFnTy = shared::detail::CWrapperFunctionResult (*)(
|
||||
const char *Data, uint64_t Size);
|
||||
auto *WrapperFn = jitTargetAddressToFunction<WrapperFnTy>(WrapperFnAddr);
|
||||
return WrapperFn(reinterpret_cast<const char *>(ArgBuffer.data()),
|
||||
ArgBuffer.size());
|
||||
return WrapperFn(ArgBuffer.data(), ArgBuffer.size());
|
||||
}
|
||||
|
||||
void closeConnection() { Finished = true; }
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
/// \endcode{.cpp}
|
||||
///
|
||||
virtual Expected<shared::WrapperFunctionResult>
|
||||
runWrapper(JITTargetAddress WrapperFnAddr, ArrayRef<uint8_t> ArgBuffer) = 0;
|
||||
runWrapper(JITTargetAddress WrapperFnAddr, ArrayRef<char> ArgBuffer) = 0;
|
||||
|
||||
/// Disconnect from the target process.
|
||||
///
|
||||
@ -170,9 +170,7 @@ public:
|
||||
: TPC(TPC), WrapperFnAddr(WrapperFnAddr) {}
|
||||
Expected<shared::WrapperFunctionResult> operator()(const char *ArgData,
|
||||
size_t ArgSize) const {
|
||||
return TPC.runWrapper(
|
||||
WrapperFnAddr,
|
||||
ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(ArgData), ArgSize));
|
||||
return TPC.runWrapper(WrapperFnAddr, ArrayRef<char>(ArgData, ArgSize));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -204,8 +202,7 @@ public:
|
||||
ArrayRef<std::string> Args) override;
|
||||
|
||||
Expected<shared::WrapperFunctionResult>
|
||||
runWrapper(JITTargetAddress WrapperFnAddr,
|
||||
ArrayRef<uint8_t> ArgBuffer) override;
|
||||
runWrapper(JITTargetAddress WrapperFnAddr, ArrayRef<char> ArgBuffer) override;
|
||||
|
||||
Error disconnect() override;
|
||||
|
||||
|
@ -104,12 +104,11 @@ SelfTargetProcessControl::runAsMain(JITTargetAddress MainFnAddr,
|
||||
|
||||
Expected<shared::WrapperFunctionResult>
|
||||
SelfTargetProcessControl::runWrapper(JITTargetAddress WrapperFnAddr,
|
||||
ArrayRef<uint8_t> ArgBuffer) {
|
||||
ArrayRef<char> ArgBuffer) {
|
||||
using WrapperFnTy = shared::detail::CWrapperFunctionResult (*)(
|
||||
const char *Data, uint64_t Size);
|
||||
auto *WrapperFn = jitTargetAddressToFunction<WrapperFnTy>(WrapperFnAddr);
|
||||
return WrapperFn(reinterpret_cast<const char *>(ArgBuffer.data()),
|
||||
ArgBuffer.size());
|
||||
return WrapperFn(ArgBuffer.data(), ArgBuffer.size());
|
||||
}
|
||||
|
||||
Error SelfTargetProcessControl::disconnect() { return Error::success(); }
|
||||
|
Loading…
Reference in New Issue
Block a user