[libc-commits] [PATCH] D149788: [libc][rpc] Simplify mailbox state tracking

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 3 15:24:07 PDT 2023


jhuber6 accepted this revision.
jhuber6 added a comment.
This revision is now accepted and ready to land.

This worked on the unit tests in D149532 <https://reviews.llvm.org/D149532> when I applied it so it looks good overall, thanks.



================
Comment at: libc/src/__support/RPC/rpc.h:89
 
-  /// Determines if this process owns the buffer for a send. We can send data if
-  /// the output data bit matches the input acknowledge bit.
+  LIBC_INLINE uint32_t load_inbox(uint64_t index) {
+    uint32_t i = inbox[index].load(cpp::MemoryOrder::RELAXED);
----------------
Header comment describing what this does and the inversion scheme please.


================
Comment at: libc/src/__support/RPC/rpc.h:207-208
 /// the copy back.
-template <typename W> LIBC_INLINE void Port::recv_and_send(W work) {
+template <bool T>
+template <typename W>
+LIBC_INLINE void Port<T>::recv_and_send(W work) {
----------------
Put these and others in a single template.


================
Comment at: libc/src/__support/RPC/rpc.h:96
+  /// Determines if this process owns the buffer for a send.
   LIBC_INLINE static bool can_send_data(uint32_t in, uint32_t out) {
+    return in == out;
----------------
JonChesterfield wrote:
> jhuber6 wrote:
> > Can probably just call this `can_use_buffer` and get rid of the other one. I think keeping `send` and `recv` separate is more readable however.
> I favour in != out at the call sites but didn't want to disturb them as part of this review. D149788, D149793 are separate to similarly avoid noise in the diff.
Yeah that's fair enough. I'll need to rebase those.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149788/new/

https://reviews.llvm.org/D149788



More information about the libc-commits mailing list