Closed Bug 770253 Opened 13 years ago Closed 13 years ago

Fix compile of skipRoots with unlucky --enable combinations

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: sfink, Assigned: sfink)

Details

(Whiteboard: [js:t])

Attachments

(2 files, 2 obsolete files)

I recently broke the root analysis build with a somewhat subtle mis-usage of the various configure option flags: inline void MaybeCheckStackRoots(JSContext *cx) { #ifdef DEBUG JS_ASSERT(!IsRootingUnnecessaryForContext(cx)); # if defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE) void CheckStackRoots(JSContext *cx); CheckStackRoots(cx); # endif #endif } That definition of CheckStackRoots doesn't put it in the correct namespace. So that was kind of dumb of me, and I should have realized I was being too clever, but it also pointed out to me that these chains of #if defined(A) && defined... are getting a little crazy -- and I'm not convinced they're entirely correct either. Wouldn't it be better to put the logic in configure so that this preprocessor stuff reduces to single #ifdef checks? So, for example, #ifdef JSGC_ROOT_ANALYSIS means that root analysis really is enabled; no need to test DEBUG, JS_THREADSAFE, etc. It would mean that a configure run would fail with invalid combinations of flags, and I suspect we might need to update the rooting analysis configuration. Related, right now JSGC_ROOT_ANALYSIS and JSGC_USE_EXACT_ROOTING are treated as independent options. If we are doing the above, I would prefer JSGC_ROOT_ANALYSIS to require JSGC_USE_EXACT_ROOTING. Then Root.h would basically say: class Rooted<T> { #ifdef JSGC_USE_EXACT_ROOTING ... #endif } void MaybeCheckStackRoots() { #ifdef JSGC_ROOT_ANALYSIS CheckStackRoots(); #endif } I might want to make DEBUG an exception, though, since it seems handy to be able to modify your existing configure flags by flipping --enable-debug without worrying about the other flags. I don't think it's necessary to be able to toggle --enable-root-analysis independently, though, especially since it's kind of unexpected at this point whether it'll actually do anything or not (because it's dependent on the other flags.) A 3rd approach would be to have --enable-root-analysis force various other configure options on (or default the others to on, and still do a configure-time check for incompatibilities.) I'm not sure the added magic is a good idea, though.
I'm going to hang some compilation fix bugs off of here since I don't really want to create a mess of minor bugs. Think of them as evidence. :)
Whiteboard: [js:t]
Attachment #638441 - Attachment is obsolete: true
I misunderstood the exact rooting part, and I know I'm not going to get around to doing anything with this bug. So I just want to land this patch so I don't need to keep carrying it around.
Attachment #658965 - Flags: review?(terrence)
Attachment #638440 - Attachment is obsolete: true
Assignee: general → sphink
Summary: Simplify configure option testing → Fix compile of skipRoots with unlucky --enable combinations
Attachment #658965 - Flags: review?(terrence) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: