WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
194648
[JSC] LLIntEntryPoint creates same DirectJITCode for all functions
https://bugs.webkit.org/show_bug.cgi?id=194648
Summary
[JSC] LLIntEntryPoint creates same DirectJITCode for all functions
Caio Lima
Reported
2019-02-14 03:48:10 PST
These objects are essentially the same and seems to be unchanged during execution. We should use singleton to avoid unnecessary allocations. The same applies too all entry points (Function, Eval, Program and Modules).
Attachments
WIP - Patch
(2.16 KB, patch)
2019-02-14 03:52 PST
,
Caio Lima
ews-watchlist
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews105 for mac-highsierra-wk2
(2.91 MB, application/zip)
2019-02-14 05:00 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews126 for ios-simulator-wk2
(2.82 MB, application/zip)
2019-02-14 05:49 PST
,
EWS Watchlist
no flags
Details
WIP - Patch
(2.26 KB, patch)
2019-02-14 10:44 PST
,
Caio Lima
mark.lam
: review-
Details
Formatted Diff
Diff
WIP - Patch
(7.20 KB, patch)
2019-02-15 10:47 PST
,
Caio Lima
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2
(2.73 MB, application/zip)
2019-02-15 13:04 PST
,
EWS Watchlist
no flags
Details
WIP - Patch
(16.80 KB, patch)
2019-02-18 11:19 PST
,
Caio Lima
no flags
Details
Formatted Diff
Diff
WIP - Patch
(17.06 KB, patch)
2019-02-18 12:30 PST
,
Caio Lima
ticaiolima
: review-
ticaiolima
: commit-queue-
Details
Formatted Diff
Diff
Patch
(16.72 KB, patch)
2019-02-18 13:46 PST
,
Caio Lima
no flags
Details
Formatted Diff
Diff
Patch
(21.06 KB, patch)
2019-02-25 06:26 PST
,
Caio Lima
no flags
Details
Formatted Diff
Diff
Patch
(21.18 KB, patch)
2019-03-13 11:46 PDT
,
Caio Lima
no flags
Details
Formatted Diff
Diff
Patch
(22.07 KB, patch)
2019-03-14 14:39 PDT
,
Caio Lima
no flags
Details
Formatted Diff
Diff
Show Obsolete
(11)
View All
Add attachment
proposed patch, testcase, etc.
Caio Lima
Comment 1
2019-02-14 03:52:04 PST
Created
attachment 362008
[details]
WIP - Patch This is just the initial idea. I want to see how bots handle it.
EWS Watchlist
Comment 2
2019-02-14 05:00:43 PST
Comment on
attachment 362008
[details]
WIP - Patch
Attachment 362008
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/11145631
Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 3
2019-02-14 05:00:44 PST
Created
attachment 362009
[details]
Archive of layout-test-results from ews105 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 4
2019-02-14 05:49:40 PST
Comment on
attachment 362008
[details]
WIP - Patch
Attachment 362008
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/11145691
Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 5
2019-02-14 05:49:42 PST
Created
attachment 362010
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Caio Lima
Comment 6
2019-02-14 10:44:23 PST
Created
attachment 362036
[details]
WIP - Patch Testing things on EWS
Mark Lam
Comment 7
2019-02-14 10:48:52 PST
Comment on
attachment 362036
[details]
WIP - Patch This is wrong. The CTIStub thunks are unique per VM. You cannot make it a singleton because it is not shared across VMs. However, I think you can make is one instance per VM.
Caio Lima
Comment 8
2019-02-14 10:52:54 PST
(In reply to Mark Lam from
comment #7
)
> Comment on
attachment 362036
[details]
> WIP - Patch > > This is wrong. The CTIStub thunks are unique per VM. You cannot make it a > singleton because it is not shared across VMs. However, I think you can > make is one instance per VM.
Oh good to know. I'll change this.
Mark Lam
Comment 9
2019-02-14 11:03:52 PST
(In reply to Caio Lima from
comment #8
)
> (In reply to Mark Lam from
comment #7
) > > Comment on
attachment 362036
[details]
> > WIP - Patch > > > > This is wrong. The CTIStub thunks are unique per VM. You cannot make it a > > singleton because it is not shared across VMs. However, I think you can > > make is one instance per VM. > > Oh good to know. I'll change this.
On the other hand, I wonder if there's an opportunity here to turn some of these thinks into singletons since they are only trampolines to jump to C++ code. That would need more careful investigations though.
Caio Lima
Comment 10
2019-02-15 10:47:53 PST
Created
attachment 362129
[details]
WIP - Patch I want to see EWS. Also I have some questions: 1. `CodeBlock::setJITCode` calls `heap()->reportExtraMemoryAllocated(code->size())`. I'm not sure if this is correct now that we are allocating only one DirectJITCode per VM on LLIntEntryCode; 2. I'm using a lock to avoid concurrency on allocation, but IIUC, current clients of `setFunctionEntrypoint` is LLIntSlowpaths and I'm not sure if they can be executed concurrently. In this case, it's better be conservative.
Caio Lima
Comment 11
2019-02-15 11:31:55 PST
(In reply to Mark Lam from
comment #9
)
> (In reply to Caio Lima from
comment #8
) > > (In reply to Mark Lam from
comment #7
) > > > Comment on
attachment 362036
[details]
> > > WIP - Patch > > > > > > This is wrong. The CTIStub thunks are unique per VM. You cannot make it a > > > singleton because it is not shared across VMs. However, I think you can > > > make is one instance per VM. > > > > Oh good to know. I'll change this. > > On the other hand, I wonder if there's an opportunity here to turn some of > these thinks into singletons since they are only trampolines to jump to C++ > code. That would need more careful investigations though.
I'll investigate this. (
https://bugs.webkit.org/show_bug.cgi?id=194715
)
Caio Lima
Comment 12
2019-02-15 11:33:37 PST
It is counter-intuitive, but according to my measuring using massif, the version with this patch is actually taking more memory than baseline version...
EWS Watchlist
Comment 13
2019-02-15 13:04:03 PST
Comment on
attachment 362129
[details]
WIP - Patch
Attachment 362129
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/11162282
New failing tests: fast/viewport/ios/device-width-viewport-after-changing-view-scale.html
EWS Watchlist
Comment 14
2019-02-15 13:04:05 PST
Created
attachment 362148
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Caio Lima
Comment 15
2019-02-18 11:19:42 PST
Created
attachment 362306
[details]
WIP - Patch
Caio Lima
Comment 16
2019-02-18 12:30:01 PST
Created
attachment 362313
[details]
WIP - Patch Lets see EWS.
EWS Watchlist
Comment 17
2019-02-18 12:32:47 PST
Attachment 362313
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/llint/LLIntThunks.cpp:92: More than one command on the same line [whitespace/newline] [4] Total errors found: 1 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Caio Lima
Comment 18
2019-02-18 13:46:24 PST
Created
attachment 362326
[details]
Patch Properly using LazyNeverDestroyed. IIUC, It is possible to have a JITed thunk that is shared among all VMs, mainly in the case of LLIntEntrypoints where the code is always the same. @Mark Lam, do you mind take a look to see if I'm not doing anything wrong here?
Caio Lima
Comment 19
2019-02-20 05:01:37 PST
Even with EWS green, I have some questions about the proposed Patch: 1. `generateThunkWithJumpTo` generates the thunk to jump to enable other JIted code execute. However, I'm having troubles to understand what guarantees this allocated memory will never be destroyed. 2. Let's suppose we have 2 VM's running concurrently (v1 and v2) and v1 executes `functionForCallEntryThunk` for the first time. The thunk will be allocated and installed under `v1` execution and then `v2` also calls `functionForCallEntryThunk` afterwards. It will not execute `generateThunkWithJumpTo` because it is already generated and then we return the same value we returned to `v1` before. Is the code installed during `v1` execution visible to `v2`?
Caio Lima
Comment 20
2019-02-25 06:26:55 PST
Created
attachment 362897
[details]
Patch
Caio Lima
Comment 21
2019-02-25 07:13:31 PST
(In reply to Caio Lima from
comment #19
)
> Even with EWS green, I have some questions about the proposed Patch: > > 1. `generateThunkWithJumpTo` generates the thunk to jump to enable other > JIted code execute. However, I'm having troubles to understand what > guarantees this allocated memory will never be destroyed. > > 2. Let's suppose we have 2 VM's running concurrently (v1 and v2) and v1 > executes `functionForCallEntryThunk` for the first time. The thunk will be > allocated and installed under `v1` execution and then `v2` also calls > `functionForCallEntryThunk` afterwards. It will not execute > `generateThunkWithJumpTo` because it is already generated and then we return > the same value we returned to `v1` before. Is the code installed during `v1` > execution visible to `v2`?
I've got answers to these questions and they are explained on new ChangeLog entry.
Caio Lima
Comment 22
2019-03-12 12:57:35 PDT
Ping Review
Caio Lima
Comment 23
2019-03-13 11:46:50 PDT
Created
attachment 364555
[details]
Patch
Caio Lima
Comment 24
2019-03-14 14:39:00 PDT
Created
attachment 364689
[details]
Patch
Caio Lima
Comment 25
2019-03-18 10:28:25 PDT
Ping Review
Keith Miller
Comment 26
2019-03-18 16:19:08 PDT
Comment on
attachment 364689
[details]
Patch r=me. Although, I wonder if the getters should only have a weak static reference to some refcounted thing and we regenerate when needed. It's probably not worth doing now though.
Caio Lima
Comment 27
2019-03-19 06:09:13 PDT
Comment on
attachment 364689
[details]
Patch Thx a lot for the review! I created
https://bugs.webkit.org/show_bug.cgi?id=195941
to investigate usage of weak references.
WebKit Commit Bot
Comment 28
2019-03-19 06:36:11 PDT
Comment on
attachment 364689
[details]
Patch Clearing flags on attachment: 364689 Committed
r243136
: <
https://trac.webkit.org/changeset/243136
>
WebKit Commit Bot
Comment 29
2019-03-19 06:36:13 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 30
2019-03-19 06:38:31 PDT
<
rdar://problem/49017418
>
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