Bug 197062 - Add option to dump JIT memory
Summary: Add option to dump JIT memory
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tadeu Zagallo
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-18 09:52 PDT by Tadeu Zagallo
Modified: 2019-04-19 14:47 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.36 KB, patch)
2019-04-18 14:55 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch for landing (5.36 KB, patch)
2019-04-19 13:58 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tadeu Zagallo 2019-04-18 09:52:13 PDT
...
Comment 1 Tadeu Zagallo 2019-04-18 14:55:19 PDT
Created attachment 367762 [details]
Patch
Comment 2 Tadeu Zagallo 2019-04-18 14:56:11 PDT
<rdar://problem/49744332>
Comment 3 Saam Barati 2019-04-19 09:55:25 PDT
Comment on attachment 367762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367762&action=review

> Source/JavaScriptCore/assembler/LinkBuffer.cpp:264
> +        dumpJITMemory(outData, outData, m_executableMemory->sizeInBytes());

I think you want m_size here

> Source/JavaScriptCore/jit/ExecutableAllocator.cpp:565
> +            ASSERT(fd != -1);

RELEASE_ASSERT

> Source/JavaScriptCore/jit/ExecutableAllocator.cpp:583
> +        if (UNLIKELY(offset + size > bufferSize))

It’s unlikely this would happen, but you should just make the buffer size the size of the jit memory pool. That way you’re guaranteed there is enough space in it. This code here is wrong if a jitmemcpy copies > 32MB
Comment 4 Tadeu Zagallo 2019-04-19 13:56:50 PDT
Comment on attachment 367762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367762&action=review

Thanks for the review!

>> Source/JavaScriptCore/jit/ExecutableAllocator.cpp:583
>> +        if (UNLIKELY(offset + size > bufferSize))
> 
> It’s unlikely this would happen, but you should just make the buffer size the size of the jit memory pool. That way you’re guaranteed there is enough space in it. This code here is wrong if a jitmemcpy copies > 32MB

Yeah, I thought it was unlikely enough that it shouldn't matter, but I'll switch it to use `fixedExecutableMemoryPoolSize` instead.
Comment 5 Tadeu Zagallo 2019-04-19 13:58:02 PDT
Created attachment 367821 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2019-04-19 14:47:38 PDT
Comment on attachment 367821 [details]
Patch for landing

Clearing flags on attachment: 367821

Committed r244470: <https://trac.webkit.org/changeset/244470>
Comment 7 WebKit Commit Bot 2019-04-19 14:47:39 PDT
All reviewed patches have been landed.  Closing bug.