Bug 1513034 - delete dead code from IPDL's lower.py identified by coverage; r=nika
authorAlex Gaynor <agaynor@mozilla.com>
Wed, 12 Dec 2018 14:59:37 +0000
changeset 450333 1d54ba8e0ec92552f120a1c9c1f53ee6b23c83cb
parent 450332 52c3825548143cae3e878e49c53fc1a28eb78fa8
child 450334 2f2453dca7bea997e4780d771da0704f83698079
push id110479
push usercsabou@mozilla.com
push dateThu, 13 Dec 2018 04:02:11 +0000
treeherdermozilla-inbound@3ecc407c0cc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1513034
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1513034 - delete dead code from IPDL's lower.py identified by coverage; r=nika Differential Revision: https://phabricator.services.mozilla.com/D14091
ipc/ipdl/ipdl/lower.py
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -143,20 +143,16 @@ def _actorId(actor=None):
         return ExprCall(ExprSelect(actor, '->', 'Id'))
     return ExprCall(ExprVar('Id'))
 
 
 def _actorHId(actorhandle):
     return ExprSelect(actorhandle, '.', 'mId')
 
 
-def _actorManager(actor):
-    return ExprCall(ExprSelect(actor, '->', 'Manager'), args=[])
-
-
 def _actorState(actor):
     return ExprSelect(actor, '->', 'mLivenessState')
 
 
 def _backstagePass():
     return ExprCall(ExprVar('mozilla::ipc::PrivateIPDLInterface'))
 
 
@@ -300,30 +296,16 @@ def _cxxArrayType(basetype, const=0, ref
     return Type('nsTArray', T=basetype, const=const, ref=ref, hasimplicitcopyctor=False)
 
 
 def _cxxManagedContainerType(basetype, const=0, ref=0):
     return Type('ManagedContainer', T=basetype,
                 const=const, ref=ref, hasimplicitcopyctor=False)
 
 
-def _callCxxArrayLength(arr):
-    return ExprCall(ExprSelect(arr, '.', 'Length'))
-
-
-def _callCxxArraySetLength(arr, lenexpr, sel='.'):
-    return ExprCall(ExprSelect(arr, sel, 'SetLength'),
-                    args=[lenexpr])
-
-
-def _callCxxSwapArrayElements(arr1, arr2, sel='.'):
-    return ExprCall(ExprSelect(arr1, sel, 'SwapElements'),
-                    args=[arr2])
-
-
 def _callInsertManagedActor(managees, actor):
     return ExprCall(ExprSelect(managees, '.', 'PutEntry'),
                     args=[actor])
 
 
 def _callRemoveManagedActor(managees, actor):
     return ExprCall(ExprSelect(managees, '.', 'RemoveEntry'),
                     args=[actor])
@@ -380,42 +362,22 @@ def _fatalError(msg):
         ExprCall(ExprVar('FatalError'), args=[ExprLiteral.String(msg)]))
 
 
 def _logicError(msg):
     return StmtExpr(
         ExprCall(ExprVar('mozilla::ipc::LogicError'), args=[ExprLiteral.String(msg)]))
 
 
-def _arrayLengthReadError(elementname):
-    return StmtExpr(
-        ExprCall(ExprVar('mozilla::ipc::ArrayLengthReadError'),
-                 args=[ExprLiteral.String(elementname)]))
-
-
-def _unionTypeReadError(unionname):
-    return StmtExpr(
-        ExprCall(ExprVar('mozilla::ipc::UnionTypeReadError'),
-                 args=[ExprLiteral.String(unionname)]))
-
-
 def _sentinelReadError(classname):
     return StmtExpr(
         ExprCall(ExprVar('mozilla::ipc::SentinelReadError'),
                  args=[ExprLiteral.String(classname)]))
 
 
-def _killProcess(pid):
-    return ExprCall(
-        ExprVar('base::KillProcess'),
-        args=[pid,
-              # XXX this is meaningless on POSIX
-              ExprVar('base::PROCESS_END_KILLED_BY_USER'),
-              ExprLiteral.FALSE])
-
 # Results that IPDL-generated code returns back to *Channel code.
 # Users never see these
 
 
 class _Result:
     @staticmethod
     def Type():
         return Type('Result')
@@ -794,22 +756,16 @@ class _StructField(_CompoundTypeComponen
         _CompoundTypeComponent.__init__(self, ipdltype, fname, side, sd)
 
     def getMethod(self, thisexpr=None, sel='.'):
         meth = self.var()
         if thisexpr is not None:
             return ExprSelect(thisexpr, sel, meth.name)
         return meth
 
-    def initExpr(self, thisexpr):
-        expr = ExprCall(self.getMethod(thisexpr=thisexpr))
-        if self.ipdltype.isIPDL() and self.ipdltype.isActor():
-            expr = ExprCast(expr, self.bareType(), const=1)
-        return expr
-
     def refExpr(self, thisexpr=None):
         ref = self.memberVar()
         if thisexpr is not None:
             ref = ExprSelect(thisexpr, '.', ref.name)
         return ref
 
     def constRefExpr(self, thisexpr=None):
         # sigh, gross hack
@@ -863,19 +819,16 @@ IPDL union type."""
         # To create a finite object with a mutually recursive type, a union must
         # be present somewhere in the recursive loop. Because of that we only
         # need to care about introducing indirections inside unions.
         self.recursive = ud.decl.type.mutuallyRecursiveWith(ipdltype)
 
     def enum(self):
         return 'T' + self.flattypename
 
-    def pqEnum(self):
-        return self.ud.name + '::' + self.enum()
-
     def enumvar(self):
         return ExprVar(self.enum())
 
     def internalType(self):
         if self.recursive:
             return self.ptrToType()
         else:
             return self.bareType()
@@ -1190,69 +1143,40 @@ def _startState(hasReentrantDelete):
     pfx = _stateType(hasReentrantDelete).name + '::'
     return ExprVar(pfx + 'Start')
 
 
 class Protocol(ipdl.ast.Protocol):
     def cxxTypedefs(self):
         return self.decl.cxxtypedefs
 
-    def channelSel(self):
-        if self.decl.type.isToplevel():
-            return '.'
-        return '->'
-
-    def channelType(self):
-        return Type('MessageChannel', ptr=not self.decl.type.isToplevel())
-
     def managerInterfaceType(self, ptr=0):
         return Type('mozilla::ipc::IProtocol', ptr=ptr)
 
     def openedProtocolInterfaceType(self, ptr=0):
         return Type('mozilla::ipc::IToplevelProtocol',
                     ptr=ptr)
 
     def _ipdlmgrtype(self):
         assert 1 == len(self.decl.type.managers)
         for mgr in self.decl.type.managers:
             return mgr
 
     def managerActorType(self, side, ptr=0):
         return Type(_actorName(self._ipdlmgrtype().name(), side),
                     ptr=ptr)
 
-    def registerMethod(self):
-        return ExprVar('Register')
-
-    def registerIDMethod(self):
-        return ExprVar('RegisterID')
-
-    def lookupIDMethod(self):
-        return ExprVar('Lookup')
-
     def unregisterMethod(self, actorThis=None):
         if actorThis is not None:
             return ExprSelect(actorThis, '->', 'Unregister')
         return ExprVar('Unregister')
 
     def removeManageeMethod(self):
         return ExprVar('RemoveManagee')
 
-    def createSharedMemory(self):
-        return ExprVar('CreateSharedMemory')
-
-    def lookupSharedMemory(self):
-        return ExprVar('LookupSharedMemory')
-
-    def isTrackingSharedMemory(self):
-        return ExprVar('IsTrackingSharedMemory')
-
-    def destroySharedMemory(self):
-        return ExprVar('DestroySharedMemory')
-
     def otherPidMethod(self):
         return ExprVar('OtherPid')
 
     def callOtherPid(self, actorThis=None):
         fn = self.otherPidMethod()
         if actorThis is not None:
             fn = ExprSelect(actorThis, '->', fn.name)
         return ExprCall(fn)
@@ -1285,26 +1209,16 @@ class Protocol(ipdl.ast.Protocol):
     def enteredCallVar(self):
         assert self.decl.type.isToplevel()
         return ExprVar('EnteredCall')
 
     def exitedCallVar(self):
         assert self.decl.type.isToplevel()
         return ExprVar('ExitedCall')
 
-    def onCxxStackVar(self):
-        assert self.decl.type.isToplevel()
-        return ExprVar('IsOnCxxStack')
-
-    # an actor's C++ private variables
-    def channelVar(self, actorThis=None):
-        if actorThis is not None:
-            return ExprSelect(actorThis, '->', 'mChannel')
-        return ExprVar('mChannel')
-
     def routingId(self, actorThis=None):
         if self.decl.type.isToplevel():
             return ExprVar('MSG_ROUTING_CONTROL')
         if actorThis is not None:
             return ExprCall(ExprSelect(actorThis, '->', 'Id'))
         return ExprCall(ExprVar('Id'))
 
     def stateVar(self, actorThis=None):
@@ -1313,20 +1227,16 @@ class Protocol(ipdl.ast.Protocol):
         return ExprVar('mLivenessState')
 
     def fqStateType(self):
         return _stateType(self.decl.type.hasReentrantDelete)
 
     def startState(self):
         return _startState(self.decl.type.hasReentrantDelete)
 
-    def nullState(self):
-        pfx = self.fqStateType().name + '::'
-        return ExprVar(pfx + 'Null')
-
     def deadState(self):
         pfx = self.fqStateType().name + '::'
         return ExprVar(pfx + 'Dead')
 
     def dyingState(self):
         assert self.decl.type.hasReentrantDelete
         pfx = self.fqStateType().name + '::'
         return ExprVar(pfx + 'Dying')
@@ -1350,20 +1260,16 @@ class Protocol(ipdl.ast.Protocol):
         assert self.decl.type.isManagerOf(actortype)
         return ExprVar('mManaged' + _actorName(actortype.name(), side))
 
     def managedVarType(self, actortype, side, const=0, ref=0):
         assert self.decl.type.isManagerOf(actortype)
         return _cxxManagedContainerType(Type(_actorName(actortype.name(), side)),
                                         const=const, ref=ref)
 
-    # XXX this is sucky, fix
-    def usesShmem(self):
-        return _usesShmem(self)
-
     def subtreeUsesShmem(self):
         return _subtreeUsesShmem(self)
 
     @staticmethod
     def upgrade(protocol):
         assert isinstance(protocol, ipdl.ast.Protocol)
         protocol.__class__ = Protocol