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 175141
The allocator used to allocate memory for MarkedBlocks and LargeAllocations should not be the Subspace itself
https://bugs.webkit.org/show_bug.cgi?id=175141
Summary
The allocator used to allocate memory for MarkedBlocks and LargeAllocations s...
Filip Pizlo
Reported
2017-08-03 11:20:23 PDT
Patch forthcoming.
Attachments
it's a start
(51.47 KB, patch)
2017-08-03 11:59 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(59.35 KB, patch)
2017-08-03 12:38 PDT
,
Filip Pizlo
mark.lam
: review+
Details
Formatted Diff
Diff
patch for landing
(59.48 KB, patch)
2017-08-03 13:30 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
patch for landing
(59.52 KB, patch)
2017-08-03 14:10 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Filip Pizlo
Comment 1
2017-08-03 11:59:41 PDT
Created
attachment 317136
[details]
it's a start
Filip Pizlo
Comment 2
2017-08-03 12:38:34 PDT
Created
attachment 317139
[details]
the patch
Build Bot
Comment 3
2017-08-03 12:41:31 PDT
Attachment 317139
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/heap/AlignedMemoryAllocator.h:39: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.h:41: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] ERROR: Source/JavaScriptCore/heap/FastMallocAlignedMemoryAllocator.h:38: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 4 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 4
2017-08-03 12:58:32 PDT
Comment on
attachment 317139
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
r=me with suggestions.
> Source/JavaScriptCore/heap/MarkedBlock.cpp:337 > + RELEASE_ASSERT(m_allocator->subspace()->alignedMemoryAllocator() == m_alignedMemoryAllocator);
just use subspace() instead of m_allocator->subspace().
> Source/JavaScriptCore/heap/MarkedBlock.cpp:400 > +Subspace* MarkedBlock::Handle::subspace() const > +{ > + return allocator()->subspace(); > +}
Is there any reason this should not be an inline function?
Mark Lam
Comment 5
2017-08-03 12:59:58 PDT
Comment on
attachment 317139
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
> Source/JavaScriptCore/heap/AlignedMemoryAllocator.h:39 > + virtual void* tryAllocateAlignedMemory(size_t alignment, size_t size) = 0;
Please also fix the style-checker complaint and remove the unneeded size label.
> Source/JavaScriptCore/heap/FastMallocAlignedMemoryAllocator.h:38 > + void* tryAllocateAlignedMemory(size_t alignment, size_t size) override;
Please also fix the style-checker complaint and remove the unneeded size label.
> Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.h:41 > + void* tryAllocateAlignedMemory(size_t alignment, size_t size) override;
Please also fix the style-checker complaint and remove the unneeded size label.
Mark Lam
Comment 6
2017-08-03 13:26:47 PDT
Comment on
attachment 317139
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:902 > + 0FEC3C571F33A45300F59B6C /* FastMallocAlignedMemoryAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC3C551F33A45300F59B6C /* FastMallocAlignedMemoryAllocator.h */; };
You need to give this the Private attribute in Xcode (or do what the entry for VM.h does).
Filip Pizlo
Comment 7
2017-08-03 13:28:44 PDT
(In reply to Mark Lam from
comment #5
)
> Comment on
attachment 317139
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
> > > Source/JavaScriptCore/heap/AlignedMemoryAllocator.h:39 > > + virtual void* tryAllocateAlignedMemory(size_t alignment, size_t size) = 0; > > Please also fix the style-checker complaint and remove the unneeded size > label. > > > Source/JavaScriptCore/heap/FastMallocAlignedMemoryAllocator.h:38 > > + void* tryAllocateAlignedMemory(size_t alignment, size_t size) override; > > Please also fix the style-checker complaint and remove the unneeded size > label. > > > Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.h:41 > > + void* tryAllocateAlignedMemory(size_t alignment, size_t size) override; > > Please also fix the style-checker complaint and remove the unneeded size > label.
I think that the style checker is wrong here. It's true that the word "size" appears in the type "size_t", but since this is a memory allocation and one of the size_t's is named alignment, it's a lot clearer to name the other one "size".
Filip Pizlo
Comment 8
2017-08-03 13:29:28 PDT
(In reply to Mark Lam from
comment #6
)
> Comment on
attachment 317139
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
> > > Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:902 > > + 0FEC3C571F33A45300F59B6C /* FastMallocAlignedMemoryAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC3C551F33A45300F59B6C /* FastMallocAlignedMemoryAllocator.h */; }; > > You need to give this the Private attribute in Xcode (or do what the entry > for VM.h does).
Fixed!
Filip Pizlo
Comment 9
2017-08-03 13:30:04 PDT
Created
attachment 317145
[details]
patch for landing
Build Bot
Comment 10
2017-08-03 13:32:30 PDT
Attachment 317145
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/heap/AlignedMemoryAllocator.h:39: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.h:41: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] ERROR: Source/JavaScriptCore/heap/FastMallocAlignedMemoryAllocator.h:38: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 4 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 11
2017-08-03 14:10:25 PDT
Created
attachment 317150
[details]
patch for landing More build fixing
Build Bot
Comment 12
2017-08-03 14:11:51 PDT
Attachment 317150
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/heap/AlignedMemoryAllocator.h:39: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/heap/GigacageAlignedMemoryAllocator.h:41: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] ERROR: Source/JavaScriptCore/heap/FastMallocAlignedMemoryAllocator.h:38: The parameter name "size" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 4 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 13
2017-08-03 14:15:59 PDT
(In reply to Mark Lam from
comment #4
)
> Comment on
attachment 317139
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=317139&action=review
> > r=me with suggestions. > > > Source/JavaScriptCore/heap/MarkedBlock.cpp:337 > > + RELEASE_ASSERT(m_allocator->subspace()->alignedMemoryAllocator() == m_alignedMemoryAllocator); > > just use subspace() instead of m_allocator->subspace().
I fixed it to say allocator->subspace(), and I moved it to before where we set m_allocator. It feels nicer to validate before making changes.
> > > Source/JavaScriptCore/heap/MarkedBlock.cpp:400 > > +Subspace* MarkedBlock::Handle::subspace() const > > +{ > > + return allocator()->subspace(); > > +} > > Is there any reason this should not be an inline function?
It totally can be! This is actually a revert. This is how it worked before I did the block trading patch in the last week or so. In general, these per-block functions can usually be out-of-line because very few of them are on hot paths, or they are only on hot paths that are in the MarkedBlock.cpp module anyway. I have a slight out-of-line bias because when debugging it's nice to have out-of-line functions to instrument since it means not having to rebuild the world.
Filip Pizlo
Comment 14
2017-08-04 13:51:11 PDT
Landed in
https://trac.webkit.org/changeset/220291/webkit
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