JSTracer not binary compatible between DEBUG and non-DEBUG

RESOLVED WONTFIX

Status

()

Core
JavaScript Engine
RESOLVED WONTFIX
10 years ago
5 years ago

People

(Reporter: dbaron, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
I mentioned this to brendan, and he suggested I file a bug.  The JSTracer printing stuff makes JSTracer use not binary-compatible between DEBUG and non-DEBUG builds.  This is because it has a bunch of #ifdef DEBUG member variables at the end of the structure.

To make leak-monitor 0.4.1 work with both DEBUG and non-DEBUG builds (when compiled as either), I had to do the following (see full source code at http://dbaron.org/mozilla/leak-monitor/ ):

#ifndef DEBUG
typedef void
(* JS_DLL_CALLBACK JSTraceNamePrinter)(JSTracer *trc, char *buf,
                                       size_t bufsize);
#endif

struct TracerWithData : public JSTracer {
#ifndef DEBUG
        /*
         * Include the DEBUG-only tail of JSTracer in non-DEBUG builds so we
         * can be binary-compatible with both.
         */
        JSTraceNamePrinter  debugPrinter;
        const void          *debugPrintArg;
        size_t              debugPrintIndex;
#endif
        FindGCRootData *data;
};


and then (right before my JS_TraceRuntime call):

                TracerWithData trc;
                /*
                 * We want to be binary-compatible with DEBUG and non-DEBUG builds,
                 * so manually expand JS_TRACER_INIT here.
                 */
                trc.context = mJSContext;
                trc.callback = GCRootTracer;
                trc.debugPrinter = NULL;
                trc.debugPrintArg = NULL;
                trc.debugPrintIndex = (size_t)-1;


which seems like quite a few hoops to jump through.

Comment 1

5 years ago
DEBUG/non-DEBUG ABI compat is not a general SM goal.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.