Closed Bug 492257 Opened 15 years ago Closed 12 years ago

Find classes with PRBool members

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: Swatinem, Unassigned)

References

Details

Attachments

(1 file)

PRBool is 3 bytes larger than PRPackedbool and therefore shouldn't be used for class members.

This is a list of all those class members, generated using a newer version of my dehydra script from bug 492185.
Attachment #376619 - Attachment mime type: application/octet-stream → text/plain
I don't think this is a consistent rule: I'm pretty sure there are stats which say that reading word-sized values improves performance compared to reading byte-sized values, so we should only be using PRPackedBool in cases where the memory overhead would be sizable.

Frankly though, I think we should switch to bool througout our codebase except for XPCOM interface definitions where the binary size matters.
(In reply to comment #1)

> Frankly though, I think we should switch to bool througout our codebase except
> for XPCOM interface definitions where the binary size matters.

I agree. I'd say the safety benefits C++ bools is reason enough to switch to bool for internal interfaces.

As for finding prbools, I think it's more useful to have a 3rd column in analysis results in bug 492185 showing possible size reduction resulting in switching to "optimized" datatypes instead of a separate analysis.
There's another "ABI"-ish requirement to use JSBool instead of bool, for nanojit builtin function return type. See bug 453361.

/be
Depends on: 509380
There was a large rewrite some time ago to replace PRBool usage with c++ bools, so calling this INVALID.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: