Closed
Bug 396936
Opened 18 years ago
Closed 18 years ago
FLAGP_TO_THING not typesafe in C++
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.9beta1
People
(Reporter: benjamin, Assigned: benjamin)
References
Details
Attachments
(1 file)
1.88 KB,
patch
|
brendan
:
review+
igor
:
review+
brendan
:
approval1.9+
|
Details | Diff | Splinter Review |
Uses of FLAGP_TO_THING macro don't compile in C++ unless you cast the result to JSGCThing*. But since all uses actually want a JSGCThing*, we should just make the macro do the work. This fixes a mozilla-central compile error intoduced by bug 394709
Attachment #281696 -
Flags: review?(brendan)
Attachment #281696 -
Flags: approval1.9?
Comment 1•18 years ago
|
||
Comment on attachment 281696 [details] [diff] [review]
Fix FLAGP_TO_THING, rev. 1
>diff -r ec7c5dd6bb66 js/src/jsgc.cpp
>--- a/js/src/jsgc.cpp Thu Sep 20 14:40:41 2007 -0400
>+++ b/js/src/jsgc.cpp Thu Sep 20 14:45:26 2007 -0400
>@@ -336,7 +336,7 @@ static JSBool js_gcUseMmap = JS_FALSE;
> #define FLAGP_TO_THING(flagp, thingSize) \
> (JS_ASSERT(((jsuword) (flagp) & GC_ARENA_MASK) >= \
> (ARENA_INFO_OFFSET - THINGS_PER_ARENA(thingSize))), \
>- (void *)(((jsuword) (flagp) & ~GC_ARENA_MASK) + \
>+ (JSGCThing *)(((jsuword) (flagp) & ~GC_ARENA_MASK) + \
> (thingSize) * FLAGP_TO_INDEX(flagp)))
Indent the overflow line to underhang the left operand of + (so the (thingSize) * ... starts in the same column as the second left parenthesis after the cast on the first line).
Igor is really the guy to r+ this but I think he won't mind if I do. Leaving addl. review set but this can go in with the style fix ASAP.
/be
Attachment #281696 -
Flags: review?(igor)
Attachment #281696 -
Flags: review?(brendan)
Attachment #281696 -
Flags: review+
Attachment #281696 -
Flags: approval1.9?
Attachment #281696 -
Flags: approval1.9+
Comment 2•18 years ago
|
||
Type safety is not the issue, since the FLAGP_TO_THING macro hides a C-style cast based on address arithmetic magic. But it's good to consolidate the (JSGCThing *) cast, and avoid expanding it in 3 of 4 call sites.
/be
Assignee | ||
Updated•18 years ago
|
Updated•18 years ago
|
Attachment #281696 -
Flags: review?(igor) → review+
Assignee | ||
Comment 3•18 years ago
|
||
Fixed on CVS trunk.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•