Bug 1319271 - Return early in Send__delete__ method when Send fails. r=billm
☠☠ backed out by ee388da4aeb6 ☠ ☠
authorKan-Ru Chen <kanru@kanru.info>
Thu, 24 Nov 2016 14:31:02 +0800
changeset 324282 a9856363aac76201b73e4885673889a4983e5f21
parent 324281 6cd80e49535f5d17cd134ceeee79efd0f7d1445f
child 324283 32517c1a54e9c6ccc1ebaa431d5996381ddf61c0
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbillm
bugs1319271
milestone53.0a1
Bug 1319271 - Return early in Send__delete__ method when Send fails. r=billm MozReview-Commit-ID: GOVSpzT3JlX
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -4146,22 +4146,25 @@ class _GenerateProtocolActorCode(ipdl.as
         actor = md.actorDecl()
         actorvar = actor.var()
         method = MethodDefn(self.makeDtorMethodDecl(md))
 
         method.addstmts(self.dtorPrologue(actorvar))
 
         msgvar, stmts = self.makeMessage(md, errfnSendDtor, actorvar)
         sendok, sendstmts = self.sendAsync(md, msgvar, actorvar)
+        failif = StmtIf(ExprNot(sendok))
+        failif.addifstmt(StmtReturn.FALSE)
+
         method.addstmts(
             stmts
             + self.genVerifyMessage(md.decl.type.verify, md.params,
                                     errfnSendDtor, ExprVar('msg__'))
             + sendstmts
-            + [ Whitespace.NL ]
+            + [ failif, Whitespace.NL ]
             + self.dtorEpilogue(md, actor.var())
             + [ StmtReturn(sendok) ])
 
         lbl = CaseLabel(md.pqReplyId())
         case = StmtBlock()
         case.addstmt(StmtReturn(_Result.Processed))
         # TODO if the dtor is "inherently racy", keep the actor alive
         # until the other side acks
@@ -4175,16 +4178,19 @@ class _GenerateProtocolActorCode(ipdl.as
         method = MethodDefn(self.makeDtorMethodDecl(md))
 
         method.addstmts(self.dtorPrologue(actorvar))
 
         msgvar, stmts = self.makeMessage(md, errfnSendDtor, actorvar)
 
         replyvar = self.replyvar
         sendok, sendstmts = self.sendBlocking(md, msgvar, replyvar, actorvar)
+        failif = StmtIf(ExprNot(sendok))
+        failif.addifstmt(StmtReturn.FALSE)
+
         method.addstmts(
             stmts
             + self.genVerifyMessage(md.decl.type.verify, md.params,
                                     errfnSendDtor, ExprVar('msg__'))
             + [ Whitespace.NL,
                 StmtDecl(Decl(Type('Message'), replyvar.name)) ]
             + sendstmts)
 
@@ -4196,17 +4202,18 @@ class _GenerateProtocolActorCode(ipdl.as
                               StmtExpr(ExprAssn(sendok, ExprLiteral.FALSE, '&=')) ])
 
         method.addstmt(ifsendok)
 
         if self.protocol.decl.type.hasReentrantDelete:
             method.addstmts(self.transition(md, 'in', actor.var(), reply=True))
 
         method.addstmts(
-            self.dtorEpilogue(md, actor.var())
+            [ failif, Whitespace.NL ]
+            + self.dtorEpilogue(md, actor.var())
             + [ Whitespace.NL, StmtReturn(sendok) ])
 
         return method
 
     def destroyActor(self, md, actorexpr, why=_DestroyReason.Deletion):
         if md.decl.type.isCtor():
             destroyedType = md.decl.type.constructedType()
         else: