Revert bug 578478 because of issues in parallel builds (generating the yacc/lex tables), and because of a conflict with fatvals
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 09 Aug 2010 15:22:40 -0400
changeset 49232 af9c241314a40cecbf34ca201e0116626202ac5b
parent 49226 6291e3e408ec9824c0bac04b98f62625c6d8e7f0
child 49233 9369260838e06ee865ca156313ba0995ec3b9c71
push id14954
push userbsmedberg@mozilla.com
push dateMon, 09 Aug 2010 19:26:44 +0000
treeherderautoland@9369260838e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs578478
milestone2.0b4pre
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
Revert bug 578478 because of issues in parallel builds (generating the yacc/lex tables), and because of a conflict with fatvals
config/rules.mk
js/src/config/rules.mk
xpcom/idl-parser/header.py
xpcom/idl-parser/xpidl.py
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -415,17 +415,17 @@ endif
 
 LIBOBJS			:= $(addprefix \", $(OBJS))
 LIBOBJS			:= $(addsuffix \", $(LIBOBJS))
 
 ifndef MOZ_AUTO_DEPS
 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
 MDDEPFILES		= $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
 ifndef NO_GEN_XPT
-MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
+MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt))
 endif
 endif
 endif
 
 ALL_TRASH = \
 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
 	$(OBJS:.$(OBJ_SUFFIX)=.i) \
@@ -1754,36 +1754,28 @@ endif
 # warn against overriding existing .h file. 
 $(XPIDL_GEN_DIR)/.done:
 	@if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
 	@touch $@
 
 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
 # with any addition to the directory, regenerating all .h files -> everything.
 
-XPIDL_DEPS = \
-  $(topsrcdir)/xpcom/idl-parser/header.py \
-  $(topsrcdir)/xpcom/idl-parser/xpidl.py \
-  $(NULL)
-
-$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
+$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
 	$(REPORT_BUILD)
-	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-	  -I$(topsrcdir)/other-licenses/ply \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	$(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
 	@if test -n "$(findstring $*.h, $(EXPORTS))"; \
 	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
 
 ifndef NO_GEN_XPT
 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
 	$(REPORT_BUILD)
-	$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$(@F).pp $(_VPATH_SRCS)
+	$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -415,17 +415,17 @@ endif
 
 LIBOBJS			:= $(addprefix \", $(OBJS))
 LIBOBJS			:= $(addsuffix \", $(LIBOBJS))
 
 ifndef MOZ_AUTO_DEPS
 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
 MDDEPFILES		= $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
 ifndef NO_GEN_XPT
-MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
+MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt))
 endif
 endif
 endif
 
 ALL_TRASH = \
 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
 	$(OBJS:.$(OBJ_SUFFIX)=.i) \
@@ -1754,36 +1754,28 @@ endif
 # warn against overriding existing .h file. 
 $(XPIDL_GEN_DIR)/.done:
 	@if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
 	@touch $@
 
 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
 # with any addition to the directory, regenerating all .h files -> everything.
 
-XPIDL_DEPS = \
-  $(topsrcdir)/xpcom/idl-parser/header.py \
-  $(topsrcdir)/xpcom/idl-parser/xpidl.py \
-  $(NULL)
-
-$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_DEPS) $(XPIDL_GEN_DIR)/.done
+$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
 	$(REPORT_BUILD)
-	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-	  -I$(topsrcdir)/other-licenses/ply \
-	  -I$(topsrcdir)/xpcom/idl-parser \
-	  $(topsrcdir)/xpcom/idl-parser/header.py --cachedir=$(DEPTH)/xpcom/idl-parser $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
+	$(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
 	@if test -n "$(findstring $*.h, $(EXPORTS))"; \
 	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
 
 ifndef NO_GEN_XPT
 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
 	$(REPORT_BUILD)
-	$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$(@F).pp $(_VPATH_SRCS)
+	$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
--- a/xpcom/idl-parser/header.py
+++ b/xpcom/idl-parser/header.py
@@ -53,42 +53,30 @@ else:
         pass
 
 def firstCap(str):
     return str[0].upper() + str[1:]
 
 def attributeParamName(a):
     return "a" + firstCap(a.name)
 
-def attributeParamNames(a):
-    l = [attributeParamName(a)]
-    if a.implicit_jscontext:
-        l.insert(0, "cx")
-    return ", ".join(l)
-
 def attributeNativeName(a, getter):
     binaryname = a.binaryname is not None and a.binaryname or firstCap(a.name)
     return "%s%s" % (getter and 'Get' or 'Set', binaryname)
 
 def attributeParamlist(a, getter):
-    l = ["%s%s" % (a.realtype.nativeType(getter and 'out' or 'in'),
-                   attributeParamName(a))]
-    if a.implicit_jscontext:
-        l.insert(0, "JSContext* cx")
-
-    return ", ".join(l)
+    return "%s%s" % (a.realtype.nativeType(getter and 'out' or 'in'),
+                     attributeParamName(a))
 
 def attributeAsNative(a, getter):
         scriptable = a.isScriptable() and "NS_SCRIPTABLE " or ""
-        deprecated = a.deprecated and "NS_DEPRECATED " or ""
         params = {'scriptable': scriptable,
-                  'deprecated': deprecated,
                   'binaryname': attributeNativeName(a, getter),
                   'paramlist': attributeParamlist(a, getter)}
-        return "%(deprecated)s%(scriptable)sNS_IMETHOD %(binaryname)s(%(paramlist)s)" % params
+        return "%(scriptable)sNS_IMETHOD %(binaryname)s(%(paramlist)s)" % params
 
 def methodNativeName(m):
     return m.binaryname is not None and m.binaryname or firstCap(m.name)
 
 def methodReturnType(m, macro):
     """macro should be NS_IMETHOD or NS_IMETHODIMP"""
     if m.notxpcom:
         return "%s_(%s)" % (macro, m.realtype.nativeType('in').strip())
@@ -96,62 +84,49 @@ def methodReturnType(m, macro):
         return macro
 
 def methodAsNative(m):
     scriptable = m.isScriptable() and "NS_SCRIPTABLE " or ""
 
     return "%s%s %s(%s)" % (scriptable,
                             methodReturnType(m, 'NS_IMETHOD'),
                             methodNativeName(m),
-                            paramlistAsNative(m))
-
-def paramlistAsNative(m, empty='void'):
-    l = [paramAsNative(p) for p in m.params]
-
-    if m.implicit_jscontext:
-        l.append("JSContext* cx")
+                            paramlistAsNative(m.params,
+                                              m.realtype,
+                                              notxpcom=m.notxpcom))
 
-    if m.optional_argc:
-        l.append('PRUint8 _argc')
-
-    if not m.notxpcom and m.realtype.name != 'void':
-        l.append(paramAsNative(xpidl.Param(paramtype='out',
-                                           type=None,
-                                           name='_retval',
-                                           attlist=[],
-                                           location=None,
-                                           realtype=m.realtype)))
+def paramlistAsNative(l, rettype, notxpcom, empty='void'):
+    l = list(l)
+    if not notxpcom and rettype.name != 'void':
+        l.append(xpidl.Param(paramtype='out',
+                             type=None,
+                             name='_retval',
+                             attlist=[],
+                             location=None,
+                             realtype=rettype))
 
     if len(l) == 0:
         return empty
 
-    return ", ".join(l)
+    return ", ".join([paramAsNative(p) for p in l])
 
 def paramAsNative(p):
     if p.paramtype == 'in':
         typeannotate = ''
     else:
         typeannotate = ' NS_%sPARAM' % p.paramtype.upper()
 
     return "%s%s%s" % (p.nativeType(),
                        p.name,
                        typeannotate)
 
-def paramlistNames(m):
-    names = [p.name for p in m.params]
-
-    if m.implicit_jscontext:
-        names.append('cx')
-
-    if m.optional_argc:
-        names.append('_argc')
-
-    if not m.notxpcom and m.realtype.name != 'void':
+def paramlistNames(l, rettype, notxpcom):
+    names = [p.name for p in l]
+    if not notxpcom and rettype.name != 'void':
         names.append('_retval')
-
     if len(names) == 0:
         return ''
     return ', '.join(names)
 
 header = """/*
  * DO NOT EDIT.  THIS FILE IS GENERATED FROM %(filename)s
  */
 
@@ -403,25 +378,25 @@ def write_interface(iface, fd):
 
     fd.write(iface_forward % names)
 
     def emitTemplate(tmpl):
         for member in iface.members:
             if isinstance(member, xpidl.Attribute):
                 fd.write(tmpl % {'asNative': attributeAsNative(member, True),
                                  'nativeName': attributeNativeName(member, True),
-                                 'paramList': attributeParamNames(member)})
+                                 'paramList': attributeParamName(member)})
                 if not member.readonly:
                     fd.write(tmpl % {'asNative': attributeAsNative(member, False),
                                      'nativeName': attributeNativeName(member, False),
-                                     'paramList': attributeParamNames(member)})
+                                     'paramList': attributeParamName(member)})
             elif isinstance(member, xpidl.Method):
                 fd.write(tmpl % {'asNative': methodAsNative(member),
                                  'nativeName': methodNativeName(member),
-                                 'paramList': paramlistNames(member)})
+                                 'paramList': paramlistNames(member.params, member.realtype, member.notxpcom)})
         if len(iface.members) == 0:
             fd.write('\\\n  /* no methods! */')
         elif not member.kind in ('attribute', 'method'):
             fd.write('\\')
 
     emitTemplate("\\\n  %(asNative)s { return _to %(nativeName)s(%(paramList)s); } ")
 
     fd.write(iface_forward_safe % names)
@@ -442,56 +417,28 @@ def write_interface(iface, fd):
                 fd.write(example_tmpl % {'implclass': implclass,
                                          'returntype': 'NS_IMETHODIMP',
                                          'nativeName': attributeNativeName(member, False),
                                          'paramList': attributeParamlist(member, False)})
         elif isinstance(member, xpidl.Method):
             fd.write(example_tmpl % {'implclass': implclass,
                                      'returntype': methodReturnType(member, 'NS_IMETHODIMP'),
                                      'nativeName': methodNativeName(member),
-                                     'paramList': paramlistAsNative(member, empty='')})
+                                     'paramList': paramlistAsNative(member.params, member.realtype, notxpcom=member.notxpcom, empty='')})
         fd.write('\n')
 
     fd.write(iface_template_epilog)
 
 if __name__ == '__main__':
     from optparse import OptionParser
     o = OptionParser()
-    o.add_option('-I', action='append', dest='incdirs', default=['.'],
-                 help="Directory to search for imported files")
-    o.add_option('--cachedir', dest='cachedir', default=None,
-                 help="Directory in which to cache lex/parse tables.")
-    o.add_option('-o', dest='outfile', default=None,
-                 help="Output file (default is stdout)")
-    o.add_option('-d', dest='depfile', default=None,
-                 help="Generate a make dependency file")
+    o.add_option('-I', action='append', dest='incdirs', help="Directory to search for imported files", default=[])
+    o.add_option('--cachedir', dest='cachedir', help="Directory in which to cache lex/parse tables.", default='')
     options, args = o.parse_args()
     file, = args
 
-    if options.cachedir is not None:
-        if not os.path.isdir(options.cachedir):
-            os.mkdir(options.cachedir)
+    if options.cachedir != '':
         sys.path.append(options.cachedir)
 
-    if options.depfile is not None and options.outfile is None:
-        print >>sys.stderr, "-d requires -o"
-        sys.exit(1)
-
-    if options.outfile is not None:
-        outfd = open(options.outfile, 'w')
-        closeoutfd = True
-    else:
-        outfd = sys.stdout
-        closeoutfd = False
-
     p = xpidl.IDLParser(outputdir=options.cachedir)
     idl = p.parse(open(file).read(), filename=file)
     idl.resolve(options.incdirs, p)
-    print_header(idl, outfd, file)
-
-    if closeoutfd:
-        outfd.close()
-
-    if options.depfile is not None:
-        depfd = open(options.depfile, 'w')
-        deps = [dep.replace('\\', '/') for dep in idl.deps]
-
-        print >>depfd, "%s: %s" % (options.outfile, " ".join(deps))
+    print_header(idl, sys.stdout, file)
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -277,25 +277,23 @@ class Include(object):
 
         for file in incfiles():
             if not os.path.exists(file): continue
 
             self.IDL = parent.parser.parse(open(file).read(), filename=file)
             self.IDL.resolve(parent.incdirs, parent.parser)
             for type in self.IDL.getNames():
                 parent.setName(type)
-            parent.deps.extend(self.IDL.deps)
             return
 
         raise IDLError("File '%s' not found" % self.filename, self.location)
 
 class IDL(object):
     def __init__(self, productions):
         self.productions = productions
-        self.deps = []
 
     def setName(self, object):
         self.namemap.set(object)
 
     def getName(self, id, location):
         try:
             return self.namemap[id]
         except KeyError:
@@ -641,17 +639,16 @@ class Attribute(object):
     kind = 'attribute'
     noscript = False
     notxpcom = False
     readonly = False
     implicit_jscontext = False
     binaryname = None
     null = None
     undefined = None
-    deprecated = False
 
     def __init__(self, type, name, attlist, readonly, location, doccomments):
         self.type = type
         self.name = name
         self.attlist = attlist
         self.readonly = readonly
         self.location = location
         self.doccomments = doccomments
@@ -690,18 +687,16 @@ class Attribute(object):
                     raise IDLError("Unexpected attribute value", aloc)
 
                 if name == 'noscript':
                     self.noscript = True
                 elif name == 'notxpcom':
                     self.notxpcom = True
                 elif name == 'implicit_jscontext':
                     self.implicit_jscontext = True
-                elif name == 'deprecated':
-                    self.deprecated = True
                 else:
                     raise IDLError("Unexpected attribute '%s'", aloc)
 
     def resolve(self, iface):
         self.iface = iface
         self.realtype = iface.idl.getName(self.type, self.location)
         if (self.null is not None and
             getBuiltinOrNativeTypeName(self.realtype) != '[domstring]'):
@@ -727,17 +722,16 @@ class Attribute(object):
 
 class Method(object):
     kind = 'method'
     noscript = False
     notxpcom = False
     binaryname = None
     implicit_jscontext = False
     optional_argc = False
-    deprecated = False
 
     def __init__(self, type, name, attlist, paramlist, location, doccomments, raises):
         self.type = type
         self.name = name
         self.attlist = attlist
         self.params = paramlist
         self.location = location
         self.doccomments = doccomments
@@ -758,18 +752,16 @@ class Method(object):
             if name == 'noscript':
                 self.noscript = True
             elif name == 'notxpcom':
                 self.notxpcom = True
             elif name == 'implicit_jscontext':
                 self.implicit_jscontext = True
             elif name == 'optional_argc':
                 self.optional_argc = True
-            elif name == 'deprecated':
-                self.deprecated = True
             else:
                 raise IDLError("Unexpected attribute '%s'", aloc)
 
         self.namemap = NameMap()
         for p in paramlist:
             self.namemap.set(p)
 
     def resolve(self, iface):
@@ -1317,20 +1309,17 @@ class IDLParser(object):
             self._doccomments = []
         return t
 
     def parse(self, data, filename=None):
         if filename is not None:
             self.lexer.filename = filename
         self.lexer.lineno = 1
         self.lexer.input(data)
-        idl = self.parser.parse(lexer=self)
-        if filename is not None:
-            idl.deps.append(filename)
-        return idl
+        return self.parser.parse(lexer=self)
 
     def getLocation(self, p, i):
         return Location(self.lexer, p.lineno(i), p.lexpos(i))
 
 if __name__ == '__main__':
     p = IDLParser()
     for f in sys.argv[1:]:
         print "Parsing %s" % f