From de611a309006f0976bc9a579eb1087e7a89f79a7 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 7 Sep 2010 18:39:07 -0700 Subject: Lots of design changes around proxies and message passing. Made it so that domains can only talk to other domains via handles, and with the help of the rust_kernel. --- src/rt/rust_proxy.h | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'src/rt/rust_proxy.h') diff --git a/src/rt/rust_proxy.h b/src/rt/rust_proxy.h index bf12e1d5..2b5e820d 100644 --- a/src/rt/rust_proxy.h +++ b/src/rt/rust_proxy.h @@ -2,57 +2,70 @@ #define RUST_PROXY_H /** - * A proxy object is a wrapper around other Rust objects. One use of the proxy - * object is to mitigate access between tasks in different thread domains. + * A proxy object is a wrapper for remote objects. Proxy objects are domain + * owned and provide a way distinguish between local and remote objects. */ template struct rust_proxy; + /** * The base class of all objects that may delegate. */ template struct maybe_proxy : public rc_base, public rust_cond { protected: - T *_delegate; + T *_referent; public: - maybe_proxy(T * delegate) : _delegate(delegate) { - + maybe_proxy(T *referent) : _referent(referent) { + // Nop. } - T *delegate() { - return _delegate; + + T *referent() { + return (T *)_referent; } + bool is_proxy() { - return _delegate != this; + return _referent != this; } + rust_proxy *as_proxy() { return (rust_proxy *) this; } - T *as_delegate() { - I(_delegate->get_dom(), !is_proxy()); + + T *as_referent() { return (T *) this; } }; +template class rust_handle; + /** * A proxy object that delegates to another. */ template struct -rust_proxy : public maybe_proxy, - public dom_owned > { +rust_proxy : public maybe_proxy { private: bool _strong; + rust_handle *_handle; public: - rust_dom *dom; - rust_proxy(rust_dom *dom, T *delegate, bool strong) : - maybe_proxy (delegate), _strong(strong), dom(dom) { - this->dom->log(rust_log::COMM, - "new proxy: 0x%" PRIxPTR " => 0x%" PRIxPTR, this, delegate); - if (strong) { - delegate->ref(); - } + rust_proxy(rust_handle *handle) : + maybe_proxy (NULL), _strong(FALSE), _handle(handle) { + // Nop. + } + + rust_proxy(T *referent) : + maybe_proxy (referent), _strong(FALSE), _handle(NULL) { + // Nop. + } + + rust_handle *handle() { + return _handle; } }; +class rust_message_queue; +class rust_task; + // // Local Variables: // mode: C++ -- cgit v1.2.3