Closed Bug 417634 Opened 16 years ago Closed 12 years ago

JSTracer not binary compatible between DEBUG and non-DEBUG

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dbaron, Unassigned)

Details

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.
DEBUG/non-DEBUG ABI compat is not a general SM goal.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.