[llvm] r280016 - [ORC][RPC] Make the future type of an Orc RPC call Error/Expected rather than

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 08:22:24 PDT 2016


Adding the wrapper type doesn't feel like a trivial fix, so I reverted the
six relevant changes in r280100.

On Tue, Aug 30, 2016 at 8:11 AM, Reid Kleckner <rnk at google.com> wrote:

> The tests still fail at runtime, because their std::future implementation
> constructs Error objects that are destroyed without being checked:
>
> $ ./unittests/ExecutionEngine/Orc/OrcJITTests.exe --gtest_filter=DummyRPC.
> TestSerialization
> Note: Google Test filter = DummyRPC.TestSerialization
> [==========] Running 1 test from 1 test case.
> [----------] Global test environment set-up.
> [----------] 1 test from DummyRPC
> [ RUN      ] DummyRPC.TestSerialization
> Program aborted due to an unhandled Error:
> Error value was Success. (Note: Success values must still be checked prior
> to being destroyed).
> #0 0x00d9bbe7 HandleAbort c:\src\llvm\lib\support\
> windows\signals.inc:404:0
> #1 0x0175e7f5 raise d:\th\minkernel\crts\ucrt\src\
> appcrt\misc\signal.cpp:516:0
> #2 0x01737b04 abort d:\th\minkernel\crts\ucrt\src\
> appcrt\startup\abort.cpp:64:0
> #3 0x00bab53c llvm::Error::assertIsChecked(void) c:\src\llvm\include\llvm\
> support\error.h:235:0
> #4 0x00bc3815 ?_Set_value_raw@?$_Associated_state at VError@llvm@@@std@@QAEX$
> $QAVError at llvm@@PAV?$unique_lock at Vmutex@std@@@2 at _N@Z c:\program files
> (x86)\microsoft visual studio 14.0\vc\include\future:394:0
> #5 0x00bc3721 ?_Set_value@?$_Associated_state at VError@llvm@@@std@@QAEX$
> $QAVError at llvm@@_N at Z c:\program files (x86)\microsoft visual studio
> 14.0\vc\include\future:386:0
> #6 0x00bc574d ?set_value@?$promise at VError@llvm@@@std@@QAEX$$QAVError at llvm@@@Z
> c:\program files (x86)\microsoft visual studio 14.0\vc\include\future:1547:0
> #7 0x00bc5464 llvm::orc::remote::RPC<class QueueChannel,unsigned
> int,unsigned short>::OutstandingResultImpl<class
> llvm::orc::remote::RPCBase::FunctionHelper<unsigned int,4,void (signed
> char,unsigned char,short,unsigned short,int,unsigned int,__int64,unsigned
> __int64,bool,class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >,class
> std::vector<int,class std::allocator<int> >)> >::readResult(class
> QueueChannel &) c:\src\llvm\include\llvm\executionengine\orc\rpcutils.
> h:682:0
> #8 0x00bc4e88 llvm::orc::remote::RPC<class QueueChannel,unsigned
> int,unsigned short>::handleResponse(class QueueChannel &,unsigned short *)
> c:\src\llvm\include\llvm\executionengine\orc\rpcutils.h:580:0
> #9 0x00bc07a3 llvm::orc::remote::RPC<class QueueChannel,unsigned
> int,unsigned short>::waitForResult<class llvm::Error (class QueueChannel
> &,unsigned int)>(class QueueChannel &,unsigned short,class llvm::Error
> (&)(class QueueChannel &,unsigned int)) c:\src\llvm\include\llvm\
> executionengine\orc\rpcutils.h:605:0
> #10 0x00bb7fe4 DummyRPC_TestSerialization_Test::TestBody(void)
> c:\src\llvm\unittests\executionengine\orc\rpcutilstest.cpp:178:0
> #11 0x00f81e80 testing::internal::HandleSehExceptionsInMethodIfSupported<class
> testing::Test,void>(class testing::Test *,void (
> testing::Test::*)(void),char const *) c:\src\llvm\utils\unittest\
> googletest\src\gtest.cc:2075:0
> #12 0x00f93b9d testing::Test::Run(void) c:\src\llvm\utils\unittest\
> googletest\src\gtest.cc:2161:0
> #13 0x00f93d92 testing::TestInfo::Run(void) c:\src\llvm\utils\unittest\
> googletest\src\gtest.cc:2313:0
> #14 0x00f93c76 testing::TestCase::Run(void) c:\src\llvm\utils\unittest\
> googletest\src\gtest.cc:2416:0
> #15 0x00f94079 testing::internal::UnitTestImpl::RunAllTests(void)
> c:\src\llvm\utils\unittest\googletest\src\gtest.cc:4207:0
> #16 0x00f82110 testing::internal::HandleSehExceptionsInMethodIfSupported<class
> testing::internal::UnitTestImpl,bool>(class testing::internal::UnitTestImpl
> *,bool ( testing::internal::UnitTestImpl::*)(void),char const *)
> c:\src\llvm\utils\unittest\googletest\src\gtest.cc:2075:0
> #17 0x00f93e82 testing::UnitTest::Run(void) c:\src\llvm\utils\unittest\
> googletest\src\gtest.cc:3841:0
> #18 0x016fce32 _scrt_common_main_seh f:\dd\vctools\crt\vcstartup\
> src\startup\exe_common.inl:253:0
> #19 0x76ac38f4 (C:\Windows\SYSTEM32\KERNEL32.DLL+0x138f4)
> #20 0x76f95de3 (C:\Windows\SYSTEM32\ntdll.dll+0x65de3)
> #21 0x76f95dae (C:\Windows\SYSTEM32\ntdll.dll+0x65dae)
>
> I guess the way to work around this is to create some kind of wrapper
> around the Error that is trivially copyable etc, and pull the Error out on
> the other side of the future.
>
> On Mon, Aug 29, 2016 at 11:10 PM, Lang Hames via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Hi Douglas,
>>
>> Hopefully this should be fixed by r280058 and r280059.
>>
>> Cheers,
>> Lang.
>>
>> On Mon, Aug 29, 2016 at 7:40 PM, Lang Hames <lhames at gmail.com> wrote:
>>
>>> Hi Yung,
>>>
>>> Bummer.
>>>
>>> At first glance this looks like a failure to construct a future for a
>>> type with no default constructor - is that your read? Do you know if MSVC
>>> 2013's futures library supports that?
>>>
>>> I'm on the road, but will be back in ~3 hours - when I get back I can
>>> try some workarounds for this. If that's too long for the builders, feel
>>> free to revert for now.
>>>
>>> - Lang.
>>>
>>>
>>> On Mon, Aug 29, 2016 at 5:44 PM, Yung, Douglas <douglas.yung at sony.com>
>>> wrote:
>>>
>>>> Hi Lang,
>>>>
>>>> I believe your checkin caused the Windows build to break when compiling
>>>> with Visual Studio 2013. When building your change, I am seeing the
>>>> following errors:
>>>>
>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(294): error C2512: 'llvm::Expected<int>' : no
>>>> appropriate default constructor available [C:\src\build\tools\lli\
>>>> lli.vcxproj]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(286) : while compiling class template member
>>>> function 'std::_Associated_state<_Ty>::_Associated_state(std::_Deleter_base<_Ty>
>>>> *)'
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(1481) : see reference to function template
>>>> instantiation 'std::_Associated_state<_Ty>::
>>>> _Associated_state(std::_Deleter_base<_Ty> *)' being compiled
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(1018) : see reference to class template
>>>> instantiation 'std::_Associated_state<_Ty>' being compiled
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(1014) : while compiling class template member
>>>> function 'llvm::Expected<int> &std::_State_manager<_Ty>::_Get_value(void)
>>>> const'
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(1132) : see reference to function template
>>>> instantiation 'llvm::Expected<int> &std::_State_manager<_Ty>::_Get_value(void)
>>>> const' being compiled
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\future(1101) : see reference to class template
>>>> instantiation 'std::_State_manager<_Ty>' being compiled
>>>>           with
>>>>           [
>>>>               _Ty=llvm::Expected<int>
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\utility(198) : see reference to class template
>>>> instantiation 'std::future<llvm::Expected<int>>' being compiled
>>>>           C:\src\llvm\include\llvm/Support/AlignOf.h(224) : see
>>>> reference to class template instantiation 'std::pair<std::future<llvm::E
>>>> xpected<int>>,SequenceNumberT>' being compiled
>>>>           with
>>>>           [
>>>>               SequenceNumberT=uint16_t
>>>>           ]
>>>>           C:\Program Files (x86)\Microsoft Visual Studio
>>>> 12.0\VC\include\type_traits(584) : see reference to class template
>>>> instantiation 'llvm::detail::AlignerImpl<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>'
>>>> being compiled
>>>>           with
>>>>           [
>>>>               T1=std::pair<std::future<llvm::Expected<int>>,uint16_t>
>>>>   ,            T2=char
>>>>   ,            T3=char
>>>>   ,            T4=char
>>>>   ,            T5=char
>>>>   ,            T6=char
>>>>   ,            T7=char
>>>>   ,            T8=char
>>>>   ,            T9=char
>>>>   ,            T10=char
>>>>           ]
>>>>           C:\src\llvm\include\llvm/Support/AlignOf.h(83) : see
>>>> reference to class template instantiation 'std::is_abstract<T>' being
>>>> compiled
>>>>           with
>>>>           [
>>>>               T=llvm::detail::AlignerImpl<st
>>>> d::pair<std::future<llvm::Expected<int>>,uint16_t>,char,char
>>>> ,char,char,char,char,char,char,char>
>>>>           ]
>>>>           C:\src\llvm\include\llvm/Support/AlignOf.h(253) : see
>>>> reference to class template instantiation 'llvm::AlignOf<llvm::detail::A
>>>> lignerImpl<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>' being compiled
>>>>   Building Custom Rule C:/src/llvm/tools/clang/tools/
>>>> arcmt-test/CMakeLists.txt
>>>>           with
>>>>           [
>>>>               T1=std::pair<std::future<llvm::Expected<int>>,uint16_t>
>>>>   ,            T2=char
>>>>   ,            T3=char
>>>>   ,            T4=char
>>>>   ,            T5=char
>>>>   ,            T6=char
>>>>   ,            T7=char
>>>>   ,            T8=char
>>>>   ,            T9=char
>>>>   ,            T10=char
>>>>           ]
>>>>           C:\src\llvm\include\llvm/Support/Error.h(831) : see
>>>> reference to class template instantiation 'llvm::AlignedCharArrayUnion<s
>>>> td::pair<std::future<llvm::Expected<int>>,SequenceNumberT>,c
>>>> har,char,char,char,char,char,char,char,char>' being compiled
>>>>           with
>>>>           [
>>>>   CMake does not need to re-run because C:\src\build\tools\clang\tools
>>>> \arcmt-test\CMakeFiles\generate.stamp is up-to-date.
>>>>               SequenceNumberT=uint16_t
>>>>           ]
>>>>           c:\src\llvm\include\llvm\executionengine\orc\RPCUtils.h(447)
>>>> : see reference to class template instantiation
>>>> 'llvm::Expected<std::pair<std::future<llvm::Expected<int>>,SequenceNumberT>>'
>>>> being compiled
>>>>           with
>>>>           [
>>>>               SequenceNumberT=uint16_t
>>>>           ]
>>>>           C:\src\llvm\include\llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h(606)
>>>> : see reference to function template instantiation 'llvm::Expected<int>
>>>> llvm::orc::remote::RPC<llvm::orc::remote::RPCChannel,uint32_
>>>> t,uint16_t>::callSTHandling<llvm::orc::remote::OrcRemoteTarg
>>>> etRPCAPI::CallIntVoid,llvm::orc::remote::OrcRemoteTargetClie
>>>> nt<llvm::orc::remote::RPCChannel>::callIntVoid::<
>>>> lambda_1e43ba3f76d819646569b43fe46505bc>,llvm::JITTargetAddress>(ChannelT
>>>> &,HandleFtor &,const llvm::JITTargetAddress &)' being compiled
>>>>           with
>>>>           [
>>>>               ChannelT=llvm::orc::remote::RPCChannel
>>>>   ,            HandleFtor=llvm::orc::remote::
>>>> OrcRemoteTargetClient<llvm::orc::remote::RPCChannel>::callIn
>>>> tVoid::<lambda_1e43ba3f76d819646569b43fe46505bc>
>>>>           ]
>>>>           C:\src\llvm\include\llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h(606)
>>>> : see reference to function template instantiation 'llvm::Expected<int>
>>>> llvm::orc::remote::RPC<llvm::orc::remote::RPCChannel,uint32_
>>>> t,uint16_t>::callSTHandling<llvm::orc::remote::OrcRemoteTarg
>>>> etRPCAPI::CallIntVoid,llvm::orc::remote::OrcRemoteTargetClie
>>>> nt<llvm::orc::remote::RPCChannel>::callIntVoid::<
>>>> lambda_1e43ba3f76d819646569b43fe46505bc>,llvm::JITTargetAddress>(ChannelT
>>>> &,HandleFtor &,const llvm::JITTargetAddress &)' being compiled
>>>>           with
>>>>           [
>>>>               ChannelT=llvm::orc::remote::RPCChannel
>>>>   ,            HandleFtor=llvm::orc::remote::
>>>> OrcRemoteTargetClient<llvm::orc::remote::RPCChannel>::callIn
>>>> tVoid::<lambda_1e43ba3f76d819646569b43fe46505bc>
>>>>           ]
>>>>           C:\src\llvm\include\llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h(600)
>>>> : while compiling class template member function 'llvm::Expected<int>
>>>> llvm::orc::remote::OrcRemoteTargetClient<llvm::orc::remote::
>>>> RPCChannel>::callIntVoid(llvm::JITTargetAddress)'
>>>>           C:\src\llvm\tools\lli\lli.cpp(694) : see reference to
>>>> function template instantiation 'llvm::Expected<int>
>>>> llvm::orc::remote::OrcRemoteTargetClient<llvm::orc::remote::
>>>> RPCChannel>::callIntVoid(llvm::JITTargetAddress)' being compiled
>>>>           C:\src\llvm\tools\lli\lli.cpp(666) : see reference to class
>>>> template instantiation 'llvm::orc::remote::OrcRemoteT
>>>> argetClient<llvm::orc::remote::RPCChannel>' being compiled
>>>>   OrcLazyJIT.cpp
>>>>
>>>>
>>>> Can you take a look into this?
>>>>
>>>> Douglas Yung
>>>>
>>>> > -----Original Message-----
>>>> > From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
>>>> > Behalf Of Lang Hames via llvm-commits
>>>> > Sent: Monday, August 29, 2016 14:57
>>>> > To: llvm-commits at lists.llvm.org
>>>> > Subject: [llvm] r280016 - [ORC][RPC] Make the future type of an Orc
>>>> RPC
>>>> > call Error/Expected rather than
>>>> >
>>>> > Author: lhames
>>>> > Date: Mon Aug 29 16:56:30 2016
>>>> > New Revision: 280016
>>>> >
>>>> > URL: http://llvm.org/viewvc/llvm-project?rev=280016&view=rev
>>>> > Log:
>>>> > [ORC][RPC] Make the future type of an Orc RPC call Error/Expected
>>>> > rather than Optional.
>>>> >
>>>> > For void functions the return type of a nonblocking call changes from
>>>> > Expected<future<Optional<bool>>> to Expected<future<Error>>, and for
>>>> > functions returning T the return type changes from
>>>> > Expected<future<Optional<T>>> to Expected<future<Expected<T>>>.
>>>> >
>>>> > Inner results need to be checked (since the RPC connection may have
>>>> > dropped out before a result came back) and Error/Expected provide
>>>> > stronger checking requirements. It also allows us drop the crufty
>>>> > 'optionalToError' function and just collapse Errors in the single-
>>>> > threaded call primitives.
>>>> >
>>>> >
>>>> > Modified:
>>>> >     llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h
>>>> >     llvm/trunk/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
>>>> >
>>>> > Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h
>>>> > URL: http://llvm.org/viewvc/llvm-
>>>> > project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils
>>>> .h?rev=2800
>>>> > 16&r1=280015&r2=280016&view=diff
>>>> > ============================================================
>>>> ===========
>>>> > =======
>>>> > --- llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h (original)
>>>> > +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RPCUtils.h Mon Aug 29
>>>> > +++ 16:56:30 2016
>>>> > @@ -17,7 +17,6 @@
>>>> >  #include <map>
>>>> >  #include <vector>
>>>> >
>>>> > -#include "llvm/ADT/Optional.h"
>>>> >  #include "llvm/ADT/STLExtras.h"
>>>> >  #include "llvm/ExecutionEngine/Orc/OrcError.h"
>>>> >
>>>> > @@ -61,6 +60,7 @@ public:
>>>> >  // partially specialized.
>>>> >  class RPCBase {
>>>> >  protected:
>>>> > +
>>>> >    // RPC Function description type.
>>>> >    //
>>>> >    // This class provides the information and operations needed to
>>>> > support the @@ -69,10 +69,7 @@ protected:
>>>> >    // betwen the two. Both specializations have the same interface:
>>>> >    //
>>>> >    // Id - The function's unique identifier.
>>>> > -  // OptionalReturn - The return type for asyncronous calls.
>>>> > -  // ErrorReturn - The return type for synchronous calls.
>>>> > -  // optionalToErrorReturn - Conversion from a valid OptionalReturn
>>>> to
>>>> > an
>>>> > -  //                         ErrorReturn.
>>>> > +  // ErrorReturn - The return type for blocking calls.
>>>> >    // readResult - Deserialize a result from a channel.
>>>> >    // abandon - Abandon a promised (asynchronous) result.
>>>> >    // respond - Retun a result on the channel.
>>>> > @@ -91,32 +88,25 @@ protected:
>>>> >
>>>> >      static const FunctionIdT Id = FuncId;
>>>> >
>>>> > -    typedef Optional<RetT> OptionalReturn;
>>>> > -
>>>> >      typedef Expected<RetT> ErrorReturn;
>>>> >
>>>> > -    static ErrorReturn optionalToErrorReturn(OptionalReturn &&V) {
>>>> > -      assert(V && "Return value not available");
>>>> > -      return std::move(*V);
>>>> > -    }
>>>> > -
>>>> >      template <typename ChannelT>
>>>> > -    static Error readResult(ChannelT &C, std::promise<OptionalReturn>
>>>> > &P) {
>>>> > +    static Error readResult(ChannelT &C, std::promise<ErrorReturn>
>>>> &P)
>>>> > + {
>>>> >        RetT Val;
>>>> >        auto Err = deserialize(C, Val);
>>>> >        auto Err2 = endReceiveMessage(C);
>>>> >        Err = joinErrors(std::move(Err), std::move(Err2));
>>>> > -
>>>> > -      if (Err) {
>>>> > -        P.set_value(OptionalReturn());
>>>> > +      if (Err)
>>>> >          return Err;
>>>> > -      }
>>>> > +
>>>> >        P.set_value(std::move(Val));
>>>> >        return Error::success();
>>>> >      }
>>>> >
>>>> > -    static void abandon(std::promise<OptionalReturn> &P) {
>>>> > -      P.set_value(OptionalReturn());
>>>> > +    static void abandon(std::promise<ErrorReturn> &P) {
>>>> > +      P.set_value(
>>>> > +        make_error<StringError>("RPC function call failed to return",
>>>> > +                                inconvertibleErrorCode()));
>>>> >      }
>>>> >
>>>> >      template <typename ChannelT, typename SequenceNumberT> @@ -148,22
>>>> > +138,20 @@ protected:
>>>> >
>>>> >      static const FunctionIdT Id = FuncId;
>>>> >
>>>> > -    typedef bool OptionalReturn;
>>>> >      typedef Error ErrorReturn;
>>>> >
>>>> > -    static ErrorReturn optionalToErrorReturn(OptionalReturn &&V) {
>>>> > -      assert(V && "Return value not available");
>>>> > -      return Error::success();
>>>> > -    }
>>>> > -
>>>> >      template <typename ChannelT>
>>>> > -    static Error readResult(ChannelT &C, std::promise<OptionalReturn>
>>>> > &P) {
>>>> > +    static Error readResult(ChannelT &C, std::promise<ErrorReturn>
>>>> &P)
>>>> > + {
>>>> >        // Void functions don't have anything to deserialize, so we're
>>>> > good.
>>>> > -      P.set_value(true);
>>>> > +      P.set_value(Error::success());
>>>> >        return endReceiveMessage(C);
>>>> >      }
>>>> >
>>>> > -    static void abandon(std::promise<OptionalReturn> &P) {
>>>> > P.set_value(false); }
>>>> > +    static void abandon(std::promise<ErrorReturn> &P) {
>>>> > +      P.set_value(
>>>> > +        make_error<StringError>("RPC function call failed to return",
>>>> > +                                inconvertibleErrorCode()));
>>>> > +    }
>>>> >
>>>> >      template <typename ChannelT, typename SequenceNumberT>
>>>> >      static Error respond(ChannelT &C, SequenceNumberT SeqNo, @@ -
>>>> > 380,17 +368,17 @@ public:
>>>> >
>>>> >    /// Return type for asynchronous call primitives.
>>>> >    template <typename Func>
>>>> > -  using AsyncCallResult = std::future<typename Func::OptionalReturn>;
>>>> > +  using AsyncCallResult = std::future<typename Func::ErrorReturn>;
>>>> >
>>>> >    /// Return type for asynchronous call-with-seq primitives.
>>>> >    template <typename Func>
>>>> >    using AsyncCallWithSeqResult =
>>>> > -      std::pair<std::future<typename Func::OptionalReturn>,
>>>> > SequenceNumberT>;
>>>> > +      std::pair<AsyncCallResult<Func>, SequenceNumberT>;
>>>> >
>>>> >    /// Serialize Args... to channel C, but do not call C.send().
>>>> >    ///
>>>> >    /// Returns an error (on serialization failure) or a pair of:
>>>> > -  /// (1) A future Optional<T> (or future<bool> for void functions),
>>>> > and
>>>> > +  /// (1) A future Expected<T> (or future<bool> for void functions),
>>>> > + and
>>>> >    /// (2) A sequence number.
>>>> >    ///
>>>> >    /// This utility function is primarily used for single-threaded
>>>> mode
>>>> > support, @@ -401,7 +389,7 @@ public:
>>>> >    Expected<AsyncCallWithSeqResult<Func>>
>>>> >    appendCallAsyncWithSeq(ChannelT &C, const ArgTs &... Args) {
>>>> >      auto SeqNo = SequenceNumberMgr.getSequenceNumber();
>>>> > -    std::promise<typename Func::OptionalReturn> Promise;
>>>> > +    std::promise<typename Func::ErrorReturn> Promise;
>>>> >      auto Result = Promise.get_future();
>>>> >      OutstandingResults[SeqNo] =
>>>> >          createOutstandingResult<Func>(std::move(Promise));
>>>> > @@ -431,7 +419,7 @@ public:
>>>> >
>>>> >    /// Serialize Args... to channel C, but do not call send.
>>>> >    /// Returns an error if serialization fails, otherwise returns a
>>>> > -  /// std::future<Optional<T>> (or a future<bool> for void
>>>> functions).
>>>> > +  /// std::future<Expected<T>> (or a future<bool> for void
>>>> functions).
>>>> >    template <typename Func, typename... ArgTs>
>>>> >    Expected<AsyncCallResult<Func>> appendCallAsync(ChannelT &C,
>>>> >                                                    const ArgTs &...
>>>> > Args) { @@ -460,7 +448,7 @@ public:
>>>> >        auto &ResultAndSeqNo = *ResultAndSeqNoOrErr;
>>>> >        if (auto Err = waitForResult(C, ResultAndSeqNo.second,
>>>> > HandleOther))
>>>> >          return std::move(Err);
>>>> > -      return Func::optionalToErrorReturn(Re
>>>> sultAndSeqNo.first.get());
>>>> > +      return ResultAndSeqNo.first.get();
>>>> >      } else
>>>> >        return ResultAndSeqNoOrErr.takeError();
>>>> >    }
>>>> > @@ -656,7 +644,7 @@ private:
>>>> >    class OutstandingResultImpl : public OutstandingResult {
>>>> >    private:
>>>> >    public:
>>>> > -    OutstandingResultImpl(std::promise<typename
>>>> Func::OptionalReturn>
>>>> > &&P)
>>>> > +    OutstandingResultImpl(std::promise<typename Func::ErrorReturn>
>>>> > &&P)
>>>> >          : P(std::move(P)) {}
>>>> >
>>>> >      Error readResult(ChannelT &C) override { return
>>>> > Func::readResult(C, P); } @@ -664,13 +652,13 @@ private:
>>>> >      void abandon() override { Func::abandon(P); }
>>>> >
>>>> >    private:
>>>> > -    std::promise<typename Func::OptionalReturn> P;
>>>> > +    std::promise<typename Func::ErrorReturn> P;
>>>> >    };
>>>> >
>>>> >    // Create an outstanding result for the given function.
>>>> >    template <typename Func>
>>>> >    std::unique_ptr<OutstandingResult>
>>>> > -  createOutstandingResult(std::promise<typename
>>>> Func::OptionalReturn>
>>>> > &&P) {
>>>> > +  createOutstandingResult(std::promise<typename Func::ErrorReturn>
>>>> > &&P)
>>>> > + {
>>>> >      return
>>>> > llvm::make_unique<OutstandingResultImpl<Func>>(std::move(P));
>>>> >    }
>>>> >
>>>> >
>>>> > Modified: llvm/trunk/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
>>>> > URL: http://llvm.org/viewvc/llvm-
>>>> > project/llvm/trunk/unittests/ExecutionEngine/Orc/RPCUtilsTes
>>>> t.cpp?rev=2
>>>> > 80016&r1=280015&r2=280016&view=diff
>>>> > ============================================================
>>>> ===========
>>>> > =======
>>>> > --- llvm/trunk/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
>>>> > (original)
>>>> > +++ llvm/trunk/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp Mon Aug
>>>> > 29
>>>> > +++ 16:56:30 2016
>>>> > @@ -102,8 +102,8 @@ TEST_F(DummyRPC, TestAsyncVoidBool) {
>>>> >    }
>>>> >
>>>> >    // Verify that the function returned ok.
>>>> > -  auto Val = ResOrErr->first.get();
>>>> > -  EXPECT_TRUE(Val) << "Remote void function failed to execute.";
>>>> > +  auto Err = ResOrErr->first.get();
>>>> > +  EXPECT_TRUE(!!Err) << "Remote void function failed to execute.";
>>>> >  }
>>>> >
>>>> >  TEST_F(DummyRPC, TestAsyncIntInt) {
>>>> > @@ -179,8 +179,8 @@ TEST_F(DummyRPC, TestSerialization) {
>>>> >    }
>>>> >
>>>> >    // Verify that the function returned ok.
>>>> > -  auto Val = ResOrErr->first.get();
>>>> > -  EXPECT_TRUE(Val) << "Remote void function failed to execute.";
>>>> > +  auto Err = ResOrErr->first.get();
>>>> > +  EXPECT_TRUE(!!Err) << "Remote void function failed to execute.";
>>>> >  }
>>>> >
>>>> >  // Test the synchronous call API.
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > llvm-commits mailing list
>>>> > llvm-commits at lists.llvm.org
>>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>>
>>>
>>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160830/3c16c3ee/attachment-0001.html>


More information about the llvm-commits mailing list