RESOLVED FIXED 191062
Align entries in metadata table
https://bugs.webkit.org/show_bug.cgi?id=191062
Summary Align entries in metadata table
Dominik Inführ
Reported 2018-10-30 05:04:33 PDT
Align entries in metadata table
Attachments
Patch (4.65 KB, patch)
2018-10-30 05:05 PDT, Dominik Inführ
no flags
Patch (4.71 KB, patch)
2018-10-30 08:46 PDT, Dominik Inführ
no flags
Patch (4.83 KB, patch)
2018-10-30 16:57 PDT, Dominik Inführ
no flags
Dominik Inführ
Comment 1 2018-10-30 05:05:47 PDT
Dominik Inführ
Comment 2 2018-10-30 05:08:02 PDT
This is necessary for some 32-bit architectures that don't support most unaligned accesses.
Tadeu Zagallo
Comment 3 2018-10-30 05:17:28 PDT
I'm not officially a reviewer, so I can't r+ the patch, but looks good to me. However, we probably only want to do that for the platforms that don't like the unaligned accesses.
Dominik Inführ
Comment 4 2018-10-30 07:05:26 PDT
Thanks for taking a looking! I was also wondering about the same thing, in the end I aligned the metadata on all platforms since unaligned accesses are not free there either and just aligning shouldn't increase memory usage too much. What do you think?
Filip Pizlo
Comment 5 2018-10-30 08:11:48 PDT
(In reply to Dominik Inführ from comment #4) > Thanks for taking a looking! I was also wondering about the same thing, in > the end I aligned the metadata on all platforms since unaligned accesses are > not free there either and just aligning shouldn't increase memory usage too > much. What do you think? It should be optional. Unaligned accesses are effectively free on some platforms.
Dominik Inführ
Comment 6 2018-10-30 08:46:48 PDT
Dominik Inführ
Comment 7 2018-10-30 08:49:44 PDT
Great, I made the alignment optional on CPU(NEEDS_ALIGNED_MEMORY).
Yusuke Suzuki
Comment 8 2018-10-30 15:47:37 PDT
Comment on attachment 353371 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353371&action=review > Source/JavaScriptCore/bytecode/Opcode.cpp:202 > +static unsigned metadataAlignments[] = { > + > +#define METADATA_ALIGNMENT(size) size, > + FOR_EACH_BYTECODE_METADATA_ALIGNMENT(METADATA_ALIGNMENT) > +#undef METADATA_ALIGNMENT > + > +}; This data is not necessary if `CPU(NEEDS_ALIGNED_ACCESS)` is false. Let's guard with this condition and drop this data from the binary. > Source/JavaScriptCore/bytecode/Opcode.cpp:212 > +unsigned metadataAlignment(OpcodeID opcodeID) > +{ > + return metadataAlignments[opcodeID]; > +} Ditto.
Keith Miller
Comment 9 2018-10-30 15:58:06 PDT
Comment on attachment 353371 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353371&action=review > Source/JavaScriptCore/bytecode/MetadataTable.h:59 > + for (; metadata + 1 <= end; ++metadata) Can we make this metadata < end?
Dominik Inführ
Comment 10 2018-10-30 16:57:57 PDT
Dominik Inführ
Comment 11 2018-10-30 17:03:05 PDT
I've updated the patch, metadataAlignment is now only included if aligned memory access is required. @Keith: Not sure I can write this condition like this. Please correct me if I am wrong but wouldn't `metadata < end` run one iteration too often if there is an alignment gap at the end?
Keith Miller
Comment 12 2018-10-30 18:15:28 PDT
(In reply to Dominik Inführ from comment #11) > I've updated the patch, metadataAlignment is now only included if aligned > memory access is required. > > @Keith: Not sure I can write this condition like this. Please correct me if > I am wrong but wouldn't `metadata < end` run one iteration too often if > there is an alignment gap at the end? Yeah, nvm ignore me.
WebKit Commit Bot
Comment 13 2018-10-31 09:09:15 PDT
Comment on attachment 353439 [details] Patch Clearing flags on attachment: 353439 Committed r237638: <https://trac.webkit.org/changeset/237638>
WebKit Commit Bot
Comment 14 2018-10-31 09:09:17 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15 2018-10-31 09:10:31 PDT
Note You need to log in before you can comment on or make changes to this bug.