Closed Bug 1257148 Opened 4 years ago Closed 4 years ago

[Static Analysis][Excessive padding] In structure txEXSLTFunctionDescriptor

Categories

(Core :: XSLT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: clang-analyzer)

Attachments

(1 file)

The Static Analysis tool scan-build added that excessive padding is added to structure txEXSLTFunctionDescriptor when compiled on 64bit system. 

>>	struct txEXSLTFunctionDescriptor
>>	{
>>	    int8_t mMinParams;
>>	    int8_t mMaxParams;
>>	    Expr::ResultType mReturnType;
>>	    nsIAtom** mName;
>>	    int32_t mNamespaceID;
>>	    const char* mNamespaceURI;
>>	};

This is due to the fact than on 64bit systems pointer size is 8bytes and without proper ordering this structure weighs in 32bytes, this is because two alignment paddings, of 4 bytes each, are added after |mReturnType| and |mNamespaceID| in order to align pointers that follow, ideally the size of this is 24 byes:

>>struct txEXSLTFunctionDescriptor
>>{
>>    int8_t mMinParams;
>>    int8_t mMaxParams;
>>    Expr::ResultType mReturnType;
>>    int32_t mNamespaceID;
>>    nsIAtom** mName;
>>    const char* mNamespaceURI;
>>};

The size of the structure is specially important on ARM devices that have low cache levels and as we have the same code-debase with fennec/Android i think this should be very useful to solve now for the time when we will distribute 64bit arm binaries.
Comment on attachment 8731199 [details]
MozReview Request: Bug 1257148 - correctly align structure txEXSLTFunctionDescriptor. r?peterv

https://reviewboard.mozilla.org/r/40425/#review37453
Attachment #8731199 - Flags: review?(peterv) → review+
https://hg.mozilla.org/mozilla-central/rev/9f11935709f6
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.