Closed Bug 587823 Opened 14 years ago Closed 14 years ago

Convert MethodInfo flags into bitfield

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stejohns, Assigned: stejohns)

References

Details

Attachments

(1 file, 1 obsolete file)

The 32-bit flags field in MethodInfo is now full, and a few more bits will be necessary. Lars suggests this is a good opportunity to convert them into bitfields.
Attached patch Patch (obsolete) — Splinter Review
Straightforward implementation.
Assignee: nobody → stejohns
Attachment #466492 - Flags: superreview?(edwsmith)
Attachment #466492 - Flags: review?(lhansen)
Comment on attachment 466492 [details] [diff] [review] Patch R- for all the naming concerns listed below; the functionality seems fine however. Naming concerns: _isOnlyUntypedParameters appears misnamed; _hasOnlyUntypedParameters would be better (cf _hasParamNames) or _onlyUntypedParameters; the predicate is called onlyUntypedParameters(). _isLazyRest appears misnamed; _hasLazyRest would be better, or _lazyRest; the predicate is called lazyRest(). This might be a good time to come up with a better name for _isAbstractMethod, since actual abstract methods are on their way. (The predicate is called hasMethodBody.) isCompiledMethod and setCompiledMethod are misnamed, isAotCompiledMethod and setAotCompiledMethods would be appropriate. In general there does not seem to be a good correspondence between flag names and their setters/getters, even when the latter are straightforward; this is confusing. (The flag is _needsActivation but the predicate is needActivation is just one more example, ditto _needsArguments / needArguments, _needsClosure / needClosure, _needsRest / needRest.) Style nits: The parens in BaseExecMgr::isVerified and BaseExecMgr::isVerifyPending are superflous.
Attachment #466492 - Flags: review?(lhansen) → review-
Attachment #466492 - Flags: superreview?(edwsmith)
"is" vs "has" is nitworthy IMO in the situations you mention, but no worries, I'll fix and resubmit. Agree with other concerns (esp. isAbstractMethod).
Blocks: 570521
Comment on attachment 466492 [details] [diff] [review] Patch What's the point of, e.g. uint32_t _needsArguments:1; Since the :1 specifies the size, is "unsigned" good enough?
Good question. Gut feeling: "unsigned" is probably not good enough if you're hand-counting bytes in order to get alignment right - but my assumption is that if you use uint32_t the bits will be packed in uint32_t units. That may not be true!
I'm guessing "unsigned" is fine, but in the absence of clear evidence that it's in some way superior, I'm using C99 int types...
Attached patch Patch v2Splinter Review
Revised with more uniform naming.
Attachment #466492 - Attachment is obsolete: true
Attachment #467091 - Flags: review?(lhansen)
Comment on attachment 467091 [details] [diff] [review] Patch v2 Skimmed it this time, looks good.
Attachment #467091 - Flags: review?(lhansen) → review+
Blocks: 584834
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
(In reply to comment #6) > I'm guessing "unsigned" is fine, but in the absence of clear evidence that it's > in some way superior, I'm using C99 int types... Here's one piece of evidence in favor of "signed int" and "unsigned int" over any typedefs, specifically for bitfields: Just happens that a bug was just fixed in nanojit related to this -- the explicit "signed" keyword had to be added. the author defended it with some research: https://bugzilla.mozilla.org/show_bug.cgi?id=584219#c18 Now, it could be that an explicit "uint32_t" will guarantee unsigned, but from the evidence in that comment, its not the case that an explicit "int32_t" will guarantee signed, because plain int, or a typedef, gives impl-defined behavior. so i'm guessing in some circles, with bitfields, folks favor explicit 'signed' and 'unsigned' keywords since the int-ness and size-ness is already part of the bitfield syntax. I certianly dont feel strongly about this. but since the above comment just came across the wire, i figured i'd copy the reference.
Fascinating. No doubt it would be interesting to track down the historical baggage for that particular bit of spec language. Would perhaps also be interesting to consider defining bit_t which is guaranteed to be an unsigned bit field: bit_t _lazyRest:1 The appeal would be the ability to massage the definition of bit_t to guarantee that bit fields are laid out in known-size (32-bit) chunks even on 64-bit platforms. But maybe that's just not something we can assume to be able to do. I'm not really advocating it - I'm happy to just do 'unsigned' everywhere and be done.
bits_t sounds like a good idea to me, but I'd argue that we'd want to change all bit field references in the code in one shot rather than have inconsistent usage. Not to imply that Lars was saying otherwise, just pointing it out.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: