[Webkit-unassigned] [Bug 118242] New: Fix cast-align warnings in JavaScriptCore/heap/HandleBlockInlines.h

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 1 06:35:50 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=118242

           Summary: Fix cast-align warnings in
                    JavaScriptCore/heap/HandleBlockInlines.h
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ossy at webkit.org
                CC: ggaren at apple.com, mhahnenberg at apple.com


/home/oszi/Source/JavaScriptCore/heap/HandleBlockInlines.h:58:51: warning: cast from 'char*' to 'JSC::HandleNode*' increases required alignment of target type [-Wcast-align]

This code introduced in http://trac.webkit.org/changeset/146734 :

...
inline char* HandleBlock::payload()
{
    return reinterpret_cast<char*>(this) + WTF::roundUpToMultipleOf<sizeof(double)>(sizeof(HandleBlock));
}

inline HandleNode* HandleBlock::nodes()
{
    return reinterpret_cast<HandleNode*>(payload());    <------ line 58
}
...

This part of JSC isn't quite clear for me. As far as I understand a 
HandleBlock is 4K sized block on JSC heap, which contains HandleNode 
instances on int payload. And the payload is 64 bit aligned after
the HandleBlock instance. Am I correct?

If yes, I think this casting is safe and can be supressed by using
reinterpret_cast_ptr instead of reinterpret_cast, because HandleNode
has two following members: JSValue, HandleNode* and HandleNode* .

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list