Closed Bug 693563 Opened 13 years ago Closed 13 years ago

Generating dombindings_gen.cpp multiple times results in a different file

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: octoploid, Assigned: peterv)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0a1) Gecko/20100101 Firefox/10.0a1 Build ID: 20111007134757 Steps to reproduce: Latest Firefox fails to build on x86_64-pc-linux-gnu with profiledbuild: Actual results: c++ -o dombindings.o -c -I../../../../dist/stl_wrappers -I../../../../dist/system_wrappers -include /var/tmp/mozilla-central/config/gcc_hidden.h -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES -DSTATIC_EXPORTABLE_JS_API -DOSTYPE=\"Linux3.1\" -DOSARCH=Linux -DJSFILE -DJS_THREADSAFE -DEXPORT_XPC_API -DJS_TRACER=1 -DFEATURE_NANOJIT=1 -DAVMPLUS_64BIT -DAVMPLUS_AMD64 -DAVMPLUS_LINUX -DAVMPLUS_UNIX -D_IMPL_NS_LAYOUT -I/var/tmp/mozilla-central/js/src/xpconnect/src/../wrappers -I/var/tmp/mozilla-central/js/src/xpconnect/src/../loader -I/var/tmp/mozilla-central/js/src -I/var/tmp/mozilla-central/js/src/nanojit -I/var/tmp/mozilla-central/caps/include -I/var/tmp/mozilla-central/content/base/src -I/var/tmp/mozilla-central/content/html/content/src -I/var/tmp/mozilla-central/content/html/document/src -I/var/tmp/mozilla-central/content/svg/content/src -I/var/tmp/mozilla-central/layout/style -I/var/tmp/mozilla-central/layout/base -I/var/tmp/mozilla-central/dom/base -I/var/tmp/mozilla-central/xpcom/ds -I/var/tmp/mozilla-central/js/src/xpconnect/src -I. -I../../../../dist/include -I../../../../dist/include/nsprpub -I/usr/include/nspr -I/usr/include/nss -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -march=native -ffunction-sections -fdata-sections -fvisibility-inlines-hidden -fpermissive -fno-strict-aliasing -std=gnu++0x -pthread -ffunction-sections -fdata-sections -pipe -DNDEBUG -DTRIMMED -flto=4 -fno-fat-lto-objects -fprofile-use -fprofile-correction -Wcoverage-mismatch -O3 -fomit-frame-pointer -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/dombindings.pp /var/tmp/mozilla-central/js/src/xpconnect/src/dombindings.cpp /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp: In member function ‘virtual nsrefcnt MemoryReporter_XPConnectJSGCHeap::Release()’: /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp:1487:1: warning: deleting object of polymorphic class type ‘MemoryReporter_XPConnectJSGCHeap’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp: In member function ‘virtual nsrefcnt MemoryReporter_XPConnectJSSystemCompartmentCount::Release()’: /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp:1530:1: warning: deleting object of polymorphic class type ‘MemoryReporter_XPConnectJSSystemCompartmentCount’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp: In member function ‘virtual nsrefcnt MemoryReporter_XPConnectJSUserCompartmentCount::Release()’: /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp:1540:1: warning: deleting object of polymorphic class type ‘MemoryReporter_XPConnectJSUserCompartmentCount’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp: In member function ‘virtual nsrefcnt XPConnectJSCompartmentsMultiReporter::Release()’: /var/tmp/mozilla-central/js/src/xpconnect/src/xpcjsruntime.cpp:2009:1: warning: deleting object of polymorphic class type ‘XPConnectJSCompartmentsMultiReporter’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] In file included from /var/tmp/mozilla-central/content/html/content/src/nsHTMLSelectElement.h:58:0, from ./dombindings_gen.cpp:3, from /var/tmp/mozilla-central/js/src/xpconnect/src/dombindings.cpp:1109: /var/tmp/mozilla-central/xpcom/ds/nsCheapSets.h: In member function ‘void nsCheapInt32Set::SetInt(PRInt32)’: /var/tmp/mozilla-central/xpcom/ds/nsCheapSets.h:178:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] In file included from /var/tmp/mozilla-central/js/src/xpconnect/src/dombindings.cpp:1109:0: ./dombindings_gen.cpp: In function ‘mozilla::dom::binding::HTMLOptionsCollection_Add(JSContext*, unsigned int, JS::Value*)’: ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL25HTMLOptionsCollection_AddEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch] ./dombindings_gen.cpp:546:1: note: Use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL25HTMLOptionsCollection_AddEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘indirect_call’) [-Werror=coverage-mismatch] ./dombindings_gen.cpp:546:1: note: Use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot ./dombindings_gen.cpp: In function ‘mozilla::dom::binding::HTMLOptionsCollection_SetSelectedIndex(JSContext*, JSObject*, long, int, JS::Value*)’: ./dombindings_gen.cpp:546:1: warning: Source location for function ‘_ZN7mozilla3dom7bindingL38HTMLOptionsCollection_SetSelectedIndexEP9JSContextP8JSObjectliPN2JS5ValueE’ have changed, the profile data may be out of date [enabled by default] ./dombindings_gen.cpp:546:1: warning: Source location for function ‘_ZN7mozilla3dom7bindingL38HTMLOptionsCollection_SetSelectedIndexEP9JSContextP8JSObjectliPN2JS5ValueE’ have changed, the profile data may be out of date [enabled by default] ./dombindings_gen.cpp: In function ‘mozilla::dom::binding::HTMLOptionsCollection_GetSelectedIndex(JSContext*, JSObject*, long, JS::Value*)’: ./dombindings_gen.cpp:546:1: warning: Source location for function ‘_ZN7mozilla3dom7bindingL38HTMLOptionsCollection_GetSelectedIndexEP9JSContextP8JSObjectlPN2JS5ValueE’ have changed, the profile data may be out of date [enabled by default] ./dombindings_gen.cpp:546:1: warning: Source location for function ‘_ZN7mozilla3dom7bindingL38HTMLOptionsCollection_GetSelectedIndexEP9JSContextP8JSObjectlPN2JS5ValueE’ have changed, the profile data may be out of date [enabled by default] ./dombindings_gen.cpp: In function ‘mozilla::dom::binding::HTMLOptionsCollection_NamedItem(JSContext*, unsigned int, JS::Value*)’: ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch] ./dombindings_gen.cpp:546:1: note: Use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘indirect_call’) [-Werror=coverage-mismatch] ./dombindings_gen.cpp:546:1: note: Use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot cc1plus: some warnings being treated as errors make[6]: *** [dombindings.o] Error 1 make[6]: *** Waiting for unfinished jobs.... The same issue is mentioned on this blog: http://hidenosuke.org/diary/?date=20111010
The recent "new DOM list bindings"(Bug 648801) are probably responsible for this.
Perhaps we're regenerating this file on each pass?
(Note that the interesting stuff in comment 0 starts at In file included from /var/tmp/mozilla-central/js/src/xpconnect/src/dombindings.cpp:1109:0: .)
What version of GCC are you using?
gcc version is 4:4.6.1-3. Debian GNU/Linux unstable.
(In reply to Ted Mielczarek [:ted, :luser] from comment #4) > What version of GCC are you using? Latest git version (4.7.0); but note that Hideo Oshima (see the blog link above) uses an older version and hit the same problem. So this most likely a problem where the exact GCC version doesn't matter.
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #2) > Perhaps we're regenerating this file on each pass? Even if that was the case, shouldn't the generated file be the same? Octoploid: did you try with pgo but without lto?
Except that our tinderbox PGO builds seem to be working fine: https://tbpl.mozilla.org/php/getParsedLog.php?id=6785362&tree=Firefox&full=1 We're using GCC 4.5.1.
(In reply to Mike Hommey [:glandium] from comment #7) > Octoploid: did you try with pgo but without lto? Forget that, hidenosuke doesn't use lto.
(In reply to Ted Mielczarek [:ted, :luser] from comment #8) > Except that our tinderbox PGO builds seem to be working fine: > https://tbpl.mozilla.org/php/getParsedLog.php?id=6785362&tree=Firefox&full=1 > > We're using GCC 4.5.1. Yes, it looks like 4.5.1 is more permissive: mozilla::dom::binding::HTMLOptionsCollection_NamedItem(JSContext*, uintN, jsval*)': ./dombindings_gen.cpp:546:1: warning: coverage mismatch for function '_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE' while reading counter 'arcs' ./dombindings_gen.cpp:546:1: note: checksum is 571250aa instead of 4e5c127b ./dombindings_gen.cpp:546:1: note: coverage mismatch ignored due to -Wcoverage-mismatch ./dombindings_gen.cpp:546:1: note: execution counts estimated ./dombindings_gen.cpp:546:1: warning: coverage mismatch for function '_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE' while reading counter 'indirect_call' ./dombindings_gen.cpp:546:1: note: checksum is 571250aa instead of 4e5c127b While 4.7.0 gives an error for the same mozilla::dom::binding::HTMLOptionsCollection_NamedItem(JSContext*, unsigned int, JS::Value*): ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch] ./dombindings_gen.cpp:546:1: note: Use -Wno-error=coverage-mismatch to tolerate the mismatch but performance may drop if the function is hot ./dombindings_gen.cpp:546:1: error: The control flow of function ‘_ZN7mozilla3dom7bindingL31HTMLOptionsCollection_NamedItemEP9JSContextjPN2JS5ValueE’ does not match its profile data (counter ‘indirect_call’) [-Werror=coverage-mismatch]
One can paper over the problem by using "-Werror=coverage-mismatch" in addition to "-Wcoverage-mismatch " in PROFILE_USE_CFLAGS. But the proper solution is to make dombindings_gen.cpp deterministic. Right now it differs between the runs: --- dombindings_gen.cpp1 2011-10-11 16:13:24.669964616 +0200 +++ dombindings_gen.cpp2 2011-10-11 16:26:45.943734919 +0200 @@ -278,32 +278,6 @@ } static JSBool -HTMLOptionsCollection_NamedItem(JSContext *cx, uintN argc, jsval *vp) -{ - XPC_QS_ASSERT_CONTEXT_OK(cx); - JSObject *obj = JS_THIS_OBJECT(cx, vp); - if (!obj) - return JS_FALSE; - JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); - if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, callee)) - return false; - if (argc < 1) - return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); - jsval *argv = JS_ARGV(cx, vp); - xpc_qsDOMString arg0(cx, argv[0], &argv[0], xpc_qsDOMString::eDefaultNullBehavior, xpc_qsDOMString::eDefaultUndefinedBehavior); - if (!arg0.IsValid()) - return JS_FALSE; - nsWrapperCache *cache; - nsISupports *result; - result = HTMLOptionsCollectionWrapper::getListObject(obj)->GetNamedItem(arg0, &cache); - if (!result) { - *vp = JSVAL_NULL; - return JS_TRUE; - } - return Wrap(cx, obj, result, cache, vp); -} - -static JSBool HTMLOptionsCollection_Item(JSContext *cx, uintN argc, jsval *vp) { XPC_QS_ASSERT_CONTEXT_OK(cx); @@ -352,62 +326,88 @@ } static JSBool -HTMLOptionsCollection_Remove(JSContext *cx, uintN argc, jsval *vp) +HTMLOptionsCollection_GetSelectedIndex(JSContext *cx, JSObject *obj, jsid id, jsval *vp) { XPC_QS_ASSERT_CONTEXT_OK(cx); - JSObject *obj = JS_THIS_OBJECT(cx, vp); - if (!obj) - return JS_FALSE; - JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); - if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, callee)) + if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, NULL)) return false; - if (argc < 1) - return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); - jsval *argv = JS_ARGV(cx, vp); - int32 arg0; - if (!JS_ValueToECMAInt32(cx, argv[0], &arg0)) - return JS_FALSE; nsresult rv; - rv = HTMLOptionsCollectionWrapper::getListObject(obj)->Remove(arg0); + PRInt32 result; + rv = HTMLOptionsCollectionWrapper::getListObject(obj)->GetSelectedIndex(&result); if (NS_FAILED(rv)) { - xpc_qsThrowMethodFailedWithDetails(cx, rv, "HTMLOptionsCollection", "remove"); + xpc_qsThrowMethodFailedWithDetails(cx, rv, "HTMLOptionsCollection", "selectedIndex"); return JS_FALSE; } - *vp = JSVAL_VOID; - return JS_TRUE; + return xpc_qsInt32ToJsval(cx, result, vp); } static JSBool -HTMLOptionsCollection_GetSelectedIndex(JSContext *cx, JSObject *obj, jsid id, jsval *vp) +HTMLOptionsCollection_SetSelectedIndex(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp) { XPC_QS_ASSERT_CONTEXT_OK(cx); if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, NULL)) return false; + int32 arg0; + if (!JS_ValueToECMAInt32(cx, *vp, &arg0)) + return JS_FALSE; nsresult rv; - PRInt32 result; - rv = HTMLOptionsCollectionWrapper::getListObject(obj)->GetSelectedIndex(&result); + rv = HTMLOptionsCollectionWrapper::getListObject(obj)->SetSelectedIndex(arg0); if (NS_FAILED(rv)) { xpc_qsThrowMethodFailedWithDetails(cx, rv, "HTMLOptionsCollection", "selectedIndex"); return JS_FALSE; } - return xpc_qsInt32ToJsval(cx, result, vp); + return JS_TRUE; } static JSBool -HTMLOptionsCollection_SetSelectedIndex(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp) +HTMLOptionsCollection_NamedItem(JSContext *cx, uintN argc, jsval *vp) { XPC_QS_ASSERT_CONTEXT_OK(cx); - if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, NULL)) + JSObject *obj = JS_THIS_OBJECT(cx, vp); + if (!obj) + return JS_FALSE; + JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); + if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, callee)) + return false; + if (argc < 1) + return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); + jsval *argv = JS_ARGV(cx, vp); + xpc_qsDOMString arg0(cx, argv[0], &argv[0], xpc_qsDOMString::eDefaultNullBehavior, xpc_qsDOMString::eDefaultUndefinedBehavior); + if (!arg0.IsValid()) + return JS_FALSE; + nsWrapperCache *cache; + nsISupports *result; + result = HTMLOptionsCollectionWrapper::getListObject(obj)->GetNamedItem(arg0, &cache); + if (!result) { + *vp = JSVAL_NULL; + return JS_TRUE; + } + return Wrap(cx, obj, result, cache, vp); +} + +static JSBool +HTMLOptionsCollection_Remove(JSContext *cx, uintN argc, jsval *vp) +{ + XPC_QS_ASSERT_CONTEXT_OK(cx); + JSObject *obj = JS_THIS_OBJECT(cx, vp); + if (!obj) + return JS_FALSE; + JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); + if (!HTMLOptionsCollectionWrapper::instanceIsListObject(cx, obj, callee)) return false; + if (argc < 1) + return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); + jsval *argv = JS_ARGV(cx, vp); int32 arg0; - if (!JS_ValueToECMAInt32(cx, *vp, &arg0)) + if (!JS_ValueToECMAInt32(cx, argv[0], &arg0)) return JS_FALSE; nsresult rv; - rv = HTMLOptionsCollectionWrapper::getListObject(obj)->SetSelectedIndex(arg0); + rv = HTMLOptionsCollectionWrapper::getListObject(obj)->Remove(arg0); if (NS_FAILED(rv)) { - xpc_qsThrowMethodFailedWithDetails(cx, rv, "HTMLOptionsCollection", "selectedIndex"); + xpc_qsThrowMethodFailedWithDetails(cx, rv, "HTMLOptionsCollection", "remove"); return JS_FALSE; } + *vp = JSVAL_VOID; return JS_TRUE; } @@ -420,8 +420,8 @@ template<> HTMLOptionsCollectionWrapper::Methods HTMLOptionsCollectionWrapper::sProtoMethods[] = { { s_add_id, HTMLOptionsCollection_Add, 2 }, - { s_namedItem_id, HTMLOptionsCollection_NamedItem, 1 }, { s_item_id, HTMLOptionsCollection_Item, 1 }, + { s_namedItem_id, HTMLOptionsCollection_NamedItem, 1 }, { s_remove_id, HTMLOptionsCollection_Remove, 1 } };
Yeah, if the file is varying between runs something is really broken. Peterv?
It looks like the order it's writing things out it just isn't stable?
Arguably, it should be generated once.
Yes, but generating it multiple times should generate the same file, IMO.
So, one half of the problem is the script not being stable, the other half is make maybe_clobber_profiledbuild between the two passes. Bug 659311 would take care of the latter.
Blocks: 648801
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #15) > Yes, but generating it multiple times should generate the same file, IMO. That was certainly the intent.
Assignee: nobody → peterv
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch v1 (deleted) — Splinter Review
Could someone try this patch and see if that fixes it?
(In reply to Peter Van der Beken [:peterv] from comment #18) > Created attachment 566319 [details] [diff] [review] [diff] [details] [review] > v1 > > Could someone try this patch and see if that fixes it? Yes, it does fix the issue. Many thanks.
Comment on attachment 566319 [details] [diff] [review] v1 This just sorts the properties by name, so we always write them out in the same order.
Attachment #566319 - Flags: review?(jst)
Assignee: peterv → nobody
Product: Firefox → Core
QA Contact: build.config → build-config
Assignee: nobody → peterv
Component: Build Config → DOM
OS: Linux → All
QA Contact: build-config → general
Hardware: x86_64 → All
Summary: coverage-mismatch in dombindings_gen.cpp:546:1 (profiledbuild) → Generating dombindings_gen.cpp multiple times results in a different file
Attachment #566319 - Flags: review?(jst) → review+
(In reply to Octoploid from comment #19) > (In reply to Peter Van der Beken [:peterv] from comment #18) > > Created attachment 566319 [details] [diff] [review] [diff] [details] [review] [diff] [details] [review] > > v1 > > > > Could someone try this patch and see if that fixes it? > > Yes, it does fix the issue. Many thanks. Me too. Thanks for great work.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: