WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 214389
[WTF] Remove the unnecessary inner class DefaultHash<T>::Hash
https://bugs.webkit.org/show_bug.cgi?id=214389
Summary
[WTF] Remove the unnecessary inner class DefaultHash<T>::Hash
Fujii Hironori
Reported
2020-07-15 17:50:20 PDT
[WTF] Remove the unnecessary inner class DefaultHash<T>::Hash This is a problem for forward declaration (
Bug 214320 Comment 5
).
Attachments
Patch
(158.33 KB, patch)
2020-07-15 18:00 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(158.20 KB, patch)
2020-07-15 18:33 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(158.83 KB, patch)
2020-07-15 20:09 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(159.50 KB, patch)
2020-07-15 22:12 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2020-07-15 18:00:18 PDT
Created
attachment 404408
[details]
Patch
EWS Watchlist
Comment 2
2020-07-15 18:01:02 PDT
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Mark Lam
Comment 3
2020-07-15 18:11:05 PDT
Comment on
attachment 404408
[details]
Patch r- because the patch is causing lots of failures.
Fujii Hironori
Comment 4
2020-07-15 18:33:44 PDT
Created
attachment 404413
[details]
Patch
Fujii Hironori
Comment 5
2020-07-15 19:03:24 PDT
DefaultHash<T>::Hash was added by
r12329
.
Fujii Hironori
Comment 6
2020-07-15 20:09:44 PDT
Created
attachment 404415
[details]
Patch
Fujii Hironori
Comment 7
2020-07-15 22:12:55 PDT
Created
attachment 404422
[details]
Patch
Darin Adler
Comment 8
2020-07-16 08:29:29 PDT
Comment on
attachment 404422
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404422&action=review
> Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:532 > +template<JSC::PtrTag tag> struct DefaultHash<JSC::MacroAssemblerCodePtr<tag>> : JSC::MacroAssemblerCodePtrHash<tag> { };
Can we use "using" here instead of inheritance? I’d rather not have a separate DefaultHash that is not the same as MacroAssemblerCodePtrHash, in case that might result in a little code bloat. Same question about the many other places below where we define a new struct/class instead of doing "using".
Darin Adler
Comment 9
2020-07-16 08:30:11 PDT
Looks like a good idea, that is working out well. Please consider my suggestion.
Fujii Hironori
Comment 10
2020-07-16 12:49:28 PDT
Comment on
attachment 404422
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404422&action=review
>> Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:532 >> +template<JSC::PtrTag tag> struct DefaultHash<JSC::MacroAssemblerCodePtr<tag>> : JSC::MacroAssemblerCodePtrHash<tag> { }; > > Can we use "using" here instead of inheritance? I’d rather not have a separate DefaultHash that is not the same as MacroAssemblerCodePtrHash, in case that might result in a little code bloat. > > Same question about the many other places below where we define a new struct/class instead of doing "using".
I also had the same idea, but it doesn't work. It should be a template specialization of DefaultHash.
Darin Adler
Comment 11
2020-07-16 12:54:46 PDT
Comment on
attachment 404422
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404422&action=review
>>> Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:532 >>> +template<JSC::PtrTag tag> struct DefaultHash<JSC::MacroAssemblerCodePtr<tag>> : JSC::MacroAssemblerCodePtrHash<tag> { }; >> >> Can we use "using" here instead of inheritance? I’d rather not have a separate DefaultHash that is not the same as MacroAssemblerCodePtrHash, in case that might result in a little code bloat. >> >> Same question about the many other places below where we define a new struct/class instead of doing "using". > > I also had the same idea, but it doesn't work. > It should be a template specialization of DefaultHash.
This, then, points to the benefit of the old scheme. The DefaultHash expression evaluated to a type, and it could also be specified directly, and in both cases it’s the same type. With this new scheme, DefaultHash itself is a separate type. So that could lead to a bit of extra code bloat. Maybe in practice that’s not a problem. I like the benefits of this for reducing the need for class definitions, and that it’s simpler. I’d like to hear from C++ template meta programming efforts.
Darin Adler
Comment 12
2020-07-16 12:59:35 PDT
Comment on
attachment 404422
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404422&action=review
>>>> Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:532 >>>> +template<JSC::PtrTag tag> struct DefaultHash<JSC::MacroAssemblerCodePtr<tag>> : JSC::MacroAssemblerCodePtrHash<tag> { }; >>> >>> Can we use "using" here instead of inheritance? I’d rather not have a separate DefaultHash that is not the same as MacroAssemblerCodePtrHash, in case that might result in a little code bloat. >>> >>> Same question about the many other places below where we define a new struct/class instead of doing "using". >> >> I also had the same idea, but it doesn't work. >> It should be a template specialization of DefaultHash. > > This, then, points to the benefit of the old scheme. The DefaultHash expression evaluated to a type, and it could also be specified directly, and in both cases it’s the same type. > > With this new scheme, DefaultHash itself is a separate type. So that could lead to a bit of extra code bloat. Maybe in practice that’s not a problem. > > I like the benefits of this for reducing the need for class definitions, and that it’s simpler. > > I’d like to hear from C++ template meta programming efforts.
experts, not efforts
Fujii Hironori
Comment 13
2020-07-16 17:33:42 PDT
Comment on
attachment 404422
[details]
Patch Clearing flags on attachment: 404422 Committed
r264488
: <
https://trac.webkit.org/changeset/264488
>
Fujii Hironori
Comment 14
2020-07-16 17:33:46 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15
2020-07-16 17:34:20 PDT
<
rdar://problem/65698688
>
Mark Lam
Comment 16
2020-07-16 18:16:46 PDT
(In reply to Fujii Hironori from
comment #13
)
> Comment on
attachment 404422
[details]
> Patch > > Clearing flags on attachment: 404422 > > Committed
r264488
: <
https://trac.webkit.org/changeset/264488
>
I thought Darin said that we should not go with this approach of subclassing. Am I missing something?
Fujii Hironori
Comment 17
2020-07-16 18:21:06 PDT
Darin didn't object to the subclassing. (In reply to Darin Adler from
comment #11
)
> I like the benefits of this for reducing the need for class definitions, and > that it’s simpler.
Darin Adler
Comment 18
2020-07-17 08:07:40 PDT
(In reply to Mark Lam from
comment #16
)
> (In reply to Fujii Hironori from
comment #13
) > I thought Darin said that we should not go with this approach of > subclassing. Am I missing something?
I suggested another approach, and he explained that he tried it and it did not work.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug