Closed Bug 481673 Opened 15 years ago Closed 15 years ago

JS_Assert is C++-name-mangled in non-DEBUG builds

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

(Keywords: fixed1.9.1, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

The extern "C" declaration in jsutil.h is DEBUG-only, but the function is (intentionally) always defined regardless of DEBUG.

As a result, applications built DEBUG will not link against a non-DEBUG SpiderMonkey.
Attached patch v1Splinter Review
Assignee: general → jorendorff
Status: NEW → ASSIGNED
Attachment #365679 - Flags: review?(brendan)
Wes points out that one problem DEBUG applications will have calling a non-DEBUG SM is that JSTracer's size depends on #ifdef DEBUG.  We could just remove that #ifdef and JSTracer would sometimes have a few useless fields; it should not hurt performance.

Or maybe refusing to link in this case is a feature, not a bug.  But I'm not quite prepared to admit that yet.  Brendan?
This bug's an easy fix.

The JSTracer struct size varying with DEBUG is a bug, should have caught that years ago when it went in. Igor, you agree?

/be
Wes may not run into this, but IIRC on Windows, at least with the standard debug and release CRTs, you can't mix DEBUG and NDEBUG code compiled and packaged into libraries safely. Benjamin knows all.

/be
Attachment #365679 - Flags: review?(brendan) → review+
Flags: wanted1.9.1?
Flags: wanted1.9.1? → wanted1.9.1+
You can, as long as you don't mismatch allocators or pass FILE* across the boundaries. I think JS should be safe in that regard.
Mismatched allocators is all too easy, since SpiderMonkey was designed for one true malloc and allows JS_malloc | free and malloc | JS_free.

/be
FWIW: I was hit by this problem and discussed it with Wes and to some extent Jorendorff on IRC.

The patch by Jorendorff solves our problems; compiles and passes all our tests.

Thanks a bunch.
http://hg.mozilla.org/tracemonkey/rev/87a4c653c637
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/87a4c653c637
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: