|
35 | 35 | #define ORC_RT_SIMPLEPACKEDSERIALIZATION_H |
36 | 36 |
|
37 | 37 | #include "orc-rt/Error.h" |
| 38 | +#include "orc-rt/ExecutorAddress.h" |
38 | 39 | #include "orc-rt/bit.h" |
39 | 40 | #include "orc-rt/span.h" |
40 | 41 |
|
@@ -174,9 +175,6 @@ class SPSSerializationTraits< |
174 | 175 | /// Any empty placeholder suitable as a substitute for void when deserializing |
175 | 176 | class SPSEmpty {}; |
176 | 177 |
|
177 | | -/// Represents an address in the executor. |
178 | | -class SPSExecutorAddr {}; |
179 | | - |
180 | 178 | /// SPS tag type for tuples. |
181 | 179 | /// |
182 | 180 | /// A blob tuple should be serialized by serializing each of the elements in |
@@ -511,9 +509,31 @@ template <> class SPSSerializationTraits<SPSString, std::string_view> { |
511 | 509 | } |
512 | 510 | }; |
513 | 511 |
|
| 512 | +/// Represents an address in the executor. |
| 513 | +class SPSExecutorAddr {}; |
| 514 | + |
514 | 515 | /// SPS tag type for errors. |
515 | 516 | class SPSError; |
516 | 517 |
|
| 518 | +template <> class SPSSerializationTraits<SPSExecutorAddr, ExecutorAddr> { |
| 519 | +public: |
| 520 | + static size_t size(const ExecutorAddr &A) { |
| 521 | + return SPSArgList<uint64_t>::size(A.getValue()); |
| 522 | + } |
| 523 | + |
| 524 | + static bool serialize(SPSOutputBuffer &OB, const ExecutorAddr &A) { |
| 525 | + return SPSArgList<uint64_t>::serialize(OB, A.getValue()); |
| 526 | + } |
| 527 | + |
| 528 | + static bool deserialize(SPSInputBuffer &IB, ExecutorAddr &A) { |
| 529 | + uint64_t Value; |
| 530 | + if (!SPSArgList<uint64_t>::deserialize(IB, Value)) |
| 531 | + return false; |
| 532 | + A = ExecutorAddr(Value); |
| 533 | + return true; |
| 534 | + } |
| 535 | +}; |
| 536 | + |
517 | 537 | /// Helper type for serializing Errors. |
518 | 538 | /// |
519 | 539 | /// llvm::Errors are move-only, and not inspectable except by consuming them. |
|
0 commit comments